Skip to content
Extraits de code Groupes Projets
Valider 76937a9e rédigé par Benjamin - Le Filament's avatar Benjamin - Le Filament
Parcourir les fichiers

[cgscop #269] MR Hervé : 12-RV-copadev - fix bug organization_type_id + add coopadev infos

parent ef8d98d2
Branches
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
......@@ -248,6 +248,9 @@ class ScopPartner(models.Model):
column2='indus_activity_id',
string="Domaine d'activité Industrie",
help="Fédération de l'Industrie - Domaine d'activité")
copadev_member = fields.Boolean(
string="Adhérent copadev",
track_visibility='onchange')
# Contacts
director_ids = fields.One2many(
......@@ -391,9 +394,9 @@ class ScopPartner(models.Model):
# Champs pour partenaires
organization_type_id = fields.Many2one(
'res.partner.organization.type',
string="Catégorie Type",
domain=[('parent_id', '=', False)],
string="Famille",
on_delete='restrict',
compute='_compute_org_type_id',
track_visibility='onchange')
organization_subtype_id = fields.Many2one(
'res.partner.organization.type',
......@@ -490,15 +493,6 @@ class ScopPartner(models.Model):
else:
coop.seed_end = False
@api.onchange('organization_subtype_id')
def onchange_organization_subtype_id(self):
for partner in self:
if partner.organization_subtype_id:
partner.organization_type_id = \
partner.organization_subtype_id.parent_id
else:
partner.organization_type_id = False
@api.onchange('name')
def onchange_name(self):
if self.search_count([('name', '=ilike', self.name)]) > 0:
......@@ -839,6 +833,14 @@ class ScopPartner(models.Model):
('ur_id', '=', self.env.user.ur_id.id)])
partner.segment_4_nb = len(seg4)
@api.depends('organization_subtype_id')
def _compute_org_type_id(self):
for partner in self:
if partner.organization_subtype_id:
partner.organization_type_id = partner.organization_subtype_id.parent_id
else:
partner.organization_type_id = False
# ------------------------------------------------------
# Button Action
# ------------------------------------------------------
......
......@@ -120,21 +120,28 @@
<attribute name="invisible">1</attribute>
</field>
<xpath expr='//form/sheet/group/group[2]' position="replace">
<group name="partner_segment_info" attrs="{'invisible': [('is_company', '=', False)]}">
<group col="1" name="partner_segment_info" attrs="{'invisible': [('is_company', '=', False)]}">
<field name="segment_1_nb" invisible="1"/>
<field name="segment_2_nb" invisible="1"/>
<field name="segment_3_nb" invisible="1"/>
<field name="segment_4_nb" invisible="1"/>
<group string="Informations diverses">
<field name="organization_subtype_id" attrs="{'invisible': ['|', ('is_company','=', False), ('type', '!=', 'contact')]}" domain="[('child_ids', '=', False)]" options="{'no_create': True, 'no_open': True}"/>
<field name="organization_type_id" readonly="1" attrs="{'invisible': ['|', ('is_company', '=', False), ('type', '!=', 'contact')]}" options="{'no_create': True, 'no_open': True}"/>
<field name="certification_ids" widget="many2many_tags" options="{'color_field': 'color', 'no_create': True}" attrs="{'invisible': [('is_company', '=', False)]}"/>
<field name="segment_1_id" widget="many2many_tags" options="{'color_field': 'color', 'no_create': True}" domain="[('ur_id', '=', ur_id)]" attrs="{'invisible':[('segment_1_nb', '=', 0)]}" />
<field name="segment_2_id" widget="many2many_tags" options="{'color_field': 'color', 'no_create': True}" domain="[('ur_id', '=', ur_id)]" attrs="{'invisible':[('segment_2_nb', '=', 0)]}"/>
<field name="segment_3_id" widget="many2many_tags" options="{'color_field': 'color', 'no_create': True}" domain="[('ur_id', '=', ur_id)]" attrs="{'invisible':[('segment_3_nb', '=', 0)]}"/>
<field name="segment_4_id" widget="many2many_tags" options="{'color_field': 'color', 'no_create': True}" domain="[('ur_id', '=', ur_id)]" attrs="{'invisible':[('segment_4_nb', '=', 0)]}"/>
<field name="organization_subtype_id" attrs="{'invisible': ['|', ('is_company','=', False), ('type', '!=', 'contact')]}" domain="[('child_ids', '=', False)]" options="{'no_create': True, 'no_open': True}"/>
<field name="organization_type_id" readonly="1" attrs="{'invisible': ['|', ('is_company', '=', False), ('type', '!=', 'contact')]}" options="{'no_create': True, 'no_open': True}"/>
<field name="followup_delegate_id" options="{'no_open': True, 'no_create': True}" domain="[('active', '=', True),('ur_id', '=', ur_id)]" attrs="{'invisible': ['|', ('is_company','=', False), ('type', '!=', 'contact')]}"/>
</group>
<group string="Féd. communication" groups="cgscop_partner.group_federation_com">
<field name="copadev_member" widget="boolean_toggle"/>
<field name="activity_federation_com_ids" options="{'no_open': True, 'no_create': True}" widget="many2many_tags"/>
</group>
</group>
<group name="contact_segment_info" attrs="{'invisible': ['|', ('is_company', '=', True), ('type', '!=', 'contact')]}">
<field name="title" options='{"no_create": True, "no_open": True}' attrs="{'invisible': [('is_company','=', True)]}"/>
<field name="mandate_id" options='{"no_create": True, "no_open": True}' attrs="{'invisible': [('is_company','=', True)]}"/>
......
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Veuillez vous inscrire ou vous pour commenter