Browse Source

[MERGE][TASK S0025] 0025 - commande@bees-coop.be follower automatique

pull/14/head
Thibault Francois 8 years ago
parent
commit
58cde0a162
  1. 3
      beesdoo_base/__openerp__.py
  2. 10
      beesdoo_base/data/default_contact.xml
  3. 3
      beesdoo_purchase/models/__init__.py
  4. 14
      beesdoo_purchase/models/purchase.py

3
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',
],
}

10
beesdoo_base/data/default_contact.xml

@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<data noupdate="1">
<record model="res.partner" id="commande_beescoop">
<field name="name">commande@bees-coop.be</field>
<field name="email">commande@bees-coop.be</field>
<field name="active">True</field>
</record>
</data>
</odoo>

3
beesdoo_purchase/models/__init__.py

@ -1,2 +1 @@
# -*- coding: utf-8 -*-
import purchase

14
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
Loading…
Cancel
Save