Browse Source

[IMP] add field legal representative

pull/1/head
houssine 7 years ago
parent
commit
2d23d85438
  1. 6
      easy_my_coop/models/partner.py
  2. 1
      easy_my_coop/view/res_partner_view.xml

6
easy_my_coop/models/partner.py

@ -106,6 +106,12 @@ class ResPartner(models.Model):
company_register_number = fields.Char(string='Company Register Number') company_register_number = fields.Char(string='Company Register Number')
cooperator_type = fields.Selection(selection='_get_share_type', compute='_compute_cooperator_type', string='Cooperator Type', store=True) cooperator_type = fields.Selection(selection='_get_share_type', compute='_compute_cooperator_type', string='Cooperator Type', store=True)
effective_date = fields.Date(sting="Effective Date", compute='_compute_effective_date', store=True) effective_date = fields.Date(sting="Effective Date", compute='_compute_effective_date', store=True)
representative = fields.Boolean(string="Legal Representative")
def has_representative(self):
if self.child_ids.filtered('representative'):
return True
return False
def get_cooperator_from_nin(self, national_id_number): def get_cooperator_from_nin(self, national_id_number):
return self.search([('cooperator','=',True),('national_register_number','=',national_id_number)]) return self.search([('cooperator','=',True),('national_register_number','=',national_id_number)])

1
easy_my_coop/view/res_partner_view.xml

@ -15,6 +15,7 @@
<xpath expr="/form/sheet/group" position='before'> <xpath expr="/form/sheet/group" position='before'>
<group> <group>
<field name="representative" readonly="True" attrs="{'invisible':['|',('parent_id','=',False),('is_company','=',True)]}"/>
<field name="cooperator_register_number" readonly="True" attrs="{'invisible':[('member','=',False)]}"/> <field name="cooperator_register_number" readonly="True" attrs="{'invisible':[('member','=',False)]}"/>
<field name="company_register_number" readonly="True" attrs="{'invisible':[('is_company','=',False)]}"/> <field name="company_register_number" readonly="True" attrs="{'invisible':[('is_company','=',False)]}"/>
<field name="national_register_number" readonly="True" attrs="{'invisible':[('is_company','=',True)]}" groups="easy_my_coop.group_energiris_super_manager"/> <field name="national_register_number" readonly="True" attrs="{'invisible':[('is_company','=',True)]}" groups="easy_my_coop.group_energiris_super_manager"/>

Loading…
Cancel
Save