Commit cbb6a156 authored by Luca Cristaldi's avatar Luca Cristaldi

Change model names as dave sugegsted

parent 5dcbaa61
......@@ -19,10 +19,10 @@ def register():
ir.Cron,
member.Member,
member.PrintMembersBookStart,
membership.Membership,
membership.MembershipType,
membership.Period,
membership.Fee,
membership.Line,
membership.Membership,
membership.GenerateFeeStart,
module='association', type_='model')
Pool.register(
......
......@@ -73,7 +73,7 @@ class Member(Workflow, ModelSQL, ModelView):
'invisible': ~Eval('state').in_(['running', 'stopped'])
},
help="The date the member left the association.")
memberships = fields.One2Many('association.membership.line', 'member',
memberships = fields.One2Many('association.membership', 'member',
"Memberships",
depends=['state'],
states={'readonly': Eval('state') != 'draft'})
......
......@@ -42,14 +42,14 @@ _MOVE_STATE_SELECTION = [
]
class Membership(ModelSQL, ModelView):
"""Membership"""
__name__ = 'association.membership'
class MembershipType(ModelSQL, ModelView):
"""Membership Type"""
__name__ = 'association.membership.type'
name = fields.Char('Name', size=None, required=True)
periods = fields.One2Many('association.membership.period', 'membership',
'Periods',
help="A list of periods taht define the membership.")
help="The periods that form the basis of the membership type.")
journal = fields.Many2One('account.journal', 'Journal', required=True,
domain=[('type', '=', 'revenue')],
ondelete='RESTRICT',
......@@ -70,22 +70,22 @@ class Membership(ModelSQL, ModelView):
],
ondelete='RESTRICT',
states=_FEE_STATES,
help="The association that the membership belongs to.")
help="The association that the membership type belongs to.")
@classmethod
def default_company(cls):
return Transaction().context.get('company')
class Line(ModelSQL, ModelView):
"""Membership Line"""
__name__ = 'association.membership.line'
class Membership(ModelSQL, ModelView):
"""Membership"""
__name__ = 'association.membership'
member = fields.Many2One('association.member', "Member",
states=_LINE_STATES,
depends=['member_state'],
ondelete='CASCADE')
membership = fields.Many2One('association.membership', "Membership",
membership = fields.Many2One('association.membership.type', "Membership",
depends=['member_state'],
states=_LINE_STATES,
ondelete='RESTRICT')
......@@ -98,7 +98,8 @@ class Line(ModelSQL, ModelView):
(),
)],
depends=['end_date', 'member_state'],
states=_LINE_STATES)
states=_LINE_STATES,
help="The date when the membership starts.")
end_date = fields.Date('End Date',
domain=[
If(
......@@ -107,7 +108,8 @@ class Line(ModelSQL, ModelView):
(),
)],
depends=['start_date', 'member_state'],
states=_LINE_STATES)
states=_LINE_STATES,
help="The date when the membership ends.")
member_state = fields.Function(fields.Selection(_MEMBER_STATES,
"Member State"), 'on_change_with_member_state')
member_join_date = fields.Function(fields.Date("Member Join Date"),
......@@ -135,7 +137,7 @@ class Period(ModelSQL, ModelView):
"""Membership period"""
__name__ = 'association.membership.period'
membership = fields.Many2One('association.membership', 'Membership',
membership = fields.Many2One('association.membership.type', 'Membership',
required=True,
states=_STATES,
select=True,
......@@ -372,7 +374,7 @@ class Fee(ModelSQL, ModelView):
def generate_fees(cls, date=None):
pool = Pool()
Date = pool.get('ir.date')
MembershipLine = pool.get('association.membership.line')
MembershipLine = pool.get('association.membership')
Fee = pool.get('association.membership.fee')
Period = pool.get('association.membership.period')
......
......@@ -4,29 +4,29 @@ this repository contains the full copyright notices and license terms. -->
<tryton>
<data depends="">
<!-- Membership -->
<record model="ir.ui.view" id="view_membership_tree">
<field name="model">association.membership</field>
<record model="ir.ui.view" id="view_membership_type_tree">
<field name="model">association.membership.type</field>
<field name="type">tree</field>
<field name="name">membership_tree</field>
<field name="name">membership_type_tree</field>
</record>
<record model="ir.ui.view" id="view_membership_form">
<field name="model">association.membership</field>
<record model="ir.ui.view" id="view_membership_type_form">
<field name="model">association.membership.type</field>
<field name="type">form</field>
<field name="name">membership_form</field>
<field name="name">membership_type_form</field>
</record>
<record model="ir.action.act_window" id="act_membership_form">
<field name="name">Memberships</field>
<field name="res_model">association.membership</field>
<field name="name">Membership Types</field>
<field name="res_model">association.membership.type</field>
</record>
<record model="ir.action.act_window.view" id="act_membership_form1">
<field name="sequence">10</field>
<field name="view" ref="view_membership_tree" />
<field name="act_window" ref="view_membership_form" />
<field name="view" ref="view_membership_type_tree" />
<field name="act_window" ref="view_membership_type_form" />
</record>
<record model="ir.action.act_window.view" id="act_membership_form2">
<field name="sequence">20</field>
<field name="view" ref="view_membership_form" />
<field name="act_window" ref="view_membership_tree" />
<field name="view" ref="view_membership_type_form" />
<field name="act_window" ref="view_membership_type_tree" />
</record>
<record model="ir.ui.view" id="membership_period_view_tree_editable">
<field name="model">association.membership.period</field>
......@@ -35,14 +35,14 @@ this repository contains the full copyright notices and license terms. -->
<field name="name">membership_period_tree_editable</field>
</record>
<record model="ir.model.access" id="access_membership">
<field name="model" search="[('model', '=', 'association.membership')]" />
<field name="model" search="[('model', '=', 'association.membership.type')]" />
<field name="perm_read" eval="True" />
<field name="perm_write" eval="False" />
<field name="perm_create" eval="False" />
<field name="perm_delete" eval="False" />
</record>
<record model="ir.model.access" id="access_membership_member_approval">
<field name="model" search="[('model', '=', 'association.membership')]" />
<field name="model" search="[('model', '=', 'association.membership.type')]" />
<field name="group" ref="group_member_approval" />
<field name="perm_read" eval="True" />
<field name="perm_write" eval="True" />
......@@ -50,7 +50,7 @@ this repository contains the full copyright notices and license terms. -->
<field name="perm_delete" eval="True" />
</record>
<record model="ir.model.access" id="access_membership_admin">
<field name="model" search="[('model', '=', 'association.membership')]" />
<field name="model" search="[('model', '=', 'association.membership.type')]" />
<field name="group" ref="group_association_admin" />
<field name="perm_read" eval="True" />
<field name="perm_write" eval="True" />
......@@ -58,14 +58,14 @@ this repository contains the full copyright notices and license terms. -->
<field name="perm_delete" eval="True" />
</record>
<record model="ir.model.access" id="access_membership_group_association">
<field name="model" search="[('model', '=', 'association.membership')]" />
<field name="model" search="[('model', '=', 'association.membership.type')]" />
<field name="group" ref="group_association" />
<field name="perm_read" eval="True" />
<field name="perm_write" eval="True" />
<field name="perm_create" eval="True" />
<field name="perm_delete" eval="True" />
</record>
<menuitem name="Memberships" sequence="20" parent="menu_configuration" id="menu_membership" action="act_membership_form" icon="tryton-list" />
<menuitem name="Membership Types" sequence="20" parent="menu_configuration" id="menu_membership" action="act_membership_form" icon="tryton-list" />
<record model="ir.ui.menu-res.group" id="menu_membership_group_association_admin">
<field name="menu" ref="menu_membership" />
<field name="group" ref="group_association_admin" />
......@@ -161,20 +161,20 @@ this repository contains the full copyright notices and license terms. -->
</record>
<!-- membership line -->
<record model="ir.ui.view" id="membership_line_view_tree_editable">
<field name="model">association.membership.line</field>
<field name="model">association.membership</field>
<field name="type">tree</field>
<field name="priority" eval="30" />
<field name="name">membership_line_tree_editable</field>
</record>
<record model="ir.model.access" id="access_membership_line">
<field name="model" search="[('model', '=', 'association.membership.line')]" />
<field name="model" search="[('model', '=', 'association.membership')]" />
<field name="perm_read" eval="True" />
<field name="perm_write" eval="False" />
<field name="perm_create" eval="False" />
<field name="perm_delete" eval="False" />
</record>
<record model="ir.model.access" id="access_membership_line_admin">
<field name="model" search="[('model', '=', 'association.membership.line')]" />
<field name="model" search="[('model', '=', 'association.membership')]" />
<field name="group" ref="group_association_admin" />
<field name="perm_read" eval="True" />
<field name="perm_write" eval="True" />
......@@ -182,7 +182,7 @@ this repository contains the full copyright notices and license terms. -->
<field name="perm_delete" eval="True" />
</record>
<record model="ir.model.access" id="access_membership_line_group_association">
<field name="model" search="[('model', '=', 'association.membership.line')]" />
<field name="model" search="[('model', '=', 'association.membership')]" />
<field name="group" ref="group_association" />
<field name="perm_read" eval="True" />
<field name="perm_write" eval="True" />
......
......@@ -68,7 +68,7 @@ Get a revenue journal::
Create honorary membership::
>>> Membership = Model.get('association.membership')
>>> Membership = Model.get('association.membership.type')
>>> Period = Model.get('association.membership.period')
>>> honorary = Membership()
>>> honorary.party = party
......
......@@ -59,7 +59,7 @@ Create memberships::
>>> journal_revenue, = Journal.find([
... ('code', '=', 'REV'),
... ])
>>> Membership = Model.get('association.membership')
>>> Membership = Model.get('association.membership.type')
>>> membership = Membership()
>>> membership.party = party
>>> membership.name = "testo"
......
......@@ -66,7 +66,7 @@ Get a revenue journal::
Create membership::
>>> Membership = Model.get('association.membership')
>>> Membership = Model.get('association.membership.type')
>>> Period = Model.get('association.membership.period')
>>> membership = Membership()
>>> membership.party = party
......
......@@ -71,7 +71,7 @@ Create membership::
>>> start_date = datetime.date(2018,1,1)
>>> fiscalMonth = 13
>>> timedelta = datetime.timedelta(weeks=4)
>>> Membership = Model.get('association.membership')
>>> Membership = Model.get('association.membership.type')
>>> Period = Model.get('association.membership.period')
>>> membership1 = Membership()
>>> membership1.party = party
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment