Skip to content

Commit 74b8f97

Browse files
committed
[IMP] academic: compute company on partners
company is computed if the partner type is setted
1 parent ba3ad1e commit 74b8f97

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

academic/models/res_partner.py

+6
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,7 @@ def _compute_student_links(self):
9696
# al hacerlo con mode tree nos simplfica bastante la herencia de vista porque no tenemos que agregar en el quick
9797
# create tantas cosas
9898
student_ids = fields.One2many('res.partner', 'parent_id')
99+
company_id = fields.Many2one(compute='_compute_company_id', store=True)
99100
# company_type = fields.Selection(selection_add=[('family', 'Family')])
100101
# is_family = fields.Boolean()
101102

@@ -147,3 +148,8 @@ def quickly_create_portal_user(self):
147148
active_model='res.partner').create({})
148149
wizard.user_ids.write({'in_portal': True})
149150
wizard.action_apply()
151+
152+
@api.depends('partner_type')
153+
def _compute_company_id(self):
154+
self.company_id = self.env.company if self.partner_type else False
155+

0 commit comments

Comments
 (0)