[ADD]GOLEM Membership Module : invoice memberships and all from GOLEM Member

This commit is contained in:
Fabien Bourgeois 2016-07-09 08:52:49 +02:00
parent 576b9ddb71
commit 6ca3b765ba
8 changed files with 475 additions and 0 deletions

View File

@ -0,0 +1,18 @@
# -*- coding: utf-8 -*-
# Copyright 2016 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/>.
from . import models

View File

@ -0,0 +1,31 @@
# -*- coding: utf-8 -*-
# Copyright 2016 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/>.
{
'name': 'GOLEM non-profit membership handling',
'summary': 'Extends Odoo membership',
'description': 'Non-profit french MJC membership management',
'version': '0.1',
'category': 'Non-profit management',
'author': 'Fabien Bourgeois',
'license': 'AGPL-3',
'application': False,
'installable': True,
'depends': ['golem_member', 'decimal_precision'],
'data': ['views/golem_member_view.xml',
'views/golem_membership_invoice.xml']
}

109
golem_membership/i18n/fr.po Normal file
View File

@ -0,0 +1,109 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * golem_membership
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 8.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2016-07-09 06:41+0000\n"
"PO-Revision-Date: 2016-07-09 06:41+0000\n"
"Last-Translator: <>\n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Language: fr\n"
"Plural-Forms: nplurals=2; plural=(n > 1);\n"
#. module: golem_membership
#: view:golem.member:golem_membership.membership_add
msgid "Buy Membership"
msgstr "Payer une adhésion"
#. module: golem_membership
#: view:golem.membership.invoice:golem_membership.membership_invoice_view
msgid "Cancel"
msgstr "Annuler"
#. module: golem_membership
#: field:golem.membership.invoice,create_uid:0
msgid "Created by"
msgstr "Créé par"
#. module: golem_membership
#: field:golem.membership.invoice,create_date:0
msgid "Created on"
msgstr "Créé le"
#. module: golem_membership
#: field:golem.membership.invoice,display_name:0
msgid "Display Name"
msgstr "Nom affiché"
#. module: golem_membership
#: model:ir.model,name:golem_membership.model_golem_membership_invoice
msgid "GOLEM MemberShip invoicing"
msgstr "GOLEM : facturation de l'adhésion"
#. module: golem_membership
#: field:golem.membership.invoice,id:0
msgid "ID"
msgstr "ID"
#. module: golem_membership
#: view:golem.membership.invoice:golem_membership.membership_invoice_view
msgid "Invoice Membership"
msgstr "Facture d'adhésion"
#. module: golem_membership
#: model:ir.actions.act_window,name:golem_membership.action_membership_invoice_view
msgid "Join Membership"
msgstr "Adhésion"
#. module: golem_membership
#: field:golem.membership.invoice,__last_update:0
msgid "Last Modified on"
msgstr "Dernière modification le"
#. module: golem_membership
#: field:golem.membership.invoice,write_uid:0
msgid "Last Updated by"
msgstr "Dernière modification par"
#. module: golem_membership
#: field:golem.membership.invoice,write_date:0
msgid "Last Updated on"
msgstr "Dernière modification le"
#. module: golem_membership
#: field:golem.membership.invoice,member_price:0
msgid "Member Price"
msgstr "Prix Membre"
#. module: golem_membership
#: view:golem.member:golem_membership.membership_add
#: field:golem.membership.invoice,product_id:0
msgid "Membership"
msgstr "Adhésion"
#. module: golem_membership
#: view:golem.membership.invoice:golem_membership.membership_invoice_view
msgid "Membership Invoice"
msgstr "Facture de l'adhésion"
#. module: golem_membership
#: view:golem.member:golem_membership.membership_add
msgid "Memberships"
msgstr "Adhésions"
#. module: golem_membership
#: field:golem.membership.invoice,partner_id:0
msgid "Partner"
msgstr "Contact"
#. module: golem_membership
#: view:golem.membership.invoice:golem_membership.membership_invoice_view
msgid "or"
msgstr "ou"

View File

