[REF]GOLEM Member now depends on membership, not inverse + fixes / consequences

This commit is contained in:
Fabien BOURGEOIS 2018-07-20 11:19:08 +02:00
parent c18b0a20a7
commit ad003e27f5
17 changed files with 153 additions and 199 deletions

View File

@ -19,7 +19,7 @@
'name': 'GOLEM activities', 'name': 'GOLEM activities',
'summary': 'Extends Odoo products for multi-activity', 'summary': 'Extends Odoo products for multi-activity',
'description': 'Extends Odoo products for multi-activity', 'description': 'Extends Odoo products for multi-activity',
'version': '10.0.2.4.0', 'version': '10.0.2.4.1',
'category': 'GOLEM', 'category': 'GOLEM',
'author': 'Fabien Bourgeois, Michel Dessenne', 'author': 'Fabien Bourgeois, Michel Dessenne',
'license': 'AGPL-3', 'license': 'AGPL-3',

View File

@ -33,7 +33,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
<template id="golem_activity_report_template"> <template id="golem_activity_report_template">
<t t-call="report.html_container"> <t t-call="report.html_container">
<t t-set="season" t-value="docs._default_season()" /> <t t-set="season" t-value="docs.default_season()" />
<t t-foreach="docs" t-as="activity" id="foreach_activity"> <t t-foreach="docs" t-as="activity" id="foreach_activity">
<t t-call="report.external_layout"> <t t-call="report.external_layout">
<div id='page_report_activity' class="page"> <div id='page_report_activity' class="page">

View File

