From 6121fe1f29984cb37daedf0cf455d1af789ea01d Mon Sep 17 00:00:00 2001 From: jmf Date: Tue, 8 Mar 2016 21:01:24 +0100 Subject: [PATCH 01/15] [IMP] Added validator to 'country' field --- beesdoo_base/models/partner.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/beesdoo_base/models/partner.py b/beesdoo_base/models/partner.py index 6be5e08..928d5f8 100644 --- a/beesdoo_base/models/partner.py +++ b/beesdoo_base/models/partner.py @@ -25,6 +25,12 @@ class Partner(models.Model): def _on_change_name(self): self.name = concat_names(self.first_name, self.last_name) + @api.one + @api.constrains('country_id') + def _check_country(self): + if len(self.country_id) == 0: + raise ValidationError(_('Country is mandatory')) + @api.one @api.depends('parent_eater_id', 'parent_eater_id.barcode', 'eater', 'member_card_ids') def _get_bar_code(self): From 20949b37900aa8f60e8b0c5edfa2a1d6f20f0298 Mon Sep 17 00:00:00 2001 From: EliseDup Date: Sat, 16 Apr 2016 15:52:20 +0200 Subject: [PATCH 02/15] S0025 - add default contact commande@bees-coop.be --- beesdoo_base/__openerp__.py | 1 + beesdoo_base/data/default_contact.xml | 9 +++++++++ 2 files changed, 10 insertions(+) create mode 100644 beesdoo_base/data/default_contact.xml diff --git a/beesdoo_base/__openerp__.py b/beesdoo_base/__openerp__.py index a452a53..0cd26b4 100644 --- a/beesdoo_base/__openerp__.py +++ b/beesdoo_base/__openerp__.py @@ -18,6 +18,7 @@ 'depends': ['point_of_sale'], 'data': [ + 'data/default_contact.xml', 'security/ir.model.access.csv', 'views/partner.xml', 'wizard/views/new_member_card.xml', diff --git a/beesdoo_base/data/default_contact.xml b/beesdoo_base/data/default_contact.xml new file mode 100644 index 0000000..0ed749e --- /dev/null +++ b/beesdoo_base/data/default_contact.xml @@ -0,0 +1,9 @@ + + + + + commande@bees-coop.be + commande@bees-coop.be + + + \ No newline at end of file From b7e4a45483a36f89c50634d621577ebf59dd8fa1 Mon Sep 17 00:00:00 2001 From: EliseDup Date: Sat, 16 Apr 2016 16:17:14 +0200 Subject: [PATCH 03/15] S0025 progress --- beesdoo_pos/models/beesdoo_sale_order.py | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 beesdoo_pos/models/beesdoo_sale_order.py diff --git a/beesdoo_pos/models/beesdoo_sale_order.py b/beesdoo_pos/models/beesdoo_sale_order.py new file mode 100644 index 0000000..6264d09 --- /dev/null +++ b/beesdoo_pos/models/beesdoo_sale_order.py @@ -0,0 +1,9 @@ +# -*- coding: utf-8 -*- +from openerp import models, fields, api, _ + +class SaleOrder(models.Model): + _inherit = 'sale.order' + + message_follower_ids = fields.One2many( + 'mail.followers', 'res_id', string='Followers', + domain=lambda self: [('res_model', '=', self._name)]) From 2d972ed6c001bbbcda7ee5cc2a9c62d77fab1487 Mon Sep 17 00:00:00 2001 From: EliseDup Date: Fri, 13 May 2016 17:32:05 +0200 Subject: [PATCH 04/15] S0025 : at each creation of a sale_order, create a mail_follower linked to contact command@bees-coop.be --- beesdoo_base/data/default_contact.xml | 1 + beesdoo_pos/models/__init__.py | 2 +- beesdoo_pos/models/beesdoo_sale_order.py | 14 +++++++++----- 3 files changed, 11 insertions(+), 6 deletions(-) diff --git a/beesdoo_base/data/default_contact.xml b/beesdoo_base/data/default_contact.xml index 0ed749e..2c7abdc 100644 --- a/beesdoo_base/data/default_contact.xml +++ b/beesdoo_base/data/default_contact.xml @@ -4,6 +4,7 @@ commande@bees-coop.be commande@bees-coop.be + True \ No newline at end of file diff --git a/beesdoo_pos/models/__init__.py b/beesdoo_pos/models/__init__.py index e5c2cf4..42d588c 100644 --- a/beesdoo_pos/models/__init__.py +++ b/beesdoo_pos/models/__init__.py @@ -1 +1 @@ -import beesdoo_pos \ No newline at end of file +import beesdoo_pos, beesdoo_sale_order \ No newline at end of file diff --git a/beesdoo_pos/models/beesdoo_sale_order.py b/beesdoo_pos/models/beesdoo_sale_order.py index 6264d09..4d10f5d 100644 --- a/beesdoo_pos/models/beesdoo_sale_order.py +++ b/beesdoo_pos/models/beesdoo_sale_order.py @@ -1,9 +1,13 @@ # -*- coding: utf-8 -*- -from openerp import models, fields, api, _ +from openerp import models, api class SaleOrder(models.Model): _inherit = 'sale.order' - - message_follower_ids = fields.One2many( - 'mail.followers', 'res_id', string='Followers', - domain=lambda self: [('res_model', '=', self._name)]) + + @api.model + def create(self, vals): + sale_order = super(SaleOrder, self).create(vals) + command_contact = self.env['res.partner'].search([('email', '=', 'commande@bees-coop.be')])[0] + # We do not need to update sale_order.mail_followers_ids, the link is automatic ?! + self.env['mail.followers'].create({'res_model' : 'sale.order', 'res_id' : sale_order.id, 'partner_id' : command_contact.id}) + return sale_order \ No newline at end of file From 91806281952d4869fbf0d04e6ed228c64ccda1ac Mon Sep 17 00:00:00 2001 From: jmf Date: Sat, 21 May 2016 13:19:06 +0200 Subject: [PATCH 05/15] [FIX] Changed the way the partner's country_id is flagged as 'mandatory' --- beesdoo_base/models/partner.py | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/beesdoo_base/models/partner.py b/beesdoo_base/models/partner.py index 928d5f8..6239939 100644 --- a/beesdoo_base/models/partner.py +++ b/beesdoo_base/models/partner.py @@ -20,17 +20,12 @@ class Partner(models.Model): barcode = fields.Char(compute="_get_bar_code", string='Code Barre', store=True) parent_barcode = fields.Char(compute="_get_bar_code", string='Code Barre du Parent', store=True) member_card_ids = fields.One2many('member.card', 'partner_id') + country_id = fields.Many2one('res.country', string='Country', required=True) @api.onchange('first_name', 'last_name') def _on_change_name(self): self.name = concat_names(self.first_name, self.last_name) - @api.one - @api.constrains('country_id') - def _check_country(self): - if len(self.country_id) == 0: - raise ValidationError(_('Country is mandatory')) - @api.one @api.depends('parent_eater_id', 'parent_eater_id.barcode', 'eater', 'member_card_ids') def _get_bar_code(self): From 9fd6cb1a25207dbb571c60629f6fe939b3d5b9f7 Mon Sep 17 00:00:00 2001 From: EliseDup Date: Thu, 2 Jun 2016 08:39:34 +0200 Subject: [PATCH 06/15] =?UTF-8?q?Demander=20l'impression=20automatique=20d?= =?UTF-8?q?e=20la=20carte=20de=20membre=20que=20on=20en=20cr=C3=A9e=20une?= =?UTF-8?q?=20nouvelle?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- beesdoo_base/wizard/member_card.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/beesdoo_base/wizard/member_card.py b/beesdoo_base/wizard/member_card.py index 47d010f..1f6842a 100644 --- a/beesdoo_base/wizard/member_card.py +++ b/beesdoo_base/wizard/member_card.py @@ -21,7 +21,7 @@ class NewMemberCardWizard(models.TransientModel): client = self.partner_id.sudo() client._deactivate_active_cards() client._new_card(self.new_comment, self.env.uid, barcode=self.force_barcode) - + client.write({'member_card_to_be_printed' : True}) class RequestMemberCardPrintingWizard(models.TransientModel): From f2bc207b2d25710cb342aae118ecd0cbad38ddfd Mon Sep 17 00:00:00 2001 From: EliseDup Date: Thu, 2 Jun 2016 20:29:51 +0200 Subject: [PATCH 07/15] =?UTF-8?q?S010=20:=20afficher=20le=20champ=20"Mange?= =?UTF-8?q?ur/Travailleur"=20seulement=20si=20le=20res.partner=20est=20un?= =?UTF-8?q?=20CLIENT=20(et=20ind=C3=A9pendant=20de=20si=20c'est=20une=20so?= =?UTF-8?q?ci=C3=A9t=C3=A9=20ou=20un=20particulier)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- beesdoo_base/views/partner.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/beesdoo_base/views/partner.xml b/beesdoo_base/views/partner.xml index 127a866..0a01e83 100644 --- a/beesdoo_base/views/partner.xml +++ b/beesdoo_base/views/partner.xml @@ -21,7 +21,7 @@ + attrs="{'invisible': [('customer', '=', False)]}" /> From 5387e0cd960327ff808182422a7a8e25324cba33 Mon Sep 17 00:00:00 2001 From: EliseDup Date: Fri, 3 Jun 2016 15:53:22 +0200 Subject: [PATCH 08/15] =?UTF-8?q?Ajout=20d'un=20wizard=20pour=20cr=C3=A9er?= =?UTF-8?q?=20un=20nouvel=20enfant=20directement=20chez=20le=20travailleur?= =?UTF-8?q?.=20Correction=20de=20qq=20mots=20qui=20=C3=A9taient=20encore?= =?UTF-8?q?=20en=20fran=C3=A7ais?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- beesdoo_base/__openerp__.py | 1 + beesdoo_base/models/partner.py | 15 ++- beesdoo_base/views/partner.xml | 137 ++++++++++++---------- beesdoo_base/wizard/__init__.py | 2 +- beesdoo_base/wizard/member_card.py | 2 +- beesdoo_base/wizard/partner.py | 22 ++++ beesdoo_base/wizard/views/member_card.xml | 6 +- beesdoo_base/wizard/views/partner.xml | 22 ++++ 8 files changed, 138 insertions(+), 69 deletions(-) create mode 100644 beesdoo_base/wizard/partner.py create mode 100644 beesdoo_base/wizard/views/partner.xml diff --git a/beesdoo_base/__openerp__.py b/beesdoo_base/__openerp__.py index 6101c91..c070008 100644 --- a/beesdoo_base/__openerp__.py +++ b/beesdoo_base/__openerp__.py @@ -22,5 +22,6 @@ 'security/ir.model.access.csv', 'views/partner.xml', 'wizard/views/member_card.xml', + 'wizard/views/partner.xml' ], } diff --git a/beesdoo_base/models/partner.py b/beesdoo_base/models/partner.py index baf19b1..5b22307 100644 --- a/beesdoo_base/models/partner.py +++ b/beesdoo_base/models/partner.py @@ -44,7 +44,7 @@ class Partner(models.Model): def write(self, values): if values.get('parent_eater_id') and self.parent_eater_id: raise ValidationError(_('You try to assign a eater to a worker but this easer is alread assign to %s please remove it before') % self.parent_eater_id.name) - #replace many2many command when writing on child_eater_ids to just remove the link + # replace many2many command when writing on child_eater_ids to just remove the link if 'child_eater_ids' in values: for command in values['child_eater_ids']: if command[0] == 2: @@ -74,4 +74,15 @@ class Partner(models.Model): cr.execute("UPDATE res_partner set last_name = name where last_name IS NULL") return res - + @api.multi + def _new_eater(self, name, surname, email): + partner_data = { + 'name' : name, + 'surname' : surname, + 'is_customer' : True, + 'eater' : 'eater', + 'parent_eater_id' : self.id, + 'email' : email + } + self.env['res.partner'].create(partner_data) + diff --git a/beesdoo_base/views/partner.xml b/beesdoo_base/views/partner.xml index 0a01e83..9aa98d2 100644 --- a/beesdoo_base/views/partner.xml +++ b/beesdoo_base/views/partner.xml @@ -1,72 +1,85 @@ - - New Member Card - membercard.new.wizard - form - new - + + New Member Card + membercard.new.wizard + form + new + + + + New Eater + eater.new.wizard + form + new + - - beesdoo.partner.form.view - res.partner - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -