...
 
Commits (3)
......@@ -99,6 +99,7 @@ class ScopPartner(models.Model):
facebook = fields.Char("Facebook")
linkedin = fields.Char("LinkedIn")
twitter = fields.Char("Twitter")
instagram = fields.Char("Instagram")
# Infos générales / Suivi UR
ur_id = fields.Many2one(
......@@ -141,6 +142,20 @@ class ScopPartner(models.Model):
column2='segment_id',
string='Segmentation 4')
segment_1_nb = fields.Integer(
string="Nb de segments 1",
compute="_compute_segment_nb")
segment_2_nb = fields.Integer(
string="Nb de segments 2",
compute="_compute_segment_nb")
segment_3_nb = fields.Integer(
string="Nb de segments 3",
compute="_compute_segment_nb")
segment_4_nb = fields.Integer(
string="Nb de segments 4",
compute="_compute_segment_nb")
# Infos générales / Infos activité
creation_origin_id = fields.Many2one(
'res.partner.creation.origin',
......@@ -773,6 +788,26 @@ class ScopPartner(models.Model):
partner.staff_last = lm[0].staff_count
partner.staff_last_date = lm[0].effective_date
@api.multi
def _compute_segment_nb(self):
for partner in self:
# Calcul nombre de segment 1
seg1 = partner.env['res.partner.segment1'].search([
('ur_id', '=', self.env.user.ur_id.id)])
partner.segment_1_nb = len(seg1)
# Calcul nombre de segment 2
seg2 = partner.env['res.partner.segment2'].search([
('ur_id', '=', self.env.user.ur_id.id)])
partner.segment_2_nb = len(seg2)
# Calcul nombre de segment 3
seg3 = partner.env['res.partner.segment3'].search([
('ur_id', '=', self.env.user.ur_id.id)])
partner.segment_3_nb = len(seg3)
# Calcul nombre de segment 4
seg4 = partner.env['res.partner.segment4'].search([
('ur_id', '=', self.env.user.ur_id.id)])
partner.segment_4_nb = len(seg4)
# ------------------------------------------------------
# Button Action
# ------------------------------------------------------
......
......@@ -127,11 +127,16 @@
</field>
<xpath expr='//form/sheet/group/group[2]' position="replace">
<group 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"/>
<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)]"/>
<field name="segment_2_id" widget="many2many_tags" options="{'color_field': 'color', 'no_create': True}" domain="[('ur_id', '=', ur_id)]"/>
<field name="segment_3_id" widget="many2many_tags" options="{'color_field': 'color', 'no_create': True}" domain="[('ur_id', '=', ur_id)]"/>
<field name="segment_4_id" widget="many2many_tags" options="{'color_field': 'color', 'no_create': True}" domain="[('ur_id', '=', ur_id)]"/>
<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" widget="res_partner_many2one" options="{'no_open': True, 'no_create': True}" domain="[('active', '=', True),('ur_id', '=', ur_id)]" attrs="{'invisible': ['|', ('is_company','=', False), ('type', '!=', 'contact')]}"/>
......@@ -334,11 +339,12 @@
<field name="zip_departement" string="N° de département" />
<field name="region" />
<field name="website" widget="url" attrs="{'invisible': [('project_status', 'in', ('1_information', '2_pre-diagnostic'))]}"/>
<label for='facebook' class="oe_read_only" string="Réseaux sociaux" attrs="{'invisible':[('facebook','=',False),('linkedin','=',False),('twitter','=',False)]}"/>
<label for='facebook' class="oe_read_only" string="Réseaux sociaux" attrs="{'invisible':[('facebook','=',False),('linkedin','=',False),('twitter','=',False),('instagram','=',False)]}"/>
<div >
<button string="" class="btn-cgscop oe_read_only" name="open_facebook" type="object" icon="fa-facebook" attrs="{'invisible':['|', ('facebook','=',False), ('project_status', 'in', ('1_information', '2_pre-diagnostic'))]}"/>
<button string="" class="btn-cgscop oe_read_only" name="open_linkedin" type="object" icon="fa-linkedin" attrs="{'invisible':['|', ('linkedin','=',False), ('project_status', 'in', ('1_information', '2_pre-diagnostic'))]}"/>
<button string="" class="btn-cgscop oe_read_only" name="open_twitter" type="object" icon="fa-twitter" attrs="{'invisible':['|', ('twitter','=',False), ('project_status', 'in', ('1_information', '2_pre-diagnostic'))]}"/>
<button string="" class="btn-cgscop oe_read_only" name="open_instagram" type="object" icon="fa-instagram" attrs="{'invisible':['|', ('instagram','=',False), ('project_status', 'in', ('1_information', '2_pre-diagnostic'))]}"/>
</div>
<label for='facebook' string="Facebook" class="oe_edit_only" attrs="{'invisible': [('project_status', 'in', ('1_information', '2_pre-diagnostic'))]}"/>
<div >
......@@ -352,6 +358,11 @@
<div >
<field class="oe_edit_only" name="twitter" widget="url" attrs="{'invisible': [('project_status', 'in', ('1_information', '2_pre-diagnostic'))]}"/>
</div>
<label class="oe_edit_only" for='instagram' string="Instagram" attrs="{'invisible': [('project_status', 'in', ('1_information', '2_pre-diagnostic'))]}"/>
<div >
<field class="oe_edit_only" name="instagram" widget="url" attrs="{'invisible': [('project_status', 'in', ('1_information', '2_pre-diagnostic'))]}"/>
</div>
<field name="id_riga" groups="cgscop_partner.group_cg_administrator"/>
</group>
<group string="Suivi UR">
......@@ -360,10 +371,10 @@
attrs="{'required':[('project_status','in',('3_accompagnement','4_adhesion', '5_cg'))], 'invisible':[('project_status', 'in', '6_suivi')]}" options="{'no_open': True, 'no_create': True}" domain="[('ur_id', '=', ur_id)]"/>
<field name="followup_delegate_id" widget="res_partner_many2one" options="{'no_open': True, 'no_create': True}" domain="[('active', '=', True),('ur_id', '=', ur_id)]" attrs="{'invisible': [('project_status', 'in', ('1_information', '2_pre-diagnostic', '3_accompagnement'))]}"/>
<field name="support_delegate_id" widget="res_partner_many2one" options="{'no_open': True, 'no_create': True}" domain="[('active', '=', True),('ur_id', '=', ur_id)]" />
<field name="segment_1_id" widget="many2many_tags" options="{'color_field': 'color', 'no_create': True}" domain="[('ur_id', '=', ur_id)]" attrs="{'invisible': [('project_status', 'in', ('1_information'))]}"/>
<field name="segment_2_id" widget="many2many_tags" options="{'color_field': 'color', 'no_create': True}" domain="[('ur_id', '=', ur_id)]" attrs="{'invisible': [('project_status', 'in', ('1_information'))]}"/>
<field name="segment_3_id" widget="many2many_tags" options="{'color_field': 'color', 'no_create': True}" domain="[('ur_id', '=', ur_id)]" attrs="{'invisible': [('project_status', 'in', ('1_information'))]}"/>
<field name="segment_4_id" widget="many2many_tags" options="{'color_field': 'color', 'no_create': True}" domain="[('ur_id', '=', ur_id)]" attrs="{'invisible': [('project_status', 'in', ('1_information'))]}"/>
<field name="segment_1_id" widget="many2many_tags" options="{'color_field': 'color', 'no_create': True}" domain="[('ur_id', '=', ur_id)]" attrs="{'invisible': ['|',('project_status', 'in', ('1_information')),('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': ['|',('project_status', 'in', ('1_information')),('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': ['|',('project_status', 'in', ('1_information')),('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': ['|',('project_status', 'in', ('1_information')),('segment_4_nb', '=', 0)]}"/>
<field name="is_federation_com" invisible="True"/>
<field name="is_federation_indus" invisible="True"/>
<field name="activity_federation_com_ids" groups="cgscop_partner.group_federation_com" options="{'no_open': True, 'no_create': True}" attrs="{'invisible': [('is_federation_com', '!=', True)]}" widget="many2many_tags"/>
......