[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',
'license': 'AGPL-3',
'application': False,
'installable': False,
'installable': True,
'depends': ['golem_member', 'account', 'decimal_precision'],
'data': ['views/golem_membership_invoice.xml',
'views/golem_member_view.xml']

View File

@ -4,10 +4,10 @@
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 8.0\n"
"Project-Id-Version: Odoo Server 10.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"
"POT-Creation-Date: 2017-06-14 07:05+0000\n"
"PO-Revision-Date: 2017-06-14 07:05+0000\n"
"Last-Translator: <>\n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
@ -17,27 +17,27 @@ msgstr ""
"Plural-Forms: nplurals=2; plural=(n > 1);\n"
#. 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"
msgstr "Payer une adhésion"
msgstr "Payer une cotisation"
#. 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"
msgstr "Annuler"
#. 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"
msgstr "Créé par"
#. 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"
msgstr "Créé le"
#. 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"
msgstr "Nom affiché"
@ -47,63 +47,63 @@ msgid "GOLEM MemberShip invoicing"
msgstr "GOLEM : facturation de l'adhésion"
#. module: golem_membership
#: field:golem.membership.invoice,id:0
#: model:ir.model.fields,field_description:golem_membership.field_golem_membership_invoice_id
msgid "ID"
msgstr "ID"
#. 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"
msgstr "Facture d'adhésion"
#. 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"
msgstr "Adhésion"
#. 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"
msgstr "Dernière modification le"
msgstr "Dernière Modification le"
#. 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"
msgstr "Dernière modification par"
msgstr "Dernière mise à jour par"
#. 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"
msgstr "Dernière modification le"
msgstr "Dernière mise à jour le"
#. 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"
msgstr "Prix Membre"
msgstr "Tarif d'adhésion"
#. module: golem_membership
#: view:golem.member:golem_membership.membership_add
#: field:golem.membership.invoice,product_id:0
#: model:ir.model.fields,field_description:golem_membership.field_golem_membership_invoice_product_id
#: model:ir.ui.view,arch_db:golem_membership.golem_member_form_inherit_golem_membership
msgid "Membership"
msgstr "Adhésion"
#. 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"
msgstr "Facture de l'adhésion"
#. 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"
msgstr "Adhésions"
#. 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"
msgstr "Contact"
#. 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"
msgstr "ou"

View File

@ -4,10 +4,10 @@
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 8.0\n"
"Project-Id-Version: Odoo Server 10.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"
"POT-Creation-Date: 2017-06-14 07:04+0000\n"
"PO-Revision-Date: 2017-06-14 07:04+0000\n"
"Last-Translator: <>\n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
@ -16,27 +16,27 @@ msgstr ""
"Plural-Forms: \n"
#. 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"
msgstr ""
#. 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"
msgstr ""
#. 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"
msgstr ""
#. 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"
msgstr ""
#. 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"
msgstr ""
@ -46,63 +46,63 @@ msgid "GOLEM MemberShip invoicing"
msgstr ""
#. module: golem_membership
#: field:golem.membership.invoice,id:0
#: model:ir.model.fields,field_description:golem_membership.field_golem_membership_invoice_id
msgid "ID"
msgstr ""
#. 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"
msgstr ""
#. 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"
msgstr ""
#. 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"
msgstr ""
#. 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"
msgstr ""
#. 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"
msgstr ""
#. 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"
msgstr ""
#. module: golem_membership
#: view:golem.member:golem_membership.membership_add
#: field:golem.membership.invoice,product_id:0
#: model:ir.model.fields,field_description:golem_membership.field_golem_membership_invoice_product_id
#: model:ir.ui.view,arch_db:golem_membership.golem_member_form_inherit_golem_membership
msgid "Membership"
msgstr ""
#. 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"
msgstr ""
#. 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"
msgstr ""
#. 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"
msgstr ""
#. 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"
msgstr ""

View File

@ -1,6 +1,6 @@
# -*- 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
# 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
# along with this program. If not, see <http://www.gnu.org/licenses/>.
""" GOLEM Membership """
from odoo import models, fields, api
from odoo.addons import decimal_precision as dp
class GolemMembershipInvoice(models.TransientModel):
""" Membership invoicing """
_name = 'golem.membership.invoice'
_description = 'GOLEM MemberShip invoicing'
@ -30,17 +33,19 @@ class GolemMembershipInvoice(models.TransientModel):
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
""" Sets price according to product """
for minvoice in self:
if not minvoice.product_id:
minvoice.member_price = False
else:
price = minvoice.product_id.price_get()[minvoice.product_id.id]
minvoice.member_price = price
@api.multi
def membership_invoice(self):
""" Create invoice and redirect to partner invoice list """
self.ensure_one()
datas = {'membership_product_id': self.product_id.id,
'amount': self.member_price}

View File

@ -1,7 +1,7 @@
<?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
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>
<data>
<!-- Forms -->
<record model="ir.ui.view" id="membership_add">
<field name="name">Add membership button</field>
<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.view_form" />
<field name="inherit_id" ref="golem_member.golem_member_form" />
<field name="arch" type="xml">
<page name="other_page" position="before">
<page string="Membership">
@ -34,7 +34,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
<div>
<field name="partner_id" invisible="True" required="False" />
<field name="membership_state"/>
<button name="%(action_membership_invoice_view)d"
<button name="%(golem_membership_invoice_action)d"
type="action" string="Buy Membership"
attrs="{'invisible':[('free_member','=',True)]}"
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"/>
</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"/>
<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>

View File

@ -20,7 +20,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
<odoo>
<data>
<!-- 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="model">golem.membership.invoice</field>
<field name="arch" type="xml">
@ -41,14 +41,13 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
</record>
<!-- Actions -->
<record id="action_membership_invoice_view"
model="ir.actions.act_window">
<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="membership_invoice_view"/>
<field name="view_id" ref="golem_membership_invoice_form"/>
<field name="target">new</field>
</record>