RemiFr82
7 months ago
13 changed files with 816 additions and 109 deletions
-
11ffck_commons/__manifest__.py
-
142ffck_commons/data/ffck_membership_type.xml
-
7ffck_commons/data/ffck_structure_type.xml
-
257ffck_commons/i18n/fr.po
-
1ffck_commons/models/__init__.py
-
84ffck_commons/models/ffck_membership_type.py
-
62ffck_commons/models/ffck_structure_type.py
-
98ffck_commons/models/res_partner.py
-
15ffck_commons/models/res_partner_age_range.py
-
4ffck_commons/security/ir.model.access.csv
-
106ffck_commons/views/ffck_membership_type.xml
-
46ffck_commons/views/ffck_structure_type.xml
-
86ffck_commons/views/res_partner.xml
@ -0,0 +1,142 @@ |
|||
<?xml version="1.0" encoding="utf-8"?> |
|||
<odoo> |
|||
<data noupdate="1"> |
|||
|
|||
<record id="ffck_membership_type_ca1a" model="ffck.membership.type" forcecreate="0"> |
|||
<field name="name">1 year competition adult</field> |
|||
<field name="short">CA1A</field> |
|||
<field name="duration">1</field> |
|||
<field name="unit">year</field> |
|||
<field name="age_range">adult</field> |
|||
<field name="practice" eval="True" /> |
|||
<field name="competition" eval="True" /> |
|||
<field name="current_price">64</field> |
|||
<field name="structure_type_ids" |
|||
eval="[(6, 0, [ref('ffck_commons.ffck_structure_type_club'),ref('ffck_commons.ffck_structure_type_agra'),ref('ffck_commons.ffck_structure_type_agrb')])]" /> |
|||
</record> |
|||
|
|||
<record id="ffck_membership_type_cj1a" model="ffck.membership.type" forcecreate="0"> |
|||
<field name="name">1 year competition young</field> |
|||
<field name="short">CJ1A</field> |
|||
<field name="duration">1</field> |
|||
<field name="unit">year</field> |
|||
<field name="age_range">young</field> |
|||
<field name="practice" eval="True" /> |
|||
<field name="competition" eval="True" /> |
|||
<field name="current_price">42</field> |
|||
<field name="structure_type_ids" |
|||
eval="[(6, 0, [ref('ffck_commons.ffck_structure_type_club'),ref('ffck_commons.ffck_structure_type_agra'),ref('ffck_commons.ffck_structure_type_agrb')])]" /> |
|||
</record> |
|||
|
|||
<record id="ffck_membership_type_la1a" model="ffck.membership.type" forcecreate="0"> |
|||
<field name="name">1 year leisure adult</field> |
|||
<field name="short">LA1A</field> |
|||
<field name="duration">1</field> |
|||
<field name="unit">year</field> |
|||
<field name="age_range">adult</field> |
|||
<field name="practice" eval="True" /> |
|||
<field name="competition" eval="False" /> |
|||
<field name="current_price">56</field> |
|||
<field name="structure_type_ids" |
|||
eval="[(6, 0, [ref('ffck_commons.ffck_structure_type_club'),ref('ffck_commons.ffck_structure_type_agra'),ref('ffck_commons.ffck_structure_type_agrb')])]" /> |
|||
</record> |
|||
|
|||
<record id="ffck_membership_type_lj1a" model="ffck.membership.type" forcecreate="0"> |
|||
<field name="name">1 year leisure young</field> |
|||
<field name="short">LJ1A</field> |
|||
<field name="duration">1</field> |
|||
<field name="unit">year</field> |
|||
<field name="age_range">young</field> |
|||
<field name="practice" eval="True" /> |
|||
<field name="competition" eval="False" /> |
|||
<field name="current_price">22</field> |
|||
<field name="structure_type_ids" |
|||
eval="[(6, 0, [ref('ffck_commons.ffck_structure_type_club'),ref('ffck_commons.ffck_structure_type_agra'),ref('ffck_commons.ffck_structure_type_agrb')])]" /> |
|||
</record> |
|||
|
|||
<record id="ffck_membership_type_a3m" model="ffck.membership.type" forcecreate="0"> |
|||
<field name="name">3 months adult</field> |
|||
<field name="short">A3M</field> |
|||
<field name="duration">3</field> |
|||
<field name="unit">month</field> |
|||
<field name="age_range">adult</field> |
|||
<field name="practice" eval="True" /> |
|||
<field name="competition" eval="False" /> |
|||
<field name="current_price">20</field> |
|||
<field name="structure_type_ids" |
|||
eval="[(6, 0, [ref('ffck_commons.ffck_structure_type_club'),ref('ffck_commons.ffck_structure_type_agra'),ref('ffck_commons.ffck_structure_type_agrb')])]" /> |
|||
</record> |
|||
|
|||
<record id="ffck_membership_type_j3m" model="ffck.membership.type" forcecreate="0"> |
|||
<field name="name">3 months young</field> |
|||
<field name="short">J3M</field> |
|||
<field name="duration">3</field> |
|||
<field name="unit">month</field> |
|||
<field name="age_range">young</field> |
|||
<field name="practice" eval="True" /> |
|||
<field name="competition" eval="False" /> |
|||
<field name="current_price">10</field> |
|||
<field name="structure_type_ids" |
|||
eval="[(6, 0, [ref('ffck_commons.ffck_structure_type_club'),ref('ffck_commons.ffck_structure_type_agra'),ref('ffck_commons.ffck_structure_type_agrb')])]" /> |
|||
</record> |
|||
|
|||
<record id="ffck_membership_type_sp1a" model="ffck.membership.type" forcecreate="0"> |
|||
<field name="name">1 year without practice</field> |
|||
<field name="short">SP1A</field> |
|||
<field name="duration">1</field> |
|||
<field name="unit">year</field> |
|||
<field name="practice" eval="False" /> |
|||
<field name="competition" eval="False" /> |
|||
<field name="current_price">2</field> |
|||
<field name="structure_type_ids" |
|||
eval="[(6, 0, [ref('ffck_commons.ffck_structure_type_club'),ref('ffck_commons.ffck_structure_type_agra'),ref('ffck_commons.ffck_structure_type_agrb')])]" /> |
|||
</record> |
|||
|
|||
<record id="ffck_membership_type_c1d" model="ffck.membership.type" forcecreate="0"> |
|||
<field name="name">1 day competition Open</field> |
|||
<field name="short">C1D</field> |
|||
<field name="duration">1</field> |
|||
<field name="unit">day</field> |
|||
<field name="practice" eval="True" /> |
|||
<field name="competition" eval="True" /> |
|||
<field name="current_price">5</field> |
|||
<field name="structure_type_ids" |
|||
eval="[(6, 0, [ref('ffck_commons.ffck_structure_type_ffck'),ref('ffck_commons.ffck_structure_type_crck'),ref('ffck_commons.ffck_structure_type_cdck'),ref('ffck_commons.ffck_structure_type_club'),ref('ffck_commons.ffck_structure_type_agra'),ref('ffck_commons.ffck_structure_type_agrb')])]" /> |
|||
</record> |
|||
|
|||
<record id="ffck_membership_type_l1d" model="ffck.membership.type" forcecreate="0"> |
|||
<field name="name">1 day leisure</field> |
|||
<field name="short">L1D</field> |
|||
<field name="duration">1</field> |
|||
<field name="unit">day</field> |
|||
<field name="practice" eval="True" /> |
|||
<field name="competition" eval="False" /> |
|||
<field name="current_price">1</field> |
|||
<field name="structure_type_ids" |
|||
eval="[(6, 0, [ref('ffck_commons.ffck_structure_type_ffck'),ref('ffck_commons.ffck_structure_type_crck'),ref('ffck_commons.ffck_structure_type_cdck'),ref('ffck_commons.ffck_structure_type_club'),ref('ffck_commons.ffck_structure_type_agra'),ref('ffck_commons.ffck_structure_type_agrb')])]" /> |
|||
</record> |
|||
|
|||
<record id="ffck_membership_type_i1a" model="ffck.membership.type" forcecreate="0"> |
|||
<field name="name">1 year individual</field> |
|||
<field name="short">I1A</field> |
|||
<field name="duration">1</field> |
|||
<field name="unit">year</field> |
|||
<field name="practice" eval="True" /> |
|||
<field name="competition" eval="False" /> |
|||
<field name="current_price">80</field> |
|||
<field name="structure_type_ids" eval="[(6, 0, [ref('ffck_commons.ffck_structure_type_ffck')])]" /> |
|||
</record> |
|||
|
|||
<record id="ffck_membership_type_sp1a" model="ffck.membership.type" forcecreate="0"> |
|||
<field name="name">1 year special NC and WF</field> |
|||
<field name="short">SP1A</field> |
|||
<field name="duration">1</field> |
|||
<field name="unit">year</field> |
|||
<field name="practice" eval="True" /> |
|||
<field name="competition" eval="False" /> |
|||
<field name="current_price">5</field> |
|||
<field name="structure_type_ids" eval="[(6, 0, [ref('ffck_commons.ffck_structure_type_ffck')])]" /> |
|||
</record> |
|||
|
|||
</data> |
|||
</odoo> |
@ -0,0 +1,84 @@ |
|||
# -*- coding: utf-8 -*- |
|||
from odoo import models, fields |
|||
|
|||
RANGES = [ |
|||
("young", "Young"), |
|||
("adult", "Adult"), |
|||
] |
|||
|
|||
UNITS = [ |
|||
("day", "Day"), |
|||
("month", "Month"), |
|||
("year", "Year"), |
|||
] |
|||
|
|||
|
|||
class FfckMembershipType(models.Model): |
|||
_name = "ffck.membership.type" |
|||
_description = "FFCK structure type" |
|||
_order = ( |
|||
"unit desc, duration desc, age_range, competition desc, practice desc, name, id" |
|||
) |
|||
|
|||
active = fields.Boolean( |
|||
string="Active", |
|||
default=True, |
|||
) |
|||
company_id = fields.Many2one( |
|||
comodel_name="res.company", |
|||
string="Company", |
|||
required=True, |
|||
default=lambda self: self.env.company, |
|||
) |
|||
currency_id = fields.Many2one( |
|||
comodel_name="res.currency", |
|||
related="company_id.currency_id", |
|||
string="Currency", |
|||
readonly=True, |
|||
) |
|||
name = fields.Char( |
|||
string="Name", |
|||
required=True, |
|||
translate=True, |
|||
) |
|||
short = fields.Char( |
|||
string="Short", |
|||
required=True, |
|||
index=True, |
|||
) |
|||
duration = fields.Integer( |
|||
string="Duration", |
|||
required=True, |
|||
default=1, |
|||
) |
|||
unit = fields.Selection( |
|||
selection=UNITS, |
|||
string="Time unit", |
|||
required=True, |
|||
default="year", |
|||
) |
|||
age_range = fields.Selection( |
|||
selection=RANGES, |
|||
string="Age specific", |
|||
) |
|||
practice = fields.Boolean( |
|||
string="Practice", |
|||
default=True, |
|||
) |
|||
competition = fields.Boolean( |
|||
string="Competition", |
|||
default=False, |
|||
) |
|||
current_price = fields.Float( |
|||
string="Current price", |
|||
default=1.0, |
|||
digits="Product Price", |
|||
help="Price at which the license is currently sold.", |
|||
) |
|||
structure_type_ids = fields.Many2many( |
|||
comodel_name="ffck.structure.type", |
|||
column1="membership_id", |
|||
column2="structure_type_id", |
|||
relation="membership_structure_type_rel", |
|||
string="Structure types", |
|||
) |
@ -1,4 +1,6 @@ |
|||
id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink |
|||
access_ffck_membership_type_all,All ffck.membership.type,ffck_commons.model_ffck_membership_type,,1,0,0,0 |
|||
access_ffck_membership_type_group_partner_manager,Partner manager ffck.membership.type,ffck_commons.model_ffck_membership_type,base.group_system,1,1,1,0 |
|||
access_ffck_structure_type_all,All ffck.structure.type,ffck_commons.model_ffck_structure_type,,1,0,0,0 |
|||
access_ffck_structure_type_group_partner_manager,Partner manager ffck.structure.type,ffck_commons.model_ffck_structure_type,base.group_partner_manager,1,1,1,0 |
|||
access_ffck_structure_type_group_partner_manager,Partner manager ffck.structure.type,ffck_commons.model_ffck_structure_type,base.group_system,1,1,1,0 |
|||
access_res_partner_hierarchy_all,All res.partner.hierarchy,ffck_commons.model_res_partner_hierarchy,,1,0,0,0 |
@ -0,0 +1,106 @@ |
|||
<?xml version="1.0" encoding="utf-8"?> |
|||
<odoo> |
|||
|
|||
<record id="ffck_membership_type_view_form" model="ir.ui.view"> |
|||
<field name="name">ffck.membership.type.view.form</field> |
|||
<field name="model">ffck.membership.type</field> |
|||
<field name="arch" type="xml"> |
|||
<form> |
|||
<sheet> |
|||
<field name="active" invisible="1" /> |
|||
<field name="company_id" invisible="1" /> |
|||
<field name="currency_id" invisible="1" /> |
|||
<div class="oe_title"> |
|||
<h1> |
|||
<field name="name" /> |
|||
</h1> |
|||
</div> |
|||
<group col="6" colspan="6"> |
|||
<group colspan="2"> |
|||
<field name="short" /> |
|||
<field name="age_range" /> |
|||
</group> |
|||
<group colspan="2"> |
|||
<label for="duration" /> |
|||
<div class="o_row"> |
|||
<field name="duration" /> |
|||
<field name="unit" class="oe_inline" /> |
|||
</div> |
|||
<field name="practice" /> |
|||
</group> |
|||
<group colspan="2"> |
|||
<field name="current_price" widget="monetary" /> |
|||
<field name="competition" /> |
|||
</group> |
|||
<group colspan="6"> |
|||
<field name="structure_type_ids" widget="many2many_tags" options="{'no_create':1}" /> |
|||
</group> |
|||
</group> |
|||
</sheet> |
|||
</form> |
|||
</field> |
|||
</record> |
|||
|
|||
<record id="ffck_membership_type_view_tree" model="ir.ui.view"> |
|||
<field name="name">ffck.membership.type.view.tree</field> |
|||
<field name="model">ffck.membership.type</field> |
|||
<field name="arch" type="xml"> |
|||
<tree> |
|||
<field name="name" /> |
|||
<field name="short" /> |
|||
<field name="duration" /> |
|||
<field name="unit" /> |
|||
<field name="age_range" /> |
|||
<field name="practice" /> |
|||
<field name="competition" /> |
|||
<field name="current_price" widget="monetary" /> |
|||
<field name="structure_type_ids" options="{'no_create':1}" /> |
|||
</tree> |
|||
</field> |
|||
</record> |
|||
|
|||
<record id="ffck_membership_type_view_search" model="ir.ui.view"> |
|||
<field name="name">ffck.membership.type.view.search</field> |
|||
<field name="model">ffck.membership.type</field> |
|||
<field name="arch" type="xml"> |
|||
<search> |
|||
<field name="name" |
|||
filter_domain="['|', ('name', 'ilike', self), ('short', 'ilike', self)]" /> |
|||
<filter name="unit_year" string="Annual" domain="[('unit','=','year')]" /> |
|||
<filter name="unit_month" string="Monthly" domain="[('unit','=','month')]" /> |
|||
<filter name="unit_day" string="Daily" domain="[('unit','=','day')]" /> |
|||
<separator /> |
|||
<filter name="adult" string="Adult" domain="[('age_range','=','adult')]" /> |
|||
<filter name="young" string="Young" domain="[('age_range','=','young')]" /> |
|||
<separator /> |
|||
<filter name="competition" string="Competition" domain="[('competition','=',True)]" /> |
|||
<filter name="no_competition" string="Leisure" domain="[('competition','=',False)]" /> |
|||
<filter name="no_practice" string="No practice" domain="[('practice','=',False)]" /> |
|||
<group expand="0" name="group_by"> |
|||
<filter name="by_unit" string="Time unit" context="{'group_by':'unit'}" /> |
|||
<filter name="by_age_range" string="Age range" context="{'group_by':'age_range'}" /> |
|||
<separator groups="base.group_multi_company" /> |
|||
<filter name="by_company" string="Company" context="{'group_by':'company_id'}" |
|||
groups="base.group_multi_company" /> |
|||
</group> |
|||
</search> |
|||
</field> |
|||
</record> |
|||
|
|||
<record id="ffck_membership_type_action" model="ir.actions.act_window"> |
|||
<field name="name">FFCK license types</field> |
|||
<field name="res_model">ffck.membership.type</field> |
|||
<field name="view_mode">tree,form</field> |
|||
<field name="domain">[]</field> |
|||
<field name="context">{}</field> |
|||
</record> |
|||
|
|||
<menuitem |
|||
id="ffck_membership_type_menu" |
|||
name="License types" |
|||
action="ffck_membership_type_action" |
|||
groups="base.group_system" |
|||
parent="ffck_contacts_config_menu" |
|||
sequence="5" /> |
|||
|
|||
</odoo> |
Write
Preview
Loading…
Cancel
Save
Reference in new issue