[IMP]GOLEM Activity Registration Payment : more flexibility, float 2 monetary

This commit is contained in:
Fabien BOURGEOIS 2018-08-04 01:09:58 +02:00
parent e2d72cb4ab
commit 39a2565d07
6 changed files with 36 additions and 22 deletions

View File

@ -19,7 +19,7 @@
'name': 'GOLEM Activity Member Registration Payments', 'name': 'GOLEM Activity Member Registration Payments',
'summary': 'GOLEM Activities Member Registration Payments', 'summary': 'GOLEM Activities Member Registration Payments',
'description': 'GOLEM Activities Member Registration Payments', 'description': 'GOLEM Activities Member Registration Payments',
'version': '10.0.0.3.1', 'version': '10.0.0.3.2',
'category': 'GOLEM', 'category': 'GOLEM',
'author': 'Fabien Bourgeois', 'author': 'Fabien Bourgeois',
'license': 'AGPL-3', 'license': 'AGPL-3',

View File

@ -6,8 +6,8 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: Odoo Server 10.0\n" "Project-Id-Version: Odoo Server 10.0\n"
"Report-Msgid-Bugs-To: \n" "Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2018-08-02 16:45+0000\n" "POT-Creation-Date: 2018-08-03 23:00+0000\n"
"PO-Revision-Date: 2018-08-02 18:47+0200\n" "PO-Revision-Date: 2018-08-04 01:09+0200\n"
"Last-Translator: <>\n" "Last-Translator: <>\n"
"Language-Team: \n" "Language-Team: \n"
"MIME-Version: 1.0\n" "MIME-Version: 1.0\n"
@ -39,7 +39,7 @@ msgid "Activities and Prices"
msgstr "Activités et tarifs" msgstr "Activités et tarifs"
#. module: golem_activity_registration_payment #. module: golem_activity_registration_payment
#: code:addons/golem_activity_registration_payment/models/golem_member.py:65 #: code:addons/golem_activity_registration_payment/models/golem_member.py:70
#, python-format #, python-format
msgid "All confirmed registrations had already been invoiced." msgid "All confirmed registrations had already been invoiced."
msgstr "Toutes les inscriptions confirmées ont déjà été facturées." msgstr "Toutes les inscriptions confirmées ont déjà été facturées."
@ -84,6 +84,7 @@ msgstr "Créé le"
#. module: golem_activity_registration_payment #. module: golem_activity_registration_payment
#: model:ir.model.fields,field_description:golem_activity_registration_payment.field_golem_activity_registration_currency_id #: model:ir.model.fields,field_description:golem_activity_registration_payment.field_golem_activity_registration_currency_id
#: model:ir.model.fields,field_description:golem_activity_registration_payment.field_golem_activity_registration_invoicing_line_currency_id
msgid "Currency" msgid "Currency"
msgstr "Devise" msgstr "Devise"
@ -105,7 +106,7 @@ msgstr "Afficher les paiements"
#. module: golem_activity_registration_payment #. module: golem_activity_registration_payment
#: model:ir.ui.view,arch_db:golem_activity_registration_payment.golem_activity_registration_search_inherit_payment #: model:ir.ui.view,arch_db:golem_activity_registration_payment.golem_activity_registration_search_inherit_payment
msgid "Draft Invoice" msgid "Draft Invoice"
msgstr "Facture brouillon" msgstr "Facture en brouillon"
#. module: golem_activity_registration_payment #. module: golem_activity_registration_payment
#: model:ir.model,name:golem_activity_registration_payment.model_golem_activity_registration #: model:ir.model,name:golem_activity_registration_payment.model_golem_activity_registration
@ -128,13 +129,13 @@ msgid "GOLEM Member"
msgstr "Adhérent" msgstr "Adhérent"
#. module: golem_activity_registration_payment #. module: golem_activity_registration_payment
#: code:addons/golem_activity_registration_payment/wizard/golem_activity_registration_invoicing.py:147 #: code:addons/golem_activity_registration_payment/wizard/golem_activity_registration_invoicing.py:148
#, python-format #, python-format
msgid "Generated invoice" msgid "Generated invoice"
msgstr "Facture générée" msgstr "Facture générée"
#. module: golem_activity_registration_payment #. module: golem_activity_registration_payment
#: code:addons/golem_activity_registration_payment/wizard/golem_activity_registration_invoicing.py:162 #: code:addons/golem_activity_registration_payment/wizard/golem_activity_registration_invoicing.py:163
#, python-format #, python-format
msgid "Generated payments" msgid "Generated payments"
msgstr "Paiements générés" msgstr "Paiements générés"
@ -271,13 +272,13 @@ msgid "Status"
msgstr "État" msgstr "État"
#. module: golem_activity_registration_payment #. module: golem_activity_registration_payment
#: code:addons/golem_activity_registration_payment/wizard/golem_activity_registration_invoicing.py:143 #: code:addons/golem_activity_registration_payment/wizard/golem_activity_registration_invoicing.py:144
#, python-format #, python-format
msgid "There is no generated invoice." msgid "There is no generated invoice."
msgstr "Il n'y a pas de facture générée." msgstr "Il n'y a pas de facture générée."
#. module: golem_activity_registration_payment #. module: golem_activity_registration_payment
#: code:addons/golem_activity_registration_payment/wizard/golem_activity_registration_invoicing.py:158 #: code:addons/golem_activity_registration_payment/wizard/golem_activity_registration_invoicing.py:159
#, python-format #, python-format
msgid "There is no generated payments." msgid "There is no generated payments."
msgstr "Il n'y a pas de paiement généré." msgstr "Il n'y a pas de paiement généré."

