[REF]GOLEM PCS : several refactorings
This commit is contained in:
parent
4e33afff0b
commit
518749b78f
@ -24,39 +24,35 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||||||
<!-- Groupes socioprofessionnels -->
|
<!-- Groupes socioprofessionnels -->
|
||||||
<record model="golem.pcs" id="golem_pcs_agriculteurs_exploitants">
|
<record model="golem.pcs" id="golem_pcs_agriculteurs_exploitants">
|
||||||
<field name="name">Agriculteurs exploitants</field>
|
<field name="name">Agriculteurs exploitants</field>
|
||||||
<field name="code">1</field>
|
<field name="code">01</field>
|
||||||
</record>
|
</record>
|
||||||
<record model="golem.pcs" id="golem_pcs_artisans_commercants_et_chefs_entreprise">
|
<record model="golem.pcs" id="golem_pcs_artisans_commercants_et_chefs_entreprise">
|
||||||
<field name="name">Artisans, commerçants et chefs d’entreprise</field>
|
<field name="name">Artisans, commerçants et chefs d’entreprise</field>
|
||||||
<field name="code">2</field>
|
<field name="code">02</field>
|
||||||
</record>
|
</record>
|
||||||
<record model="golem.pcs" id="golem_pcs_cadres_et_professions_intellectuelles_superieures">
|
<record model="golem.pcs" id="golem_pcs_cadres_et_professions_intellectuelles_superieures">
|
||||||
<field name="name">Cadres et professions intellectuelles supérieures</field>
|
<field name="name">Cadres et professions intellectuelles supérieures</field>
|
||||||
<field name="code">3</field>
|
<field name="code">03</field>
|
||||||
</record>
|
</record>
|
||||||
<record model="golem.pcs" id="golem_pcs_professions_intermediaires">
|
<record model="golem.pcs" id="golem_pcs_professions_intermediaires">
|
||||||
<field name="name">Professions intermédiaires</field>
|
<field name="name">Professions intermédiaires</field>
|
||||||
<field name="code">4</field>
|
<field name="code">04</field>
|
||||||
</record>
|
</record>
|
||||||
<record model="golem.pcs" id="golem_pcs_employes">
|
<record model="golem.pcs" id="golem_pcs_employes">
|
||||||
<field name="name">Employés</field>
|
<field name="name">Employés</field>
|
||||||
<field name="code">5</field>
|
<field name="code">05</field>
|
||||||
</record>
|
</record>
|
||||||
<record model="golem.pcs" id="golem_pcs_ouvriers">
|
<record model="golem.pcs" id="golem_pcs_ouvriers">
|
||||||
<field name="name">Ouvriers</field>
|
<field name="name">Ouvriers</field>
|
||||||
<field name="code">6</field>
|
<field name="code">06</field>
|
||||||
</record>
|
</record>
|
||||||
<record model="golem.pcs" id="golem_pcs_retraites">
|
<record model="golem.pcs" id="golem_pcs_retraites">
|
||||||
<field name="name">Retraités</field>
|
<field name="name">Retraités</field>
|
||||||
<field name="code">7</field>
|
<field name="code">07</field>
|
||||||
</record>
|
|
||||||
<record model="golem.pcs" id="golem_pcs_retraites">
|
|
||||||
<field name="name">Retraités</field>
|
|
||||||
<field name="code">7</field>
|
|
||||||
</record>
|
</record>
|
||||||
<record model="golem.pcs" id="golem_pcs_autres_personnes_sans_activite_professionnelle">
|
<record model="golem.pcs" id="golem_pcs_autres_personnes_sans_activite_professionnelle">
|
||||||
<field name="name">Autres personnes sans activité professionnelle</field>
|
<field name="name">Autres personnes sans activité professionnelle</field>
|
||||||
<field name="code">8</field>
|
<field name="code">08</field>
|
||||||
</record>
|
</record>
|
||||||
|
|
||||||
<!-- Catégories socioprofessionnelles -->
|
<!-- Catégories socioprofessionnelles -->
|
||||||
|
@ -18,11 +18,11 @@
|
|||||||
|
|
||||||
""" GOLEM Member adaptations """
|
""" GOLEM Member adaptations """
|
||||||
|
|
||||||
from odoo import models, fields, api, _
|
from odoo import models, fields
|
||||||
|
|
||||||
class GolemMember(models.Model):
|
class GolemMember(models.Model):
|
||||||
""" GOLEM Member extention """
|
""" GOLEM Member extention """
|
||||||
_inherit = 'golem.member'
|
_inherit = 'golem.member'
|
||||||
|
|
||||||
pcs_id = fields.Many2one('golem.pcs', string='Professions and Socioprofessional Categories',
|
pcs_id = fields.Many2one('golem.pcs', string='PCS', index=True,
|
||||||
domain="[('parent_id', '!=', False)]")
|
help='Professions and Socioprofessional Categories')
|
||||||
|
@ -18,12 +18,21 @@
|
|||||||
|
|
||||||
""" GOLEM PCS """
|
""" GOLEM PCS """
|
||||||
|
|
||||||
from odoo import models, fields, api, _
|
from odoo import models, fields, api
|
||||||
|
|
||||||
class GolemPCS(models.Model):
|
class GolemPCS(models.Model):
|
||||||
""" GOLEM PCS """
|
""" GOLEM PCS """
|
||||||
_name = 'golem.pcs'
|
_name = 'golem.pcs'
|
||||||
|
_rec_name = 'full_name'
|
||||||
|
_order = 'code asc'
|
||||||
|
|
||||||
name = fields.Char(required=True, index=True)
|
full_name = fields.Char(compute='_compute_full_name', store=True, index=True)
|
||||||
|
name = fields.Char(required=True)
|
||||||
code = fields.Char()
|
code = fields.Char()
|
||||||
parent_id = fields.Many2one('golem.pcs', ondelete='cascade', index=True)
|
parent_id = fields.Many2one('golem.pcs', ondelete='cascade')
|
||||||
|
|
||||||
|
@api.depends('name', 'code')
|
||||||
|
def _compute_full_name(self):
|
||||||
|
""" Computes full name """
|
||||||
|
for pcs in self:
|
||||||
|
pcs.full_name = u'%s - %s' % (pcs.code, pcs.name) if pcs.code else pcs.name
|
||||||
|
@ -28,10 +28,11 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||||||
<field name="inherit_id" ref="golem_member.golem_member_form" />
|
<field name="inherit_id" ref="golem_member.golem_member_form" />
|
||||||
<field name="arch" type="xml">
|
<field name="arch" type="xml">
|
||||||
<field name='function' position='after'>
|
<field name='function' position='after'>
|
||||||
<field name='pcs_id' options="{'no_create':True}"/>
|
<field name='pcs_id' options="{'no_create':True}" />
|
||||||
</field>
|
</field>
|
||||||
</field>
|
</field>
|
||||||
</record>
|
</record>
|
||||||
|
|
||||||
<!-- Search -->
|
<!-- Search -->
|
||||||
<record model="ir.ui.view" id="golem_member_search_inherit_golem_pcs">
|
<record model="ir.ui.view" id="golem_member_search_inherit_golem_pcs">
|
||||||
<field name="name">GOLEM Member Search PCS adaptations</field>
|
<field name="name">GOLEM Member Search PCS adaptations</field>
|
||||||
@ -39,10 +40,10 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||||||
<field name="inherit_id" ref="golem_member.golem_member_search" />
|
<field name="inherit_id" ref="golem_member.golem_member_search" />
|
||||||
<field name="arch" type="xml">
|
<field name="arch" type="xml">
|
||||||
<field name='category_id' position='after'>
|
<field name='category_id' position='after'>
|
||||||
<field name='pcs_id'/>
|
<field name='pcs_id' />
|
||||||
</field>
|
</field>
|
||||||
<filter name="group_city" position='after'>
|
<filter name="group_city" position='after'>
|
||||||
<filter name="group_pcs" string="By PCS" context="{'group_by': 'pcs_id'}"/>
|
<filter name="group_pcs" string="By PCS" context="{'group_by': 'pcs_id'}" />
|
||||||
</filter>
|
</filter>
|
||||||
</field>
|
</field>
|
||||||
</record>
|
</record>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user