[MIG][IMP]GOLEM Membership to v3

This commit is contained in:
Fabien Bourgeois 2017-06-14 09:06:47 +02:00
parent 2925c26369
commit 7dfb07b48c
6 changed files with 76 additions and 70 deletions

View File

@ -23,7 +23,7 @@
'author': 'Fabien Bourgeois', 'author': 'Fabien Bourgeois',
'license': 'AGPL-3', 'license': 'AGPL-3',
'application': False, 'application': False,
'installable': False, 'installable': True,
'depends': ['golem_member', 'account', 'decimal_precision'], 'depends': ['golem_member', 'account', 'decimal_precision'],
'data': ['views/golem_membership_invoice.xml', 'data': ['views/golem_membership_invoice.xml',
'views/golem_member_view.xml'] 'views/golem_member_view.xml']

View File

@ -4,10 +4,10 @@
# #
msgid "" msgid ""
msgstr "" msgstr ""
"Project-Id-Version: Odoo Server 8.0\n" "Project-Id-Version: Odoo Server 10.0\n"
"Report-Msgid-Bugs-To: \n" "Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2016-07-09 06:41+0000\n" "POT-Creation-Date: 2017-06-14 07:05+0000\n"
"PO-Revision-Date: 2016-07-09 06:41+0000\n" "PO-Revision-Date: 2017-06-14 07:05+0000\n"
"Last-Translator: <>\n" "Last-Translator: <>\n"
"Language-Team: \n" "Language-Team: \n"
"MIME-Version: 1.0\n" "MIME-Version: 1.0\n"
@ -17,27 +17,27 @@ msgstr ""
"Plural-Forms: nplurals=2; plural=(n > 1);\n" "Plural-Forms: nplurals=2; plural=(n > 1);\n"
#. module: golem_membership #. module: golem_membership
#: view:golem.member:golem_membership.membership_add #: model:ir.ui.view,arch_db:golem_membership.golem_member_form_inherit_golem_membership
msgid "Buy Membership" msgid "Buy Membership"
msgstr "Payer une adhésion" msgstr "Payer une cotisation"
#. module: golem_membership #. module: golem_membership
#: view:golem.membership.invoice:golem_membership.membership_invoice_view #: model:ir.ui.view,arch_db:golem_membership.golem_membership_invoice_form
msgid "Cancel" msgid "Cancel"
msgstr "Annuler" msgstr "Annuler"
#. module: golem_membership #. module: golem_membership
#: field:golem.membership.invoice,create_uid:0 #: model:ir.model.fields,field_description:golem_membership.field_golem_membership_invoice_create_uid
msgid "Created by" msgid "Created by"
msgstr "Créé par" msgstr "Créé par"
#. module: golem_membership #. module: golem_membership
#: field:golem.membership.invoice,create_date:0 #: model:ir.model.fields,field_description:golem_membership.field_golem_membership_invoice_create_date
msgid "Created on" msgid "Created on"
msgstr "Créé le" msgstr "Créé le"
#. module: golem_membership #. module: golem_membership
#: field:golem.membership.invoice,display_name:0 #: model:ir.model.fields,field_description:golem_membership.field_golem_membership_invoice_display_name
msgid "Display Name" msgid "Display Name"
msgstr "Nom affiché" msgstr "Nom affiché"
@ -47,63 +47,63 @@ msgid "GOLEM MemberShip invoicing"
msgstr "GOLEM : facturation de l'adhésion" msgstr "GOLEM : facturation de l'adhésion"
#. module: golem_membership #. module: golem_membership
#: field:golem.membership.invoice,id:0 #: model:ir.model.fields,field_description:golem_membership.field_golem_membership_invoice_id
msgid "ID" msgid "ID"
msgstr "ID" msgstr "ID"
#. module: golem_membership #. module: golem_membership
#: view:golem.membership.invoice:golem_membership.membership_invoice_view #: model:ir.ui.view,arch_db:golem_membership.golem_membership_invoice_form
msgid "Invoice Membership" msgid "Invoice Membership"
msgstr "Facture d'adhésion" msgstr "Facture d'adhésion"
#. module: golem_membership #. module: golem_membership
#: model:ir.actions.act_window,name:golem_membership.action_membership_invoice_view #: model:ir.actions.act_window,name:golem_membership.golem_membership_invoice_action
msgid "Join Membership" msgid "Join Membership"
msgstr "Adhésion" msgstr "Adhésion"
#. module: golem_membership #. module: golem_membership
#: field:golem.membership.invoice,__last_update:0 #: model:ir.model.fields,field_description:golem_membership.field_golem_membership_invoice___last_update
msgid "Last Modified on" msgid "Last Modified on"
msgstr "Dernière modification le" msgstr "Dernière Modification le"
#. module: golem_membership #. module: golem_membership
#: field:golem.membership.invoice,write_uid:0 #: model:ir.model.fields,field_description:golem_membership.field_golem_membership_invoice_write_uid
msgid "Last Updated by" msgid "Last Updated by"
msgstr "Dernière modification par" msgstr "Dernière mise à jour par"
#. module: golem_membership #. module: golem_membership
#: field:golem.membership.invoice,write_date:0 #: model:ir.model.fields,field_description:golem_membership.field_golem_membership_invoice_write_date
msgid "Last Updated on" msgid "Last Updated on"
msgstr "Dernière modification le" msgstr "Dernière mise à jour le"
#. module: golem_membership #. module: golem_membership
#: field:golem.membership.invoice,member_price:0 #: model:ir.model.fields,field_description:golem_membership.field_golem_membership_invoice_member_price
msgid "Member Price" msgid "Member Price"
msgstr "Prix Membre" msgstr "Tarif d'adhésion"
#. module: golem_membership #. module: golem_membership
#: view:golem.member:golem_membership.membership_add #: model:ir.model.fields,field_description:golem_membership.field_golem_membership_invoice_product_id
#: field:golem.membership.invoice,product_id:0 #: model:ir.ui.view,arch_db:golem_membership.golem_member_form_inherit_golem_membership
msgid "Membership" msgid "Membership"
msgstr "Adhésion" msgstr "Adhésion"
#. module: golem_membership #. module: golem_membership
#: view:golem.membership.invoice:golem_membership.membership_invoice_view #: model:ir.ui.view,arch_db:golem_membership.golem_membership_invoice_form
msgid "Membership Invoice" msgid "Membership Invoice"
msgstr "Facture de l'adhésion" msgstr "Facture de l'adhésion"
#. module: golem_membership #. module: golem_membership
#: view:golem.member:golem_membership.membership_add #: model:ir.ui.view,arch_db:golem_membership.golem_member_form_inherit_golem_membership
msgid "Memberships" msgid "Memberships"
msgstr "Adhésions" msgstr "Adhésions"
#. module: golem_membership #. module: golem_membership
#: field:golem.membership.invoice,partner_id:0 #: model:ir.model.fields,field_description:golem_membership.field_golem_membership_invoice_partner_id
msgid "Partner" msgid "Partner"
msgstr "Contact" msgstr "Contact"
#. module: golem_membership #. module: golem_membership
#: view:golem.membership.invoice:golem_membership.membership_invoice_view #: model:ir.ui.view,arch_db:golem_membership.golem_membership_invoice_form
msgid "or" msgid "or"
msgstr "ou" msgstr "ou"