View File

@ -6,8 +6,8 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: Odoo Server 10.0\n" "Project-Id-Version: Odoo Server 10.0\n"
"Report-Msgid-Bugs-To: \n" "Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2018-08-02 16:45+0000\n" "POT-Creation-Date: 2018-08-03 23:00+0000\n"
"PO-Revision-Date: 2018-08-02 16:45+0000\n" "PO-Revision-Date: 2018-08-03 23:00+0000\n"
"Last-Translator: <>\n" "Last-Translator: <>\n"
"Language-Team: \n" "Language-Team: \n"
"MIME-Version: 1.0\n" "MIME-Version: 1.0\n"
@ -35,7 +35,7 @@ msgid "Activities and Prices"
msgstr "" msgstr ""
#. module: golem_activity_registration_payment #. module: golem_activity_registration_payment
#: code:addons/golem_activity_registration_payment/models/golem_member.py:65 #: code:addons/golem_activity_registration_payment/models/golem_member.py:70
#, python-format #, python-format
msgid "All confirmed registrations had already been invoiced." msgid "All confirmed registrations had already been invoiced."
msgstr "" msgstr ""
@ -80,6 +80,7 @@ msgstr ""
#. module: golem_activity_registration_payment #. module: golem_activity_registration_payment
#: model:ir.model.fields,field_description:golem_activity_registration_payment.field_golem_activity_registration_currency_id #: model:ir.model.fields,field_description:golem_activity_registration_payment.field_golem_activity_registration_currency_id
#: model:ir.model.fields,field_description:golem_activity_registration_payment.field_golem_activity_registration_invoicing_line_currency_id
msgid "Currency" msgid "Currency"
msgstr "" msgstr ""
@ -124,13 +125,13 @@ msgid "GOLEM Member"
msgstr "" msgstr ""
#. module: golem_activity_registration_payment #. module: golem_activity_registration_payment
#: code:addons/golem_activity_registration_payment/wizard/golem_activity_registration_invoicing.py:147 #: code:addons/golem_activity_registration_payment/wizard/golem_activity_registration_invoicing.py:148
#, python-format #, python-format
msgid "Generated invoice" msgid "Generated invoice"
msgstr "" msgstr ""
#. module: golem_activity_registration_payment #. module: golem_activity_registration_payment
#: code:addons/golem_activity_registration_payment/wizard/golem_activity_registration_invoicing.py:162 #: code:addons/golem_activity_registration_payment/wizard/golem_activity_registration_invoicing.py:163
#, python-format #, python-format
msgid "Generated payments" msgid "Generated payments"
msgstr "" msgstr ""
@ -245,7 +246,12 @@ msgid "Please confirm activity prices and choose a payment schedule if needed."
msgstr "" msgstr ""
#. module: golem_activity_registration_payment #. module: golem_activity_registration_payment
#: code:addons/golem_activity_registration_payment/models/golem_member.py:58 #: model:ir.model.fields,field_description:golem_activity_registration_payment.field_golem_activity_registration_invoicing_line_pricing_info
msgid "Pricing info"
msgstr ""
#. module: golem_activity_registration_payment
#: code:addons/golem_activity_registration_payment/models/golem_member.py:63
#: model:ir.ui.view,arch_db:golem_activity_registration_payment.golem_activity_registration_invoicing_view_form #: model:ir.ui.view,arch_db:golem_activity_registration_payment.golem_activity_registration_invoicing_view_form
#, python-format #, python-format
msgid "Registration invoicing" msgid "Registration invoicing"
@ -267,13 +273,13 @@ msgid "Status"
msgstr "" msgstr ""
#. module: golem_activity_registration_payment #. module: golem_activity_registration_payment
#: code:addons/golem_activity_registration_payment/wizard/golem_activity_registration_invoicing.py:143 #: code:addons/golem_activity_registration_payment/wizard/golem_activity_registration_invoicing.py:144
#, python-format #, python-format
msgid "There is no generated invoice." msgid "There is no generated invoice."
msgstr "" msgstr ""
#. module: golem_activity_registration_payment #. module: golem_activity_registration_payment
#: code:addons/golem_activity_registration_payment/wizard/golem_activity_registration_invoicing.py:158 #: code:addons/golem_activity_registration_payment/wizard/golem_activity_registration_invoicing.py:159
#, python-format #, python-format
msgid "There is no generated payments." msgid "There is no generated payments."
msgstr "" msgstr ""

