|
|
@ -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 |