flectra/addons/base_branch_company/models/res_partner.py
2018-01-17 10:43:56 +05:30

23 lines
695 B
Python

# -*- coding: utf-8 -*-
from flectra import api, fields, models
class Partner(models.Model):
_name = "res.partner"
_inherit = ["res.partner", "ir.branch.company.mixin"]
@api.multi
def write(self, vals):
field_list = ['street', 'street2', 'zip', 'city', 'state_id',
'country_id', 'email', 'phone', 'mobile']
branch_vals = dict((f, vals[f]) for f in field_list if f in vals)
if branch_vals and self.branch_id:
ctx = self.env.context.copy()
ctx.update({'branch': True})
self.branch_id.with_context(ctx).write(branch_vals)
result = super(Partner, self).write(vals)
return result