[IMP]: Fixed Brnach issue in current Company

This commit is contained in:
Hansa Rathod 2018-10-25 16:46:20 +05:30
parent 35e76be277
commit cffb46d553

View File

@ -149,3 +149,19 @@ class Users(models.Model):
branches_count = self._branches_count()
for user in self:
user.branches_count = branches_count
@api.model
def create(self, vals):
res = super(Users, self).create(vals)
if 'company_id' in vals:
vals.update({
'default_branch_id': self.company_id.branch_id.id,
})
return res
@api.multi
def write(self, vals):
res = super(Users, self).write(vals)
if 'company_id' in vals:
self.default_branch_id = self.company_id.branch_id.id
return res