@ -18,7 +18,7 @@
{ {
'name': 'GOLEM Activity Member Registrations', 'name': 'GOLEM Activity Member Registrations',
'summary': 'GOLEM Activities Member Registrations management', 'summary': 'GOLEM Activities Member Registrations management',
'version': '10.0.1.3.0', 'version': '10.0.1.3.1',
'category': 'GOLEM', 'category': 'GOLEM',
'author': 'Fabien Bourgeois, Michel Dessenne', 'author': 'Fabien Bourgeois, Michel Dessenne',
'license': 'AGPL-3', 'license': 'AGPL-3',

View File

@ -22,7 +22,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
<template id="golem_member_card_template_inherit_golem_activity_resgitration" <template id="golem_member_card_template_inherit_golem_activity_resgitration"
inherit_id="golem_member.golem_member_card_template"> inherit_id="golem_member.golem_member_card_template">
<xpath expr="//div[@id='page_report_member']/div[1]" postion="after"> <xpath expr="//div[@id='page_report_member']/t[1]" postion="after">
<h3>Activities</h3> <h3>Activities</h3>
<table id="table_activity_ref" class="table table-striped"> <table id="table_activity_ref" class="table table-striped">
<thead> <thead>

View File

@ -25,7 +25,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
<field name="model">golem.member</field> <field name="model">golem.member</field>
<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">
<page name="other_page" position="before"> <page name="membership" position="before">
<page name="activities" string="Activities"> <page name="activities" string="Activities">
<field name="id" invisible="1" /> <field name="id" invisible="1" />
<group> <group>

View File

@ -19,7 +19,7 @@
'name': 'GOLEM families', 'name': 'GOLEM families',
'summary': 'GOLEM Members Families', 'summary': 'GOLEM Members Families',
'description': 'GOLEM Members Families', 'description': 'GOLEM Members Families',
'version': '10.0.2.2.1', 'version': '10.0.2.2.2',
'category': 'GOLEM', 'category': 'GOLEM',
'author': 'Fabien Bourgeois', 'author': 'Fabien Bourgeois',
'license': 'AGPL-3', 'license': 'AGPL-3',

View File

@ -38,7 +38,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
<field name="family_role" <field name="family_role"
attrs="{'readonly': [('id', '=', False)]}" /> attrs="{'readonly': [('id', '=', False)]}" />
</field> </field>
<page name="other_page" position="before"> <page name="membership" position="before">
<page string="Family" <page string="Family"
attrs="{'invisible': [('family_id', '=', False)]}"> attrs="{'invisible': [('family_id', '=', False)]}">
<group> <group>

View File

@ -20,14 +20,14 @@
'name': 'GOLEM non-profit members', 'name': 'GOLEM non-profit members',
'summary': 'Extends Odoo contacts for MJC', 'summary': 'Extends Odoo contacts for MJC',
'description': 'Extends Odoo contacts for MJC', 'description': 'Extends Odoo contacts for MJC',
'version': '10.0.1.3.0', 'version': '10.0.2.0.0',
'category': 'GOLEM', 'category': 'GOLEM',
'author': 'Fabien Bourgeois, Michel Dessenne', 'author': 'Fabien Bourgeois, Michel Dessenne',
'license': 'AGPL-3', 'license': 'AGPL-3',
'application': True, 'application': True,
'installable': True, 'installable': True,
'depends': ['golem_base', 'golem_activity', 'golem_season', 'depends': ['golem_base', 'golem_membership', 'golem_activity',
'odoo_partner_merge'], 'golem_season', 'odoo_partner_merge'],
'data': ['views/golem_member_views.xml', 'data': ['views/golem_member_views.xml',
'views/res_partner_views.xml', 'views/res_partner_views.xml',
'views/golem_member_numberconfig_views.xml', 'views/golem_member_numberconfig_views.xml',

View File

@ -130,7 +130,7 @@ class GolemMember(models.Model):
@api.depends('season_ids') @api.depends('season_ids')
def _compute_is_default(self): def _compute_is_default(self):
""" Computes is current according to seasons """ """ Computes is current according to seasons """
default_s = self._default_season() default_s = self.default_season()
for member in self: for member in self:
member.is_default = default_s in member.season_ids member.is_default = default_s in member.season_ids

View File

@ -33,7 +33,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
<template id="golem_member_card_template"> <template id="golem_member_card_template">
<t t-call="report.html_container"> <t t-call="report.html_container">
<t t-set="season" t-value="docs._default_season()" /> <t t-set="season" t-value="docs.default_season()" />
<t t-foreach="docs" t-as="member" id="foreach_member"> <t t-foreach="docs" t-as="member" id="foreach_member">
<t t-call="report.external_layout"> <t t-call="report.external_layout">
<div id='page_report_member' class="page"> <div id='page_report_member' class="page">
@ -57,6 +57,45 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
</h3> </h3>
</div> </div>
</div> </div>
<t t-if="member.membership_state != 'none'">
<div class="row" id="page_report_membership">
<div class="col-xs-12">
<h3>Memberships</h3>
</div>
</div>
<table class="table table-striped">
<thead>
<tr>
<th>Registration</th>
<th>Registration date</th>
<th>Date from</th>
<th>Date to</th>
<th>State</th>
</tr>
</thead>
<tbody>
<t t-foreach="member.member_lines" t-as="mline">
<tr>
<td class="col-xs-3">
<spam t-field="mline.membership_id" />
</td>
<td class="col-xs-2">
<spam t-field="mline.date_from" />
</td>
<td class="col-xs-2">
<spam t-field="mline.date_to" />
</td>
<td class="col-xs-2">
<spam t-field="mline.date" />
</td>
<td class="col-xs-3">
<spam t-field="mline.state" />
</td>
</tr>
</t>
</tbody>
</table>
</t>
</div> </div>
</t> </t>
</t> </t>

View File

@ -49,7 +49,7 @@ class GolemMemberTestCase(TransactionCase):
def test_default_season(self): def test_default_season(self):
""" Test if default season if fixed according to setUp and if users """ Test if default season if fixed according to setUp and if users
are correctly seen """ are correctly seen """
self.assertEqual(self.member_model._default_season(), self.assertEqual(self.member_model.default_season(),
self.season_current) self.season_current)
self.assertTrue(self.member1.is_default) self.assertTrue(self.member1.is_default)
self.assertTrue(self.member2.is_default) self.assertTrue(self.member2.is_default)

View File

@ -19,6 +19,24 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
<odoo> <odoo>
<data> <data>
<!-- Actions -->
<act_window id="golem_member_action"
name="GOLEM Members"
res_model="golem.member"
view_mode="kanban,tree,form,graph" />
<act_window id="res_partner_category_action" name="GOLEM Members Tags"
res_model="res.partner.category" view_mode="tree,form" />
<record id="golem_membership_invoice_action" model="ir.actions.act_window">
<field name="name">Join Membership</field>
<field name="res_model">golem.membership.invoice</field>
<field name="src_model">golem.member</field>
<field name="view_type">form</field>
<field name="view_mode">tree,form</field>
<field name="view_id" ref="golem_membership.golem_membership_invoice_form"/>
<field name="target">new</field>
</record>
<!-- Forms --> <!-- Forms -->
<record id="golem_member_form" model="ir.ui.view"> <record id="golem_member_form" model="ir.ui.view">
<field name="name">GOLEM Member Form</field> <field name="name">GOLEM Member Form</field>
@ -98,6 +116,50 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
</group> </group>
</group> </group>
</page> </page>
<page name="membership" string="Membership">
<group>
<group>
<field name="free_member"/>
<label for="membership_state"/>
<div>
<field name="partner_id" invisible="True" required="False" />
<field name="membership_state"/>
<button name="%(golem_membership_invoice_action)d"
type="action" string="Buy Membership"
attrs="{'invisible':[('free_member','=',True)]}"
context="{'default_partner_id': partner_id}"
class="oe_link"/>
</div>
</group>
<group>
<field name="membership_start"
attrs="{'invisible':[('membership_start','=',False)]}"/>
<field name="membership_stop"
attrs="{'invisible':[('membership_stop','=',False)]}"/>
<field name="membership_cancel"
attrs="{'invisible':[('membership_cancel','=',False)]}"/>
</group>
</group>
<field name="member_lines" nolabel="1" colspan="4" readonly="1">
<tree string="Memberships">
<field name="date"/>
<field name="membership_id"/>
<field name="member_price"/>
<field name="account_invoice_id"/>
<field name="state"/>
</tree>
<form string="Memberships">
<group>
<field name="date"/>
<field name="member_price"/>
<field name="membership_id"/>
<field name="account_invoice_id"
context="{'form_view_ref': 'account.invoice_form'}"/>
<field name="state" colspan="4"/>
</group>
</form>
</field>
</page>
<page name="other_page" string="Others"> <page name="other_page" string="Others">
<group> <group>
<field name="comment" placeholder="Put an internal note..." /> <field name="comment" placeholder="Put an internal note..." />
@ -219,6 +281,11 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
<field name="category_id" widget="many2one" /> <field name="category_id" widget="many2one" />
<filter name="season_default" string="Default season" <filter name="season_default" string="Default season"
domain="[('is_default', '=', True)]" /> domain="[('is_default', '=', True)]" />
<separator />
<filter name="has_contributed" string="Has contributed"
domain="[('membership_state','in',['invoiced', 'paid'])]" />
<filter name="is_free_member" string="Is Free Member"
domain="[('free_member', '=', True)]" />
<group string="Group By"> <group string="Group By">
<filter name="group_age" string="By age" <filter name="group_age" string="By age"
context="{'group_by': 'is_minor'}"/> context="{'group_by': 'is_minor'}"/>
@ -242,14 +309,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
</field> </field>
</record> </record>
<!-- Actions -->
<act_window id="golem_member_action"
name="GOLEM Members"
res_model="golem.member"
view_mode="kanban,tree,form,graph" />
<act_window id="res_partner_category_action" name="GOLEM Members Tags"
res_model="res.partner.category" view_mode="tree,form" />
<!-- Menu items --> <!-- Menu items -->
<!-- Deactivate classic membership list --> <!-- Deactivate classic membership list -->
<record id="membership.menu_membership" model="ir.ui.menu"> <record id="membership.menu_membership" model="ir.ui.menu">

View File

@ -18,15 +18,13 @@
{ {
'name': 'GOLEM non-profit membership handling', 'name': 'GOLEM non-profit membership handling',
'summary': 'Extends Odoo membership', 'summary': 'Extends Odoo membership',
'version': '10.0.1.1.4', 'version': '10.0.2.0.0',
'category': 'GOLEM', 'category': 'GOLEM',
'author': 'Fabien Bourgeois, Michel Dessenne', 'author': 'Fabien Bourgeois, Michel Dessenne',
'license': 'AGPL-3', 'license': 'AGPL-3',
'application': False, 'application': False,
'installable': True, 'installable': True,
'depends': ['golem_member', 'account', 'decimal_precision'], 'depends': ['account', 'decimal_precision'],
'data': ['data/account_data.xml', 'data': ['data/account_data.xml',
'views/golem_membership_invoice.xml', 'views/golem_membership_invoice.xml']
'views/golem_member_view.xml',
'report/golem_member_card_templates.xml']
} }

View File

@ -0,0 +1,30 @@
# -*- coding: utf-8 -*-
# Copyright 2018 Fabien Bourgeois <fabien@yaltik.com>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
""" Migration script """
from openupgradelib import openupgrade
@openupgrade.migrate(use_env=False)
def migrate(cursor, version):
""" Clean up olders views references """
cursor.execute('''
DELETE FROM ir_ui_view WHERE key IN
('golem_membership.golem_member_card_template_inherit_golem_membership',
'golem_membership.golem_member_form_inherit_golem_membership',
'golem_membership.golem_member_search_inherit_golem_membership')
''')

View File

@ -1,68 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright 2018 Fabien Bourgeois <fabien@yaltik.com>
Copyright 2018 Michel Dessenne <michel@yaltik.com>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
-->
<odoo>
<template id="golem_member_card_template_inherit_golem_membership"
inherit_id="golem_member.golem_member_card_template">
<xpath expr="//table[@id='table_activity_ref']" position="after">
<t t-if="member.membership_state != 'none'">
<div class="row" id="page_report_membership">
<div class="col-xs-12">
<h3>Memberships</h3>
</div>
</div>
<table class="table table-striped">
<thead>
<tr>
<th>Registration</th>
<th>Registration date</th>
<th>Date from</th>
<th>Date to</th>
<th>State</th>
</tr>
</thead>
<tbody>
<t t-foreach="member.member_lines" t-as="mline">
<tr>
<td class="col-xs-3">
<spam t-field="mline.membership_id" />
</td>
<td class="col-xs-2">
<spam t-field="mline.date_from" />
</td>
<td class="col-xs-2">
<spam t-field="mline.date_to" />
</td>
<td class="col-xs-2">
<spam t-field="mline.date" />
</td>
<td class="col-xs-3">
<spam t-field="mline.state" />
</td>
</tr>
</t>
</tbody>
</table>
</t>
</xpath>
</template>
</odoo>

View File

@ -1,93 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright 2017 Fabien Bourgeois <fabien@yaltik.com>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
-->
<odoo>
<data>
<!-- Forms -->
<record model="ir.ui.view" id="golem_member_form_inherit_golem_membership">
<field name="name">GOLEM Member form adaptations</field>
<field name="model">golem.member</field>
<field name="inherit_id" ref="golem_member.golem_member_form" />
<field name="arch" type="xml">
<page name="other_page" position="before">
<page string="Membership">
<group>
<group>
<field name="free_member"/>
<label for="membership_state"/>
<div>
<field name="partner_id" invisible="True" required="False" />
<field name="membership_state"/>
<button name="%(golem_membership_invoice_action)d"
type="action" string="Buy Membership"
attrs="{'invisible':[('free_member','=',True)]}"
context="{'default_partner_id': partner_id}"
class="oe_link"/>
</div>
</group>
<group>
<field name="membership_start"
attrs="{'invisible':[('membership_start','=',False)]}"/>
<field name="membership_stop"
attrs="{'invisible':[('membership_stop','=',False)]}"/>
<field name="membership_cancel"
attrs="{'invisible':[('membership_cancel','=',False)]}"/>
</group>
</group>
<field name="member_lines" nolabel="1" colspan="4" readonly="1">
<tree string="Memberships">
<field name="date"/>
<field name="membership_id"/>
<field name="member_price"/>
<field name="account_invoice_id"/>
<field name="state"/>
</tree>
<form string="Memberships">
<group>
<field name="date"/>
<field name="member_price"/>
<field name="membership_id"/>
<field name="account_invoice_id"
context="{'form_view_ref': 'account.invoice_form'}"/>
<field name="state" colspan="4"/>
</group>
</form>
</field>
</page>
</page>
</field>
</record>
<!-- Searches -->
<record model="ir.ui.view" id="golem_member_search_inherit_golem_membership">
<field name="name">GOLEM Member form adaptations</field>
<field name="model">golem.member</field>
<field name="inherit_id" ref="golem_member.golem_member_search" />
<field name="arch" type="xml">
<filter name="season_default" position="after">
<separator />
<filter name="has_contributed" string="Has contributed"
domain="[('membership_state','in',['invoiced', 'paid'])]" />
<filter name="is_free_member" string="Is Free Member"
domain="[('free_member', '=', True)]" />
</filter>
</field>
</record>
</data>
</odoo>

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<!-- <!--
Copyright 2016 Fabien Bourgeois <fabien@yaltik.com> Copyright 2016-2018 Fabien Bourgeois <fabien@yaltik.com>
This program is free software: you can redistribute it and/or modify This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by it under the terms of the GNU Affero General Public License as published by
@ -40,16 +40,5 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
</field> </field>
</record> </record>
<!-- Actions -->
<record id="golem_membership_invoice_action" model="ir.actions.act_window">
<field name="name">Join Membership</field>
<field name="res_model">golem.membership.invoice</field>
<field name="src_model">golem.member</field>
<field name="view_type">form</field>
<field name="view_mode">tree,form</field>
<field name="view_id" ref="golem_membership_invoice_form"/>
<field name="target">new</field>
</record>
</data> </data>
</odoo> </odoo>