Browse Source

[FIX] beesdoo_easy_my_coop: define properly search is_worker

Define properly the search function for is_worker
Find the share line with a product allow working
and then find all the partner link to those lines
pull/159/head 12.0-2020-06-26.01
Thibault Francois 5 years ago
committed by Rémy Taymans
parent
commit
c0a25cf8de
  1. 12
      beesdoo_easy_my_coop/models/res_partner.py

12
beesdoo_easy_my_coop/models/res_partner.py

@ -36,6 +36,7 @@ class Partner(models.Model):
"share_ids",
"share_ids.share_product_id",
"share_ids.share_product_id.default_code",
"share_ids.share_product_id.allow_working",
"share_ids.share_number",
)
def _compute_is_worker(self):
@ -47,13 +48,18 @@ class Partner(models.Model):
share_type = rec._cooperator_share_type()
if share_type:
rec.is_worker = share_type.allow_working
rec.worker_store = share_type.allow_working
else:
rec.is_worker = False
rec.worker_store = False
def _search_worker(self, operator, value):
return [("worker_store", operator, value)]
lines = self.env['share.line'].search(
[('share_product_id.allow_working', '=', 'True')]
)
partner_ids = lines.mapped('partner_id').ids
if (operator, value) in [('=', True), ('!=', False)]:
return [('id', 'in', partner_ids)]
else:
return [('id', 'not in', partner_ids)]
@api.depends(
"cooperative_status_ids",

Loading…
Cancel
Save