@ -0,0 +1,108 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * golem_membership
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 8.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2016-07-09 06:40+0000\n"
"PO-Revision-Date: 2016-07-09 06:40+0000\n"
"Last-Translator: <>\n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: \n"
#. module: golem_membership
#: view:golem.member:golem_membership.membership_add
msgid "Buy Membership"
msgstr ""
#. module: golem_membership
#: view:golem.membership.invoice:golem_membership.membership_invoice_view
msgid "Cancel"
msgstr ""
#. module: golem_membership
#: field:golem.membership.invoice,create_uid:0
msgid "Created by"
msgstr ""
#. module: golem_membership
#: field:golem.membership.invoice,create_date:0
msgid "Created on"
msgstr ""
#. module: golem_membership
#: field:golem.membership.invoice,display_name:0
msgid "Display Name"
msgstr ""
#. module: golem_membership
#: model:ir.model,name:golem_membership.model_golem_membership_invoice
msgid "GOLEM MemberShip invoicing"
msgstr ""
#. module: golem_membership
#: field:golem.membership.invoice,id:0
msgid "ID"
msgstr ""
#. module: golem_membership
#: view:golem.membership.invoice:golem_membership.membership_invoice_view
msgid "Invoice Membership"
msgstr ""
#. module: golem_membership
#: model:ir.actions.act_window,name:golem_membership.action_membership_invoice_view
msgid "Join Membership"
msgstr ""
#. module: golem_membership
#: field:golem.membership.invoice,__last_update:0
msgid "Last Modified on"
msgstr ""
#. module: golem_membership
#: field:golem.membership.invoice,write_uid:0
msgid "Last Updated by"
msgstr ""
#. module: golem_membership
#: field:golem.membership.invoice,write_date:0
msgid "Last Updated on"
msgstr ""
#. module: golem_membership
#: field:golem.membership.invoice,member_price:0
msgid "Member Price"
msgstr ""
#. module: golem_membership
#: view:golem.member:golem_membership.membership_add
#: field:golem.membership.invoice,product_id:0
msgid "Membership"
msgstr ""
#. module: golem_membership
#: view:golem.membership.invoice:golem_membership.membership_invoice_view
msgid "Membership Invoice"
msgstr ""
#. module: golem_membership
#: view:golem.member:golem_membership.membership_add
msgid "Memberships"
msgstr ""
#. module: golem_membership
#: field:golem.membership.invoice,partner_id:0
msgid "Partner"
msgstr ""
#. module: golem_membership
#: view:golem.membership.invoice:golem_membership.membership_invoice_view
msgid "or"
msgstr ""

View File

@ -0,0 +1,18 @@
# -*- coding: utf-8 -*-
# Copyright 2016 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/>.
from . import golem_membership

View File

@ -0,0 +1,60 @@
# -*- coding: utf-8 -*-
# Copyright 2016 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/>.
from openerp import models, fields, api
from openerp.addons import decimal_precision as dp
class GolemMembershipInvoice(models.TransientModel):
_name = 'golem.membership.invoice'
_description = 'GOLEM MemberShip invoicing'
partner_id = fields.Many2one('res.partner', 'Partner')
product_id = fields.Many2one('product.product', 'Membership',
required=True)
member_price = fields.Float('Member Price',
dp.get_precision('Product Price'),
required=True)
@api.one
@api.onchange('product_id')
def onchange_product(self):
if not self.product_id:
self.member_price = False
else:
price = self.product_id.price_get()[self.product_id.id]
self.member_price = price
@api.multi
def membership_invoice(self):
self.ensure_one()
datas = {'membership_product_id': self.product_id.id,
'amount': self.member_price}
invoice_list = self.partner_id.create_membership_invoice(datas=datas)
search_view_id = self.env.ref('account.view_account_invoice_filter')
form_view_id = self.env.ref('account.invoice_form')
return {
'domain': [('id', 'in', invoice_list)],
'name': 'Membership Invoices',
'view_type': 'form',
'view_mode': 'tree,form',
'res_model': 'account.invoice',
'type': 'ir.actions.act_window',
'views': [(False, 'tree'), (form_view_id.id, 'form')],
'search_view_id': search_view_id.id
}

View File

@ -0,0 +1,75 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright 2016 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/>.
-->
<openerp>
<data>
<!-- Forms -->
<record model="ir.ui.view" id="membership_add">
<field name="name">Add membership button</field>
<field name="model">golem.member</field>
<field name="inherit_id" ref="golem_member.view_form" />
<field name="arch" type="xml">
<notebook position="inside">
<page string="Membership">
<group>
<group>
<field name="free_member"/>
<label for="membership_state"/>
<div>
<field name="membership_state"/>
<button name="%(action_membership_invoice_view)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">
<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"/>
</form>
</field>
</page>
</notebook>
</field>
</record>
</data>
</openerp>

View File

@ -0,0 +1,56 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright 2016 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/>.
-->
<openerp>
<data>
<!-- Forms -->
<record id="membership_invoice_view" model="ir.ui.view">
<field name="name">membership.invoice.view.form</field>
<field name="model">golem.membership.invoice</field>
<field name="arch" type="xml">
<form string="Membership Invoice">
<group>
<field name="product_id" domain="[('membership','=',True)]"
widget="selection" />
<field name="member_price" />
</group>
<footer>
<button string="Invoice Membership" name="membership_invoice"
type="object" class="oe_highlight" />
or
<button string="Cancel" class="oe_link" special="cancel" />
</footer>
</form>
</field>
</record>
<!-- Actions -->
<record id="action_membership_invoice_view"
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="membership_invoice_view"/>
<field name="target">new</field>
</record>
</data>
</openerp>