Browse Source

[IMP] ffck_commons

16.0
RemiFr82 7 months ago
parent
commit
fa604b13c3
  1. 7
      ffck_commons/models/res_partner.py
  2. 6
      ffck_commons/views/res_partner.xml

7
ffck_commons/models/res_partner.py

@ -135,11 +135,10 @@ class ResPartner(models.Model):
] ]
) )
crck_by_state = {crck.state_id: crck for crck in crck_ok} crck_by_state = {crck.state_id: crck for crck in crck_ok}
print(crck_by_state)
states_ok = states & crck_ok.mapped("state_id") states_ok = states & crck_ok.mapped("state_id")
concerned = self.filtered( concerned = self.filtered(
lambda rp: rp.ffck_network lambda rp: rp.ffck_network
and int(rp.partner_scale) >= 3
and int(rp.partner_scale) >= 2
and rp.state_id in states_ok and rp.state_id in states_ok
) )
for partner in concerned: for partner in concerned:
@ -155,7 +154,7 @@ class ResPartner(models.Model):
cdck_ok = self.search( cdck_ok = self.search(
[ [
("ffck_network", "=", True), ("ffck_network", "=", True),
("partner_scale", "=", "4"),
("partner_scale", "=", "3"),
("country_department_id", "in", depts.ids), ("country_department_id", "in", depts.ids),
] ]
) )
@ -163,7 +162,7 @@ class ResPartner(models.Model):
depts_ok = depts & cdck_ok.mapped("country_department_id") depts_ok = depts & cdck_ok.mapped("country_department_id")
concerned = self.filtered( concerned = self.filtered(
lambda rp: rp.ffck_network lambda rp: rp.ffck_network
and int(rp.partner_scale) >= 4
and int(rp.partner_scale) >= 3
and rp.country_department_id in depts_ok and rp.country_department_id in depts_ok
) )
for partner in concerned: for partner in concerned:

6
ffck_commons/views/res_partner.xml

@ -33,9 +33,9 @@
<group name="ffck_network" string="Network" class="o_label_nowrap" <group name="ffck_network" string="Network" class="o_label_nowrap"
attrs="{'invisible': [('partner_scale', '=', '5')]}"> attrs="{'invisible': [('partner_scale', '=', '5')]}">
<field name="ffck_partner_id" /> <field name="ffck_partner_id" />
<field name="crck_partner_id" attrs="{'invisible': [('partner_scale', '=', '1')]}" />
<field name="cdck_partner_id" attrs="{'invisible': [('partner_scale', 'in', ['1', '2'])]}" />
<field name="local_partner_id" attrs="{'invisible': [('partner_scale', 'in', ['1', '2', '3'])]}" />
<field name="crck_partner_id" attrs="{'invisible': [('partner_scale', '=', ['1', '2'])]}" />
<field name="cdck_partner_id" attrs="{'invisible': [('partner_scale', 'not in', ['4', '5'])]}" />
<field name="local_partner_id" attrs="{'invisible': [('partner_scale', '!=', '5')]}" />
</group> </group>
</group> </group>
<group name="ffck_membership"> <group name="ffck_membership">

Loading…
Cancel
Save