Browse Source

[FIX] emc: get_share_type returns ids

pull/46/head
robin.keunen 5 years ago
parent
commit
e02c63e330
  1. 17
      easy_my_coop/models/partner.py

17
easy_my_coop/models/partner.py

@ -53,14 +53,6 @@ class ResPartner(models.Model):
for partner, child_ids in all_partners_and_children.items(): for partner, child_ids in all_partners_and_children.items():
partner.total_invoiced = sum(price['total'] for price in price_totals if price['partner_id'] in child_ids) partner.total_invoiced = sum(price['total'] for price in price_totals if price['partner_id'] in child_ids)
@api.multi
def _get_share_type(self):
product_obj = self.env['product.product']
share_type_list = [('', '')]
for share_type in product_obj.search([('is_share', '=', True)]):
share_type_list.append((str(share_type.id), share_type.short_name))
return share_type_list
@api.multi @api.multi
@api.depends('share_ids') @api.depends('share_ids')
def _compute_effective_date(self): def _compute_effective_date(self):
@ -69,6 +61,15 @@ class ResPartner(models.Model):
if partner.share_ids: if partner.share_ids:
partner.effective_date = partner.share_ids[0].effective_date partner.effective_date = partner.share_ids[0].effective_date
@api.multi
def _get_share_type(self):
shares = (
self.env['product.product']
.search([('is_share', '=', True)])
)
share_types = [(share.default_code, share.short_name) for share in shares]
return [('', '')] + share_types
@api.multi @api.multi
@api.depends('share_ids') @api.depends('share_ids')
def _compute_cooperator_type(self): def _compute_cooperator_type(self):

Loading…
Cancel
Save