View File

@ -4,10 +4,10 @@
# #
msgid "" msgid ""
msgstr "" msgstr ""
"Project-Id-Version: Odoo Server 8.0\n" "Project-Id-Version: Odoo Server 10.0\n"
"Report-Msgid-Bugs-To: \n" "Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2016-07-09 06:40+0000\n" "POT-Creation-Date: 2017-06-14 07:04+0000\n"
"PO-Revision-Date: 2016-07-09 06:40+0000\n" "PO-Revision-Date: 2017-06-14 07:04+0000\n"
"Last-Translator: <>\n" "Last-Translator: <>\n"
"Language-Team: \n" "Language-Team: \n"
"MIME-Version: 1.0\n" "MIME-Version: 1.0\n"
@ -16,27 +16,27 @@ msgstr ""
"Plural-Forms: \n" "Plural-Forms: \n"
#. module: golem_membership #. module: golem_membership
#: view:golem.member:golem_membership.membership_add #: model:ir.ui.view,arch_db:golem_membership.golem_member_form_inherit_golem_membership
msgid "Buy Membership" msgid "Buy Membership"
msgstr "" msgstr ""
#. module: golem_membership #. module: golem_membership
#: view:golem.membership.invoice:golem_membership.membership_invoice_view #: model:ir.ui.view,arch_db:golem_membership.golem_membership_invoice_form
msgid "Cancel" msgid "Cancel"
msgstr "" msgstr ""
#. module: golem_membership #. module: golem_membership
#: field:golem.membership.invoice,create_uid:0 #: model:ir.model.fields,field_description:golem_membership.field_golem_membership_invoice_create_uid
msgid "Created by" msgid "Created by"
msgstr "" msgstr ""
#. module: golem_membership #. module: golem_membership
#: field:golem.membership.invoice,create_date:0 #: model:ir.model.fields,field_description:golem_membership.field_golem_membership_invoice_create_date
msgid "Created on" msgid "Created on"
msgstr "" msgstr ""
#. module: golem_membership #. module: golem_membership
#: field:golem.membership.invoice,display_name:0 #: model:ir.model.fields,field_description:golem_membership.field_golem_membership_invoice_display_name
msgid "Display Name" msgid "Display Name"
msgstr "" msgstr ""
@ -46,63 +46,63 @@ msgid "GOLEM MemberShip invoicing"
msgstr "" msgstr ""
#. module: golem_membership #. module: golem_membership
#: field:golem.membership.invoice,id:0 #: model:ir.model.fields,field_description:golem_membership.field_golem_membership_invoice_id
msgid "ID" msgid "ID"
msgstr "" msgstr ""
#. module: golem_membership #. module: golem_membership
#: view:golem.membership.invoice:golem_membership.membership_invoice_view #: model:ir.ui.view,arch_db:golem_membership.golem_membership_invoice_form
msgid "Invoice Membership" msgid "Invoice Membership"
msgstr "" msgstr ""
#. module: golem_membership #. module: golem_membership
#: model:ir.actions.act_window,name:golem_membership.action_membership_invoice_view #: model:ir.actions.act_window,name:golem_membership.golem_membership_invoice_action
msgid "Join Membership" msgid "Join Membership"
msgstr "" msgstr ""
#. module: golem_membership #. module: golem_membership
#: field:golem.membership.invoice,__last_update:0 #: model:ir.model.fields,field_description:golem_membership.field_golem_membership_invoice___last_update
msgid "Last Modified on" msgid "Last Modified on"
msgstr "" msgstr ""
#. module: golem_membership #. module: golem_membership
#: field:golem.membership.invoice,write_uid:0 #: model:ir.model.fields,field_description:golem_membership.field_golem_membership_invoice_write_uid
msgid "Last Updated by" msgid "Last Updated by"
msgstr "" msgstr ""
#. module: golem_membership #. module: golem_membership
#: field:golem.membership.invoice,write_date:0 #: model:ir.model.fields,field_description:golem_membership.field_golem_membership_invoice_write_date
msgid "Last Updated on" msgid "Last Updated on"
msgstr "" msgstr ""
#. module: golem_membership #. module: golem_membership
#: field:golem.membership.invoice,member_price:0 #: model:ir.model.fields,field_description:golem_membership.field_golem_membership_invoice_member_price
msgid "Member Price" msgid "Member Price"
msgstr "" msgstr ""
#. module: golem_membership #. module: golem_membership
#: view:golem.member:golem_membership.membership_add #: model:ir.model.fields,field_description:golem_membership.field_golem_membership_invoice_product_id
#: field:golem.membership.invoice,product_id:0 #: model:ir.ui.view,arch_db:golem_membership.golem_member_form_inherit_golem_membership
msgid "Membership" msgid "Membership"
msgstr "" msgstr ""
#. module: golem_membership #. module: golem_membership
#: view:golem.membership.invoice:golem_membership.membership_invoice_view #: model:ir.ui.view,arch_db:golem_membership.golem_membership_invoice_form
msgid "Membership Invoice" msgid "Membership Invoice"
msgstr "" msgstr ""
#. module: golem_membership #. module: golem_membership
#: view:golem.member:golem_membership.membership_add #: model:ir.ui.view,arch_db:golem_membership.golem_member_form_inherit_golem_membership
msgid "Memberships" msgid "Memberships"
msgstr "" msgstr ""
#. module: golem_membership #. module: golem_membership
#: field:golem.membership.invoice,partner_id:0 #: model:ir.model.fields,field_description:golem_membership.field_golem_membership_invoice_partner_id
msgid "Partner" msgid "Partner"
msgstr "" msgstr ""
#. module: golem_membership #. module: golem_membership
#: view:golem.membership.invoice:golem_membership.membership_invoice_view #: model:ir.ui.view,arch_db:golem_membership.golem_membership_invoice_form
msgid "or" msgid "or"
msgstr "" msgstr ""

