Browse Source

[IMP] 008-z-C : enlever le type de coopérateur sur anciens coopérateurs: when share number is 0, you have no cooperator type anymore

9.0-shift6-welcome_screen-tfr
Thibault Francois 7 years ago
parent
commit
58e0b5a4c8
  1. 8
      beesdoo_easy_my_coop/models/res_partner.py

8
beesdoo_easy_my_coop/models/res_partner.py

@ -7,11 +7,13 @@ class Partner(models.Model):
cooperator_type = fields.Selection(selection='_get_share_type', compute='_compute_share_type', string='Cooperator Type', store=True)
@api.multi
@api.depends('share_ids', 'share_ids.share_product_id', 'share_ids.share_product_id.default_code')
@api.depends('share_ids', 'share_ids.share_product_id', 'share_ids.share_product_id.default_code', 'share_ids.share_number')
def _compute_share_type(self):
for rec in self:
codes = rec.share_ids.mapped('share_product_id.default_code')
rec.cooperator_type = codes[0] if codes else ''
if rec.share_ids and rec.share_ids[0].share_number > 0:
rec.cooperator_type = rec.share_ids[0].share_product_id.default_code
else:
rec.cooperator_type = ''
@api.multi
def _get_share_type(self):

Loading…
Cancel
Save