forked from Yaltik/golem
[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 -->
|
||||
<record model="golem.pcs" id="golem_pcs_agriculteurs_exploitants">
|
||||
<field name="name">Agriculteurs exploitants</field>
|
||||
<field name="code">1</field>
|
||||
<field name="code">01</field>
|
||||
</record>
|
||||
<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="code">2</field>
|
||||
<field name="code">02</field>
|
||||
</record>
|
||||
<record model="golem.pcs" id="golem_pcs_cadres_et_professions_intellectuelles_superieures">
|
||||
<field name="name">Cadres et professions intellectuelles supérieures</field>
|
||||
<field name="code">3</field>
|
||||
<field name="code">03</field>
|
||||
</record>
|
||||
<record model="golem.pcs" id="golem_pcs_professions_intermediaires">
|
||||
<field name="name">Professions intermédiaires</field>
|
||||
<field name="code">4</field>
|
||||
<field name="code">04</field>
|
||||
</record>
|
||||
<record model="golem.pcs" id="golem_pcs_employes">
|
||||
<field name="name">Employés</field>
|
||||
<field name="code">5</field>
|
||||
<field name="code">05</field>
|
||||
</record>
|
||||
<record model="golem.pcs" id="golem_pcs_ouvriers">
|
||||
<field name="name">Ouvriers</field>
|
||||
<field name="code">6</field>
|
||||
<field name="code">06</field>
|
||||
</record>
|
||||
<record model="golem.pcs" id="golem_pcs_retraites">
|
||||
<field name="name">Retraités</field>
|
||||
<field name="code">7</field>
|
||||
</record>
|
||||
<record model="golem.pcs" id="golem_pcs_retraites">
|
||||
<field name="name">Retraités</field>
|
||||
<field name="code">7</field>
|
||||
<field name="code">07</field>
|
||||
</record>
|
||||
<record model="golem.pcs" id="golem_pcs_autres_personnes_sans_activite_professionnelle">
|
||||
<field name="name">Autres personnes sans activité professionnelle</field>
|
||||
<field name="code">8</field>
|
||||
<field name="code">08</field>
|
||||
</record>
|
||||
|
||||
<!-- Catégories socioprofessionnelles -->
|
||||
|
@ -18,11 +18,11 @@
|
||||
|
||||
""" GOLEM Member adaptations """
|
||||
|
||||
from odoo import models, fields, api, _
|
||||
from odoo import models, fields
|
||||
|
||||
class GolemMember(models.Model):
|
||||
""" GOLEM Member extention """
|
||||
_inherit = 'golem.member'
|
||||
|
||||
pcs_id = fields.Many2one('golem.pcs', string='Professions and Socioprofessional Categories',
|
||||
domain="[('parent_id', '!=', False)]")
|
||||
pcs_id = fields.Many2one('golem.pcs', string='PCS', index=True,
|
||||
help='Professions and Socioprofessional Categories')
|
||||
|
@ -18,12 +18,21 @@
|
||||
|
||||
""" GOLEM PCS """
|
||||
|
||||
from odoo import models, fields, api, _
|
||||
from odoo import models, fields, api
|
||||
|
||||
class GolemPCS(models.Model):
|
||||
""" 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()
|
||||
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
|
||||
|
@ -32,6 +32,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
</field>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<!-- Search -->
|
||||
<record model="ir.ui.view" id="golem_member_search_inherit_golem_pcs">
|
||||
<field name="name">GOLEM Member Search PCS adaptations</field>
|
||||
|
Loading…
x
Reference in New Issue
Block a user