View File

@ -1,6 +1,6 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# Copyright 2016 Fabien Bourgeois <fabien@yaltik.com> # Copyright 2017 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 # it under the terms of the GNU Affero General Public License as
@ -15,11 +15,14 @@
# You should have received a copy of the GNU Affero General Public License # 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/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
""" GOLEM Membership """
from odoo import models, fields, api from odoo import models, fields, api
from odoo.addons import decimal_precision as dp from odoo.addons import decimal_precision as dp
class GolemMembershipInvoice(models.TransientModel): class GolemMembershipInvoice(models.TransientModel):
""" Membership invoicing """
_name = 'golem.membership.invoice' _name = 'golem.membership.invoice'
_description = 'GOLEM MemberShip invoicing' _description = 'GOLEM MemberShip invoicing'
@ -30,17 +33,19 @@ class GolemMembershipInvoice(models.TransientModel):
dp.get_precision('Product Price'), dp.get_precision('Product Price'),
required=True) required=True)
@api.one
@api.onchange('product_id') @api.onchange('product_id')
def onchange_product(self): def onchange_product(self):
if not self.product_id: """ Sets price according to product """
self.member_price = False for minvoice in self:
else: if not minvoice.product_id:
price = self.product_id.price_get()[self.product_id.id] minvoice.member_price = False
self.member_price = price else:
price = minvoice.product_id.price_get()[minvoice.product_id.id]
minvoice.member_price = price
@api.multi @api.multi
def membership_invoice(self): def membership_invoice(self):
""" Create invoice and redirect to partner invoice list """
self.ensure_one() self.ensure_one()
datas = {'membership_product_id': self.product_id.id, datas = {'membership_product_id': self.product_id.id,
'amount': self.member_price} 'amount': self.member_price}

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 2017 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
@ -20,10 +20,10 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
<odoo> <odoo>
<data> <data>
<!-- Forms --> <!-- Forms -->
<record model="ir.ui.view" id="membership_add"> <record model="ir.ui.view" id="golem_member_form_inherit_golem_membership">
<field name="name">Add membership button</field> <field name="name">GOLEM Member form adaptations</field>
<field name="model">golem.member</field> <field name="model">golem.member</field>
<field name="inherit_id" ref="golem_member.view_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="other_page" position="before">
<page string="Membership"> <page string="Membership">
@ -34,7 +34,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
<div> <div>
<field name="partner_id" invisible="True" required="False" /> <field name="partner_id" invisible="True" required="False" />
<field name="membership_state"/> <field name="membership_state"/>
<button name="%(action_membership_invoice_view)d" <button name="%(golem_membership_invoice_action)d"
type="action" string="Buy Membership" type="action" string="Buy Membership"
attrs="{'invisible':[('free_member','=',True)]}" attrs="{'invisible':[('free_member','=',True)]}"
context="{'default_partner_id': partner_id}" context="{'default_partner_id': partner_id}"
@ -59,12 +59,14 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
<field name="state"/> <field name="state"/>
</tree> </tree>
<form string="Memberships"> <form string="Memberships">
<field name="date"/> <group>
<field name="member_price"/> <field name="date"/>
<field name="membership_id"/> <field name="member_price"/>
<field name="account_invoice_id" <field name="membership_id"/>
context="{'form_view_ref': 'account.invoice_form'}"/> <field name="account_invoice_id"
<field name="state" colspan="4"/> context="{'form_view_ref': 'account.invoice_form'}"/>
<field name="state" colspan="4"/>
</group>
</form> </form>
</field> </field>
</page> </page>

