diff --git a/beesdoo_base/__openerp__.py b/beesdoo_base/__openerp__.py index 6a7cd04..752c422 100644 --- a/beesdoo_base/__openerp__.py +++ b/beesdoo_base/__openerp__.py @@ -22,6 +22,7 @@ 'security/ir.model.access.csv', 'views/partner.xml', 'wizard/views/member_card.xml', - 'wizard/views/partner.xml' + 'wizard/views/partner.xml', + 'data/default_contact.xml', ], } diff --git a/beesdoo_base/data/default_contact.xml b/beesdoo_base/data/default_contact.xml new file mode 100644 index 0000000..2c7abdc --- /dev/null +++ b/beesdoo_base/data/default_contact.xml @@ -0,0 +1,10 @@ + + + + + commande@bees-coop.be + commande@bees-coop.be + True + + + \ No newline at end of file diff --git a/beesdoo_purchase/models/__init__.py b/beesdoo_purchase/models/__init__.py index 633f866..769ed40 100644 --- a/beesdoo_purchase/models/__init__.py +++ b/beesdoo_purchase/models/__init__.py @@ -1,2 +1 @@ -# -*- coding: utf-8 -*- - +import purchase diff --git a/beesdoo_purchase/models/purchase.py b/beesdoo_purchase/models/purchase.py new file mode 100644 index 0000000..5060dae --- /dev/null +++ b/beesdoo_purchase/models/purchase.py @@ -0,0 +1,14 @@ +# -*- coding: utf-8 -*- +from openerp import models, api + +class PurchaseOrder(models.Model): + _inherit = 'purchase.order' + + @api.model + def create(self, vals): + purchase_order = super(PurchaseOrder, self).create(vals) + command_contact = self.env.ref('beesdoo_base.commande_beescoop', raise_if_not_found=False) + # We do not need to update sale_order.mail_followers_ids, the link is automatic ?! + if command_contact: + self.env['mail.followers'].create({'res_model' : 'purchase.order', 'res_id' : purchase_order.id, 'partner_id' : command_contact.id}) + return purchase_order \ No newline at end of file