Browse Source

[REF] emc: reorder functions and use list comprehensions

pull/47/head
robin.keunen 5 years ago
parent
commit
9277ee37de
  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():
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.depends('share_ids')
def _compute_effective_date(self):
@ -69,6 +61,15 @@ class ResPartner(models.Model):
if partner.share_ids:
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.id, share.short_name) for share in shares]
return [('', '')] + share_types
@api.multi
@api.depends('share_ids')
def _compute_cooperator_type(self):

Loading…
Cancel
Save