View File

@ -36,6 +36,12 @@ class GolemMember(models.Model):
regis = regis.filtered(lambda r: r.state == 'confirmed' and not r.invoice_line_id) regis = regis.filtered(lambda r: r.state == 'confirmed' and not r.invoice_line_id)
member.has_invoicable_registrations = bool(len(regis)) member.has_invoicable_registrations = bool(len(regis))
def invoice_line_data_get(self, registration):
""" Returns dict with invoice line data """
return {'registration_id': registration.id,
'activity_id': registration.activity_id.id,
'price': registration.activity_id.list_price}
@api.multi @api.multi
def invoice_registrations(self): def invoice_registrations(self):
""" Launch wizard to generate invoices for registrations """ """ Launch wizard to generate invoices for registrations """
@ -51,10 +57,9 @@ class GolemMember(models.Model):
}) })
line_obj = self.env['golem.activity.registration.invoicing.line'] line_obj = self.env['golem.activity.registration.invoicing.line']
for reg in registrations: for reg in registrations:
line_obj.create({'invoicing_id': invoicing.id, line_data = self.invoice_line_data_get(reg)
'registration_id': reg.id, line_data['invoicing_id'] = invoicing.id
'activity_id': reg.activity_id.id, line_obj.create(line_data)
'price': reg.activity_id.list_price})
return {'name': _('Registration invoicing'), return {'name': _('Registration invoicing'),
'type': 'ir.actions.act_window', 'type': 'ir.actions.act_window',
'res_model': 'golem.activity.registration.invoicing', 'res_model': 'golem.activity.registration.invoicing',

View File

@ -32,7 +32,8 @@ class GolemActivityRegistrationInvoicingLine(models.TransientModel):
required=True) required=True)
registration_id = fields.Many2one('golem.activity.registration', required=True) registration_id = fields.Many2one('golem.activity.registration', required=True)
activity_id = fields.Many2one('golem.activity', required=True, readonly=True) activity_id = fields.Many2one('golem.activity', required=True, readonly=True)
price = fields.Float() price = fields.Monetary()
currency_id = fields.Many2one(related='activity_id.currency_id')
class GolemActivityRegistrationInvoicing(models.TransientModel): class GolemActivityRegistrationInvoicing(models.TransientModel):

View File

@ -36,6 +36,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
<field name="line_ids" string="Activities and Prices"> <field name="line_ids" string="Activities and Prices">
<tree delete="false" create="false" edit="true" editable="bottom"> <tree delete="false" create="false" edit="true" editable="bottom">
<field name="activity_id" readonly="1" /> <field name="activity_id" readonly="1" />
<field name="currency_id" invisible="1" />
<field name="price" sum="Total" /> <field name="price" sum="Total" />
</tree> </tree>
</field> </field>