View File

@ -20,7 +20,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
<odoo> <odoo>
<data> <data>
<!-- Forms --> <!-- Forms -->
<record id="membership_invoice_view" model="ir.ui.view"> <record id="golem_membership_invoice_form" model="ir.ui.view">
<field name="name">membership.invoice.view.form</field> <field name="name">membership.invoice.view.form</field>
<field name="model">golem.membership.invoice</field> <field name="model">golem.membership.invoice</field>
<field name="arch" type="xml"> <field name="arch" type="xml">
@ -41,14 +41,13 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
</record> </record>
<!-- Actions --> <!-- Actions -->
<record id="action_membership_invoice_view" <record id="golem_membership_invoice_action" model="ir.actions.act_window">
model="ir.actions.act_window">
<field name="name">Join Membership</field> <field name="name">Join Membership</field>
<field name="res_model">golem.membership.invoice</field> <field name="res_model">golem.membership.invoice</field>
<field name="src_model">golem.member</field> <field name="src_model">golem.member</field>
<field name="view_type">form</field> <field name="view_type">form</field>
<field name="view_mode">tree,form</field> <field name="view_mode">tree,form</field>
<field name="view_id" ref="membership_invoice_view"/> <field name="view_id" ref="golem_membership_invoice_form"/>
<field name="target">new</field> <field name="target">new</field>
</record> </record>