diff --git a/golem_activity_registration_custom_price/__init__.py b/golem_activity_registration_custom_price/__init__.py new file mode 100644 index 0000000..5ca1747 --- /dev/null +++ b/golem_activity_registration_custom_price/__init__.py @@ -0,0 +1,18 @@ +# -*- coding: utf-8 -*- + +# Copyright 2018 Fabien Bourgeois +# +# 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 . + +from . import models, wizard diff --git a/golem_activity_registration_custom_price/__manifest__.py b/golem_activity_registration_custom_price/__manifest__.py new file mode 100644 index 0000000..c5ecaf2 --- /dev/null +++ b/golem_activity_registration_custom_price/__manifest__.py @@ -0,0 +1,40 @@ +# -*- coding: utf-8 -*- + +# Copyright 2018 Fabien Bourgeois +# +# 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 . + +{ + 'name': 'GOLEM Activity Registration Custom Price', + 'summary': 'GOLEM Activity Registration Custom Price', + 'description': '''GOLEM Activity Registration Custom Price : + - allow set of 1:n slices based on family quotient ; + - allow set 1:n area data ; + - allow set price per area and slice ; + - computes automatically applicable price ; + - anticipate ruleset to be implemented for computing.''', + 'version': '10.0.0.1.0', + 'category': 'GOLEM', + 'author': 'Fabien Bourgeois', + 'license': 'AGPL-3', + 'application': False, + 'installable': True, + 'depends': ['golem_activity_registration_payment', + 'golem_member_familyquotient'], + 'data': ['security/ir.model.access.csv', + 'views/golem_payment_rule_quotient_slice_views.xml', + 'views/golem_member_views.xml', + 'views/golem_activity_views.xml', + 'wizard/golem_activity_registration_invoicing_views.xml'] +} diff --git a/golem_activity_registration_custom_price/i18n/fr.po b/golem_activity_registration_custom_price/i18n/fr.po new file mode 100644 index 0000000..cee7d2e --- /dev/null +++ b/golem_activity_registration_custom_price/i18n/fr.po @@ -0,0 +1,248 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * golem_activity_registration_custom_price +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 10.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2018-08-03 23:02+0000\n" +"PO-Revision-Date: 2018-08-04 01:17+0200\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_activity_registration_custom_price +#: model:ir.model.fields,field_description:golem_activity_registration_custom_price.field_golem_activity_price_line_activity_id +msgid "Activity id" +msgstr "Activité liée" + +#. module: golem_activity_registration_custom_price +#: model:ir.ui.view,arch_db:golem_activity_registration_custom_price.golem_activity_form_inherit_custom_price +msgid "Are you sure you want to RESET ALL options ?" +msgstr "Êtes-vous sûr de vouloir REINITIALISER TOUTES les options tarifaires ?" + +#. module: golem_activity_registration_custom_price +#: model:ir.ui.view,arch_db:golem_activity_registration_custom_price.golem_activity_form_inherit_custom_price +msgid "Are you sure you want to apply default price to all other options ?" +msgstr "Êtes-vous sûr de vouloir appliquer le tarif par défaut aux autres options ?" + +#. module: golem_activity_registration_custom_price +#: model:ir.model.fields,field_description:golem_activity_registration_custom_price.field_golem_activity_price_line_area_id +msgid "Area" +msgstr "Territoire" + +#. module: golem_activity_registration_custom_price +#: model:ir.ui.menu,name:golem_activity_registration_custom_price.golem_partner_area_menu +msgid "Areas" +msgstr "Territoires" + +#. module: golem_activity_registration_custom_price +#: model:ir.model.fields,help:golem_activity_registration_custom_price.field_golem_activity_registration_invoicing_line_activity_price +msgid "Base price to compute the customer price. Sometimes called the catalog price." +msgstr "Prix de base pour calculer le prix usager. Parfois appelé prix catalogue." + +#. module: golem_activity_registration_custom_price +#: model:ir.model.fields,field_description:golem_activity_registration_custom_price.field_golem_activity_price_line_create_uid +#: model:ir.model.fields,field_description:golem_activity_registration_custom_price.field_golem_payment_rule_familyquotient_slice_create_uid +msgid "Created by" +msgstr "Créé par" + +#. module: golem_activity_registration_custom_price +#: model:ir.model.fields,field_description:golem_activity_registration_custom_price.field_golem_activity_price_line_create_date +#: model:ir.model.fields,field_description:golem_activity_registration_custom_price.field_golem_payment_rule_familyquotient_slice_create_date +msgid "Created on" +msgstr "Créé le" + +#. module: golem_activity_registration_custom_price +#: model:ir.model.fields,field_description:golem_activity_registration_custom_price.field_golem_activity_price_line_currency_id +#: model:ir.model.fields,field_description:golem_activity_registration_custom_price.field_golem_payment_rule_familyquotient_slice_currency_id +msgid "Currency id" +msgstr "Currency id" + +#. module: golem_activity_registration_custom_price +#: code:addons/golem_activity_registration_custom_price/models/golem_payment_rule_quotient_slice.py:66 +#, python-format +msgid "Current family quotient slice cannot be included into another existing slice." +msgstr "La tranche de quotient familial ne peut être incluse dans une tranche existante." + +#. module: golem_activity_registration_custom_price +#: code:addons/golem_activity_registration_custom_price/models/golem_member.py:29 +#: model:ir.ui.view,arch_db:golem_activity_registration_custom_price.golem_activity_registration_invoicing_form_inherit_custom_price +#, python-format +msgid "Default price" +msgstr "Prix par défaut" + +#. module: golem_activity_registration_custom_price +#: model:ir.model.fields,field_description:golem_activity_registration_custom_price.field_golem_activity_price_line_display_name +#: model:ir.model.fields,field_description:golem_activity_registration_custom_price.field_golem_payment_rule_familyquotient_slice_display_name +msgid "Display Name" +msgstr "Nom affiché" + +#. module: golem_activity_registration_custom_price +#: model:ir.actions.act_window,name:golem_activity_registration_custom_price.golem_payment_rule_qfslice_action +#: model:ir.ui.menu,name:golem_activity_registration_custom_price.golem_payment_rule_qfslice_menu +msgid "Family Quotients" +msgstr "Quotients familiaux" + +#. module: golem_activity_registration_custom_price +#: code:addons/golem_activity_registration_custom_price/models/golem_member.py:61 +#, python-format +msgid "Family quotient and area" +msgstr "Quotient familial et territoire" + +#. module: golem_activity_registration_custom_price +#: code:addons/golem_activity_registration_custom_price/models/golem_member.py:59 +#, python-format +msgid "Family quotient but random area" +msgstr "Quotient familial mais territoire aléatoire" + +#. module: golem_activity_registration_custom_price +#: model:ir.model.fields,field_description:golem_activity_registration_custom_price.field_golem_payment_rule_familyquotient_slice_family_quotient_from +msgid "Family quotient from" +msgstr "QF à partir de" + +#. module: golem_activity_registration_custom_price +#: code:addons/golem_activity_registration_custom_price/models/golem_payment_rule_quotient_slice.py:56 +#, python-format +msgid "Family quotient from is in range of an existing slice." +msgstr "La borne basse du quotient familial fait partie d'une tranche existante." + +#. module: golem_activity_registration_custom_price +#: model:ir.model.fields,field_description:golem_activity_registration_custom_price.field_golem_activity_price_line_slice_id +msgid "Family quotient slice" +msgstr "Tranche de quotient familial" + +#. module: golem_activity_registration_custom_price +#: model:ir.model.fields,field_description:golem_activity_registration_custom_price.field_golem_payment_rule_familyquotient_slice_family_quotient_to +msgid "Family quotient to" +msgstr "QF jusqu'à" + +#. module: golem_activity_registration_custom_price +#: code:addons/golem_activity_registration_custom_price/models/golem_payment_rule_quotient_slice.py:61 +#, python-format +msgid "Family quotient to is in range of an existing slice." +msgstr "La borne haute du quotient familial fait partie d'une tranche existante." + +#. module: golem_activity_registration_custom_price +#: model:ir.model,name:golem_activity_registration_custom_price.model_golem_activity +msgid "GOLEM Activity" +msgstr "Activité" + +#. module: golem_activity_registration_custom_price +#: model:ir.model,name:golem_activity_registration_custom_price.model_golem_activity_price_line +msgid "GOLEM Activity Price Line" +msgstr "GOLEM Activity Price Line" + +#. module: golem_activity_registration_custom_price +#: model:ir.model,name:golem_activity_registration_custom_price.model_golem_activity_registration_invoicing_line +msgid "GOLEM Activity Registration Invoicing Lines" +msgstr "GOLEM Activity Registration Invoicing Lines" + +#. module: golem_activity_registration_custom_price +#: model:ir.model,name:golem_activity_registration_custom_price.model_golem_member +msgid "GOLEM Member" +msgstr "Usager" + +#. module: golem_activity_registration_custom_price +#: model:ir.model,name:golem_activity_registration_custom_price.model_golem_payment_rule_familyquotient_slice +msgid "GOLEM Payment Rule Family Quotient Slice" +msgstr "GOLEM Payment Rule Family Quotient Slice" + +#. module: golem_activity_registration_custom_price +#: model:ir.model,name:golem_activity_registration_custom_price.model_golem_payment_rule_geo +msgid "GOLEM Payment Rule Geo" +msgstr "GOLEM Payment Rule Geo" + +#. module: golem_activity_registration_custom_price +#: model:ir.model.fields,field_description:golem_activity_registration_custom_price.field_golem_activity_price_line_id +#: model:ir.model.fields,field_description:golem_activity_registration_custom_price.field_golem_payment_rule_familyquotient_slice_id +msgid "ID" +msgstr "ID" + +#. module: golem_activity_registration_custom_price +#: model:ir.model.fields,field_description:golem_activity_registration_custom_price.field_golem_activity_price_line___last_update +#: model:ir.model.fields,field_description:golem_activity_registration_custom_price.field_golem_payment_rule_familyquotient_slice___last_update +msgid "Last Modified on" +msgstr "Dernière Modification le" + +#. module: golem_activity_registration_custom_price +#: model:ir.model.fields,field_description:golem_activity_registration_custom_price.field_golem_activity_price_line_write_uid +#: model:ir.model.fields,field_description:golem_activity_registration_custom_price.field_golem_payment_rule_familyquotient_slice_write_uid +msgid "Last Updated by" +msgstr "Dernière mise à jour par" + +#. module: golem_activity_registration_custom_price +#: model:ir.model.fields,field_description:golem_activity_registration_custom_price.field_golem_activity_price_line_write_date +#: model:ir.model.fields,field_description:golem_activity_registration_custom_price.field_golem_payment_rule_familyquotient_slice_write_date +msgid "Last Updated on" +msgstr "Dernière mise à jour le" + +#. module: golem_activity_registration_custom_price +#: model:ir.model.fields,field_description:golem_activity_registration_custom_price.field_golem_payment_rule_familyquotient_slice_name +msgid "Name" +msgstr "Nom" + +#. module: golem_activity_registration_custom_price +#: model:ir.ui.view,arch_db:golem_activity_registration_custom_price.golem_activity_form_inherit_custom_price +msgid "Populates other / new options with default price" +msgstr "Alimenter les autres ou nouvelles options avec le tarif par défaut" + +#. module: golem_activity_registration_custom_price +#: model:ir.model.fields,field_description:golem_activity_registration_custom_price.field_golem_activity_price_line_price +msgid "Price" +msgstr "Prix" + +#. module: golem_activity_registration_custom_price +#: model:ir.model.fields,field_description:golem_activity_registration_custom_price.field_golem_activity_price_line_ids +msgid "Price lines" +msgstr "Lignes tarifaires" + +#. module: golem_activity_registration_custom_price +#: model:ir.ui.view,arch_db:golem_activity_registration_custom_price.golem_activity_form_inherit_custom_price +msgid "Prices" +msgstr "Tarifs" + +#. module: golem_activity_registration_custom_price +#: model:ir.ui.menu,name:golem_activity_registration_custom_price.golem_payment_rule_menu +msgid "Pricing rules" +msgstr "Règles tarifaires" + +#. module: golem_activity_registration_custom_price +#: model:ir.ui.view,arch_db:golem_activity_registration_custom_price.golem_activity_form_inherit_custom_price +msgid "Resets all options with default price" +msgstr "Réinitialiser toutes les options tarifaires avec le prix par défaut" + +#. module: golem_activity_registration_custom_price +#: model:ir.model.fields,field_description:golem_activity_registration_custom_price.field_golem_activity_registration_invoicing_line_activity_price +msgid "Sale Price" +msgstr "Prix de vente" + +#. module: golem_activity_registration_custom_price +#: model:ir.model.fields,field_description:golem_activity_registration_custom_price.field_golem_activity_price_line_area_sequence +msgid "Sequence" +msgstr "Séquence" + +#. module: golem_activity_registration_custom_price +#: code:addons/golem_activity_registration_custom_price/models/golem_payment_rule_quotient_slice.py:49 +#, python-format +msgid "The 'to' family quotient must be higher than the 'from' one." +msgstr "La borne haute du quotient familial doit être supérieur à la borne basse." + +#. module: golem_activity_registration_custom_price +#: code:addons/golem_activity_registration_custom_price/models/golem_activity_price_line.py:30 +#: sql_constraint:golem.activity.price.line:0 +#, python-format +msgid "This activity, geo rule, FQ slice rule has already been used." +msgstr "Cette activité, ce territoire et cette tranche QF ont déjà été renseignées." + +#. module: golem_activity_registration_custom_price +#: code:addons/golem_activity_registration_custom_price/models/golem_payment_rule_quotient_slice.py:31 +#: sql_constraint:golem.payment.rule.familyquotient.slice:0 +#, python-format +msgid "This name has already been used. It must be unique." +msgstr "Ce nom a déjà été utilisé. Il doit être unique." + diff --git a/golem_activity_registration_custom_price/i18n/golem_activity_registration_custom_price.pot b/golem_activity_registration_custom_price/i18n/golem_activity_registration_custom_price.pot new file mode 100644 index 0000000..03e4ecf --- /dev/null +++ b/golem_activity_registration_custom_price/i18n/golem_activity_registration_custom_price.pot @@ -0,0 +1,248 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * golem_activity_registration_custom_price +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 10.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2018-08-03 23:02+0000\n" +"PO-Revision-Date: 2018-08-03 23:02+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_activity_registration_custom_price +#: model:ir.model.fields,field_description:golem_activity_registration_custom_price.field_golem_activity_price_line_activity_id +msgid "Activity id" +msgstr "" + +#. module: golem_activity_registration_custom_price +#: model:ir.ui.view,arch_db:golem_activity_registration_custom_price.golem_activity_form_inherit_custom_price +msgid "Are you sure you want to RESET ALL options ?" +msgstr "" + +#. module: golem_activity_registration_custom_price +#: model:ir.ui.view,arch_db:golem_activity_registration_custom_price.golem_activity_form_inherit_custom_price +msgid "Are you sure you want to apply default price to all other options ?" +msgstr "" + +#. module: golem_activity_registration_custom_price +#: model:ir.model.fields,field_description:golem_activity_registration_custom_price.field_golem_activity_price_line_area_id +msgid "Area" +msgstr "" + +#. module: golem_activity_registration_custom_price +#: model:ir.ui.menu,name:golem_activity_registration_custom_price.golem_partner_area_menu +msgid "Areas" +msgstr "" + +#. module: golem_activity_registration_custom_price +#: model:ir.model.fields,help:golem_activity_registration_custom_price.field_golem_activity_registration_invoicing_line_activity_price +msgid "Base price to compute the customer price. Sometimes called the catalog price." +msgstr "" + +#. module: golem_activity_registration_custom_price +#: model:ir.model.fields,field_description:golem_activity_registration_custom_price.field_golem_activity_price_line_create_uid +#: model:ir.model.fields,field_description:golem_activity_registration_custom_price.field_golem_payment_rule_familyquotient_slice_create_uid +msgid "Created by" +msgstr "" + +#. module: golem_activity_registration_custom_price +#: model:ir.model.fields,field_description:golem_activity_registration_custom_price.field_golem_activity_price_line_create_date +#: model:ir.model.fields,field_description:golem_activity_registration_custom_price.field_golem_payment_rule_familyquotient_slice_create_date +msgid "Created on" +msgstr "" + +#. module: golem_activity_registration_custom_price +#: model:ir.model.fields,field_description:golem_activity_registration_custom_price.field_golem_activity_price_line_currency_id +#: model:ir.model.fields,field_description:golem_activity_registration_custom_price.field_golem_payment_rule_familyquotient_slice_currency_id +msgid "Currency id" +msgstr "" + +#. module: golem_activity_registration_custom_price +#: code:addons/golem_activity_registration_custom_price/models/golem_payment_rule_quotient_slice.py:66 +#, python-format +msgid "Current family quotient slice cannot be included into another existing slice." +msgstr "" + +#. module: golem_activity_registration_custom_price +#: code:addons/golem_activity_registration_custom_price/models/golem_member.py:29 +#: model:ir.ui.view,arch_db:golem_activity_registration_custom_price.golem_activity_registration_invoicing_form_inherit_custom_price +#, python-format +msgid "Default price" +msgstr "" + +#. module: golem_activity_registration_custom_price +#: model:ir.model.fields,field_description:golem_activity_registration_custom_price.field_golem_activity_price_line_display_name +#: model:ir.model.fields,field_description:golem_activity_registration_custom_price.field_golem_payment_rule_familyquotient_slice_display_name +msgid "Display Name" +msgstr "" + +#. module: golem_activity_registration_custom_price +#: model:ir.actions.act_window,name:golem_activity_registration_custom_price.golem_payment_rule_qfslice_action +#: model:ir.ui.menu,name:golem_activity_registration_custom_price.golem_payment_rule_qfslice_menu +msgid "Family Quotients" +msgstr "" + +#. module: golem_activity_registration_custom_price +#: code:addons/golem_activity_registration_custom_price/models/golem_member.py:61 +#, python-format +msgid "Family quotient and area" +msgstr "" + +#. module: golem_activity_registration_custom_price +#: code:addons/golem_activity_registration_custom_price/models/golem_member.py:59 +#, python-format +msgid "Family quotient but random area" +msgstr "" + +#. module: golem_activity_registration_custom_price +#: model:ir.model.fields,field_description:golem_activity_registration_custom_price.field_golem_payment_rule_familyquotient_slice_family_quotient_from +msgid "Family quotient from" +msgstr "" + +#. module: golem_activity_registration_custom_price +#: code:addons/golem_activity_registration_custom_price/models/golem_payment_rule_quotient_slice.py:56 +#, python-format +msgid "Family quotient from is in range of an existing slice." +msgstr "" + +#. module: golem_activity_registration_custom_price +#: model:ir.model.fields,field_description:golem_activity_registration_custom_price.field_golem_activity_price_line_slice_id +msgid "Family quotient slice" +msgstr "" + +#. module: golem_activity_registration_custom_price +#: model:ir.model.fields,field_description:golem_activity_registration_custom_price.field_golem_payment_rule_familyquotient_slice_family_quotient_to +msgid "Family quotient to" +msgstr "" + +#. module: golem_activity_registration_custom_price +#: code:addons/golem_activity_registration_custom_price/models/golem_payment_rule_quotient_slice.py:61 +#, python-format +msgid "Family quotient to is in range of an existing slice." +msgstr "" + +#. module: golem_activity_registration_custom_price +#: model:ir.model,name:golem_activity_registration_custom_price.model_golem_activity +msgid "GOLEM Activity" +msgstr "" + +#. module: golem_activity_registration_custom_price +#: model:ir.model,name:golem_activity_registration_custom_price.model_golem_activity_price_line +msgid "GOLEM Activity Price Line" +msgstr "" + +#. module: golem_activity_registration_custom_price +#: model:ir.model,name:golem_activity_registration_custom_price.model_golem_activity_registration_invoicing_line +msgid "GOLEM Activity Registration Invoicing Lines" +msgstr "" + +#. module: golem_activity_registration_custom_price +#: model:ir.model,name:golem_activity_registration_custom_price.model_golem_member +msgid "GOLEM Member" +msgstr "" + +#. module: golem_activity_registration_custom_price +#: model:ir.model,name:golem_activity_registration_custom_price.model_golem_payment_rule_familyquotient_slice +msgid "GOLEM Payment Rule Family Quotient Slice" +msgstr "" + +#. module: golem_activity_registration_custom_price +#: model:ir.model,name:golem_activity_registration_custom_price.model_golem_payment_rule_geo +msgid "GOLEM Payment Rule Geo" +msgstr "" + +#. module: golem_activity_registration_custom_price +#: model:ir.model.fields,field_description:golem_activity_registration_custom_price.field_golem_activity_price_line_id +#: model:ir.model.fields,field_description:golem_activity_registration_custom_price.field_golem_payment_rule_familyquotient_slice_id +msgid "ID" +msgstr "" + +#. module: golem_activity_registration_custom_price +#: model:ir.model.fields,field_description:golem_activity_registration_custom_price.field_golem_activity_price_line___last_update +#: model:ir.model.fields,field_description:golem_activity_registration_custom_price.field_golem_payment_rule_familyquotient_slice___last_update +msgid "Last Modified on" +msgstr "" + +#. module: golem_activity_registration_custom_price +#: model:ir.model.fields,field_description:golem_activity_registration_custom_price.field_golem_activity_price_line_write_uid +#: model:ir.model.fields,field_description:golem_activity_registration_custom_price.field_golem_payment_rule_familyquotient_slice_write_uid +msgid "Last Updated by" +msgstr "" + +#. module: golem_activity_registration_custom_price +#: model:ir.model.fields,field_description:golem_activity_registration_custom_price.field_golem_activity_price_line_write_date +#: model:ir.model.fields,field_description:golem_activity_registration_custom_price.field_golem_payment_rule_familyquotient_slice_write_date +msgid "Last Updated on" +msgstr "" + +#. module: golem_activity_registration_custom_price +#: model:ir.model.fields,field_description:golem_activity_registration_custom_price.field_golem_payment_rule_familyquotient_slice_name +msgid "Name" +msgstr "" + +#. module: golem_activity_registration_custom_price +#: model:ir.ui.view,arch_db:golem_activity_registration_custom_price.golem_activity_form_inherit_custom_price +msgid "Populates other / new options with default price" +msgstr "" + +#. module: golem_activity_registration_custom_price +#: model:ir.model.fields,field_description:golem_activity_registration_custom_price.field_golem_activity_price_line_price +msgid "Price" +msgstr "" + +#. module: golem_activity_registration_custom_price +#: model:ir.model.fields,field_description:golem_activity_registration_custom_price.field_golem_activity_price_line_ids +msgid "Price lines" +msgstr "" + +#. module: golem_activity_registration_custom_price +#: model:ir.ui.view,arch_db:golem_activity_registration_custom_price.golem_activity_form_inherit_custom_price +msgid "Prices" +msgstr "" + +#. module: golem_activity_registration_custom_price +#: model:ir.ui.menu,name:golem_activity_registration_custom_price.golem_payment_rule_menu +msgid "Pricing rules" +msgstr "" + +#. module: golem_activity_registration_custom_price +#: model:ir.ui.view,arch_db:golem_activity_registration_custom_price.golem_activity_form_inherit_custom_price +msgid "Resets all options with default price" +msgstr "" + +#. module: golem_activity_registration_custom_price +#: model:ir.model.fields,field_description:golem_activity_registration_custom_price.field_golem_activity_registration_invoicing_line_activity_price +msgid "Sale Price" +msgstr "" + +#. module: golem_activity_registration_custom_price +#: model:ir.model.fields,field_description:golem_activity_registration_custom_price.field_golem_activity_price_line_area_sequence +msgid "Sequence" +msgstr "" + +#. module: golem_activity_registration_custom_price +#: code:addons/golem_activity_registration_custom_price/models/golem_payment_rule_quotient_slice.py:49 +#, python-format +msgid "The 'to' family quotient must be higher than the 'from' one." +msgstr "" + +#. module: golem_activity_registration_custom_price +#: code:addons/golem_activity_registration_custom_price/models/golem_activity_price_line.py:30 +#: sql_constraint:golem.activity.price.line:0 +#, python-format +msgid "This activity, geo rule, FQ slice rule has already been used." +msgstr "" + +#. module: golem_activity_registration_custom_price +#: code:addons/golem_activity_registration_custom_price/models/golem_payment_rule_quotient_slice.py:31 +#: sql_constraint:golem.payment.rule.familyquotient.slice:0 +#, python-format +msgid "This name has already been used. It must be unique." +msgstr "" + diff --git a/golem_activity_registration_custom_price/models/__init__.py b/golem_activity_registration_custom_price/models/__init__.py new file mode 100644 index 0000000..d071027 --- /dev/null +++ b/golem_activity_registration_custom_price/models/__init__.py @@ -0,0 +1,19 @@ +# -*- coding: utf-8 -*- + +# Copyright 2018 Fabien Bourgeois +# +# 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 . + +from . import (golem_payment_rule_quotient_slice, golem_activity_price_line, + golem_activity, golem_member) diff --git a/golem_activity_registration_custom_price/models/golem_activity.py b/golem_activity_registration_custom_price/models/golem_activity.py new file mode 100644 index 0000000..d4ee2ee --- /dev/null +++ b/golem_activity_registration_custom_price/models/golem_activity.py @@ -0,0 +1,51 @@ +# -*- coding: utf-8 -*- + +# Copyright 2018 Fabien Bourgeois +# +# 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 . + +""" GOLEM Activity adaptations """ + +from odoo import models, fields, api + +class GolemActivity(models.Model): + """ GOLEM Activity adaptations """ + _inherit = 'golem.activity' + + price_line_ids = fields.One2many('golem.activity.price.line', + 'activity_id', string='Price lines') + + @api.multi + def reset_price_combinations(self): + """ Resets all combinations with default price """ + self.ensure_one() + activity = self[0] + activity.price_line_ids = [(6, False, [])] # Truncate existing + activity.fill_price_combinations() + + @api.multi + def fill_price_combinations(self): + """ Fills all inexistent combinations prices from default one """ + self.ensure_one() + activity = self[0] + existing_combinations = [u'%s-%s' % (line.area_id.id, line.slice_id.id) + for line in activity.price_line_ids] + slice_ids = self.env['golem.payment.rule.familyquotient.slice'].search([]) + for area_id in self.env['golem.partner.area'].search([]): + for slice_id in slice_ids: + combination = u'%s-%s' % (area_id.id, slice_id.id) + if combination not in existing_combinations: + data = {'activity_id': activity.id, 'area_id': area_id.id, + 'slice_id': slice_id.id, 'price': activity.list_price} + self.env['golem.activity.price.line'].create(data) diff --git a/golem_activity_registration_custom_price/models/golem_activity_price_line.py b/golem_activity_registration_custom_price/models/golem_activity_price_line.py new file mode 100644 index 0000000..d878f30 --- /dev/null +++ b/golem_activity_registration_custom_price/models/golem_activity_price_line.py @@ -0,0 +1,50 @@ +# -*- coding: utf-8 -*- + +# Copyright 2018 Fabien Bourgeois +# +# 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 . + +""" GOLEM Activity adaptations """ + +from odoo import models, fields, _ + + +class GolemActivityPriceLine(models.Model): + """ GOLEM Activity Price Line """ + _name = 'golem.activity.price.line' + _description = 'GOLEM Activity Price Line' + _order = 'activity_id asc, area_id asc, slice_id asc' + _sql_constraints = [( + 'golem_activity_price_line_uniq', 'UNIQUE (activity_id, area_id, slice_id)', + _('This activity, geo rule, FQ slice rule has already been used.') + )] + + activity_id = fields.Many2one( + 'golem.activity', required=True, index=True, auto_join=True, + ondelete='cascade' + ) + area_id = fields.Many2one( + 'golem.partner.area', index=True, auto_join=True, + string='Area', ondelete='cascade' + ) + area_sequence = fields.Integer(related='area_id.sequence') + slice_id = fields.Many2one( + 'golem.payment.rule.familyquotient.slice', index=True, auto_join=True, + string='Family quotient slice', ondelete='cascade' + ) + currency_id = fields.Many2one( + 'res.currency', + default=lambda self: self.env.user.company_id.currency_id.id + ) + price = fields.Monetary(required=True) diff --git a/golem_activity_registration_custom_price/models/golem_member.py b/golem_activity_registration_custom_price/models/golem_member.py new file mode 100644 index 0000000..1ce0130 --- /dev/null +++ b/golem_activity_registration_custom_price/models/golem_member.py @@ -0,0 +1,64 @@ +# -*- coding: utf-8 -*- + +# Copyright 2018 Fabien Bourgeois +# +# 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 . + +""" GOLEM Member adaptations """ + +from odoo import models, _ + +class GolemMember(models.Model): + """ GOLEM Member adaptations """ + _inherit = 'golem.member' + + def invoice_line_data_get(self, registration): + """ Overwrite parent method to inject price according to rules """ + line_data = super(GolemMember, self).invoice_line_data_get(registration) + line_data['pricing_info'] = _(u'Default price') + member = self[0] + if member.family_quotient: # default price if no QF + fq_int = int(member.family_quotient) + domain = [('family_quotient_from', '<=', fq_int), + ('family_quotient_to', '>=', fq_int)] + rule_slice_id = self.env['golem.payment.rule.familyquotient.slice'].search( + domain, limit=1 + ) + if rule_slice_id: # if not : default_price + applicable_areas = [] + area_ids = self.env['golem.partner.area'].search([]) + if member.area_id: + applicable_areas += area_ids.filtered( + lambda r: r == member.area_id + ) + if not applicable_areas and area_ids: + applicable_areas += area_ids[0] + random_area = True + else: + random_area = False + if applicable_areas: # else default_price + for applicable_area in applicable_areas: + domain = [('activity_id', '=', registration.activity_id.id), + ('area_id', '=', applicable_area.id), + ('slice_id', '=', rule_slice_id.id)] + price_line_obj = self.env['golem.activity.price.line'] + line_id = price_line_obj.search(domain, limit=1) + if line_id: # Found ! + line_data['price'] = line_id.price + pricing_info = (_(u'Family quotient but random area') + if random_area else + _(u'Family quotient and area')) + line_data['pricing_info'] = pricing_info + break + return line_data diff --git a/golem_activity_registration_custom_price/models/golem_payment_rule_quotient_slice.py b/golem_activity_registration_custom_price/models/golem_payment_rule_quotient_slice.py new file mode 100644 index 0000000..463d4bb --- /dev/null +++ b/golem_activity_registration_custom_price/models/golem_payment_rule_quotient_slice.py @@ -0,0 +1,68 @@ +# -*- coding: utf-8 -*- + +# Copyright 2018 Fabien Bourgeois +# +# 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 . + +""" GOLEM Payment Rule Family Quotient Slice """ + +from odoo import models, fields, api, _ +from odoo.exceptions import ValidationError + + +class GolemPaymentRuleQuotientSlice(models.Model): + """ GOLEM Payment Rule Family Quotient Slice """ + _name = 'golem.payment.rule.familyquotient.slice' + _description = 'GOLEM Payment Rule Family Quotient Slice' + _order = 'name asc' + _sql_constraints = [( + 'golem_payment_rule_fquoslice_uniq', 'UNIQUE (name)', + _('This name has already been used. It must be unique.') + )] + + name = fields.Char(required=True) + currency_id = fields.Many2one( + 'res.currency', + default=lambda self: self.env.user.company_id.currency_id.id + ) + family_quotient_from = fields.Monetary() + family_quotient_to = fields.Monetary() + + @api.constrains('family_quotient_from', 'family_quotient_to') + def check_fq(self): + """ Check family quotient coherence and conflits """ + for rqf in self: + if rqf.family_quotient_from: + if (not rqf.family_quotient_to or + rqf.family_quotient_to < rqf.family_quotient_from): + verr = _('The \'to\' family quotient must be higher than ' + 'the \'from\' one.') + raise ValidationError(verr) + rqfs = self.env['golem.payment.rule.familyquotient.slice'].search([]) + for eachr in rqfs: + if (eachr.family_quotient_from < rqf.family_quotient_from < + eachr.family_quotient_to): + verr = _(u'Family quotient from is in range of an ' + 'existing slice.') + raise ValidationError(verr) + if (eachr.family_quotient_from < rqf.family_quotient_to < + eachr.family_quotient_to): + verr = _(u'Family quotient to is in range of an ' + 'existing slice.') + raise ValidationError(verr) + if (rqf.family_quotient_from < eachr.family_quotient_from < + rqf.family_quotient_to): + verr = _(u'Current family quotient slice cannot be ' + 'included into another existing slice.') + raise ValidationError(verr) diff --git a/golem_activity_registration_custom_price/security/ir.model.access.csv b/golem_activity_registration_custom_price/security/ir.model.access.csv new file mode 100644 index 0000000..113514e --- /dev/null +++ b/golem_activity_registration_custom_price/security/ir.model.access.csv @@ -0,0 +1,7 @@ +id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink +access_golem_payment_rule_geo_user,Access GOLEM Payment Rule ZIP User,model_golem_payment_rule_geo,golem_base.group_golem_user,1,0,0,0 +access_golem_payment_rule_geo_manager,Access GOLEM Payment Rule ZIP Manager,model_golem_payment_rule_geo,golem_base.group_golem_manager,1,1,1,1 +access_golem_payment_rule_familyquotient_slice_user,Access GOLEM Payment Rule Familyquotient Slice User,model_golem_payment_rule_familyquotient_slice,golem_base.group_golem_user,1,0,0,0 +access_golem_payment_rule_familyquotient_slice_manager,Access GOLEM Payment Rule Familyquotient Slice Manager,model_golem_payment_rule_familyquotient_slice,golem_base.group_golem_manager,0,1,1,1 +access_golem_activity_priceline_user,Access GOLEM Activity Price Line User,model_golem_activity_price_line,golem_base.group_golem_user,1,0,0,0 +access_golem_activity_priceline_manager,Access GOLEM Activity Price Line Manager,model_golem_activity_price_line,golem_base.group_golem_manager,1,1,1,1 diff --git a/golem_activity_registration_custom_price/views/golem_activity_views.xml b/golem_activity_registration_custom_price/views/golem_activity_views.xml new file mode 100644 index 0000000..a949c42 --- /dev/null +++ b/golem_activity_registration_custom_price/views/golem_activity_views.xml @@ -0,0 +1,55 @@ + + + + + + + + + GOLEM Activity Adaptations + golem.activity + + + + +