Browse Source

[ADD]GOLEM Activity Registration Custom Price new module

See manifest for description
Duplication_acitvite
Fabien BOURGEOIS 2 years ago
parent
commit
f1aa568e78
16 changed files with 1054 additions and 0 deletions
  1. +18
    -0
      golem_activity_registration_custom_price/__init__.py
  2. +40
    -0
      golem_activity_registration_custom_price/__manifest__.py
  3. +248
    -0
      golem_activity_registration_custom_price/i18n/fr.po
  4. +248
    -0
      golem_activity_registration_custom_price/i18n/golem_activity_registration_custom_price.pot
  5. +19
    -0
      golem_activity_registration_custom_price/models/__init__.py
  6. +51
    -0
      golem_activity_registration_custom_price/models/golem_activity.py
  7. +50
    -0
      golem_activity_registration_custom_price/models/golem_activity_price_line.py
  8. +64
    -0
      golem_activity_registration_custom_price/models/golem_member.py
  9. +68
    -0
      golem_activity_registration_custom_price/models/golem_payment_rule_quotient_slice.py
  10. +7
    -0
      golem_activity_registration_custom_price/security/ir.model.access.csv
  11. +55
    -0
      golem_activity_registration_custom_price/views/golem_activity_views.xml
  12. +35
    -0
      golem_activity_registration_custom_price/views/golem_member_views.xml
  13. +65
    -0
      golem_activity_registration_custom_price/views/golem_payment_rule_quotient_slice_views.xml
  14. +18
    -0
      golem_activity_registration_custom_price/wizard/__init__.py
  15. +27
    -0
      golem_activity_registration_custom_price/wizard/golem_activity_registration_invoicing.py
  16. +41
    -0
      golem_activity_registration_custom_price/wizard/golem_activity_registration_invoicing_views.xml

+ 18
- 0
golem_activity_registration_custom_price/__init__.py View File

@ -0,0 +1,18 @@
# -*- coding: utf-8 -*-
# Copyright 2018 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, wizard

+ 40
- 0
golem_activity_registration_custom_price/__manifest__.py View File

@ -0,0 +1,40 @@
# -*- coding: utf-8 -*-
# Copyright 2018 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 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']
}

+ 248
- 0
golem_activity_registration_custom_price/i18n/fr.po View File

@ -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."

+ 248
- 0
golem_activity_registration_custom_price/i18n/golem_activity_registration_custom_price.pot View File

@ -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 ""

+ 19
- 0
golem_activity_registration_custom_price/models/__init__.py View File

@ -0,0 +1,19 @@
# -*- coding: utf-8 -*-
# Copyright 2018 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_payment_rule_quotient_slice, golem_activity_price_line,
golem_activity, golem_member)

+ 51
- 0
golem_activity_registration_custom_price/models/golem_activity.py View File

@ -0,0 +1,51 @@
# -*- coding: utf-8 -*-
# Copyright 2018 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/>.
""" 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)

+ 50
- 0
golem_activity_registration_custom_price/models/golem_activity_price_line.py View File

@ -0,0 +1,50 @@
# -*- coding: utf-8 -*-
# Copyright 2018 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/>.
""" 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)

+ 64
- 0
golem_activity_registration_custom_price/models/golem_member.py View File

@ -0,0 +1,64 @@
# -*- coding: utf-8 -*-
# Copyright 2018 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/>.
""" 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

+ 68
- 0
golem_activity_registration_custom_price/models/golem_payment_rule_quotient_slice.py View File

@ -0,0 +1,68 @@
# -*- coding: utf-8 -*-
# Copyright 2018 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/>.
""" 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)

+ 7
- 0
golem_activity_registration_custom_price/security/ir.model.access.csv View File

@ -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

+ 55
- 0
golem_activity_registration_custom_price/views/golem_activity_views.xml View File

@ -0,0 +1,55 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright 2018 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/>.
-->
<odoo>
<data>
<!-- Form -->
<record id="golem_activity_form_inherit_custom_price" model="ir.ui.view">
<field name="name">GOLEM Activity Adaptations</field>
<field name="model">golem.activity</field>
<field name="inherit_id" ref="golem_activity.golem_activity_form" />
<field name="arch" type="xml">
<group name="properties" position="before">
<group name="prices" string="Prices">
<button name="fill_price_combinations" type="object" class="oe_link"
string="Populates other / new options with default price" colspan="1"
confirm="Are you sure you want to apply default price to all other options ?" />
<button name="reset_price_combinations" type="object" class="oe_link"
string="Resets all options with default price" colspan="1"
confirm="Are you sure you want to RESET ALL options ?" />
<field name="price_line_ids" nolabel="1" colspan="2"
context="{'default_activity_id': active_id}"
widget="x2many_2d_matrix"
field_y_axis="slice_id" field_x_axis="area_id" field_value="price">
<tree default_order="area_sequence asc">
<field name="activity_id" invisible="1" />
<field name="currency_id" invisible="1" />
<field name="area_id" />
<field name="area_sequence" invisible="1" />
<field name="slice_id" />
<field name="price" />
</tree>
</field>
</group>
</group>
</field>
</record>
</data>
</odoo>

+ 35
- 0
golem_activity_registration_custom_price/views/golem_member_views.xml View File

@ -0,0 +1,35 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright 2018 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/>.
-->
<odoo>
<data>
<!-- Form -->
<record id="golem_member_form_inherit_custom_price" model="ir.ui.view">
<field name="name">GOLEM Member Adaptations</field>
<field name="model">golem.member</field>
<field name="inherit_id" ref="golem_member.golem_member_form" />
<field name="arch" type="xml">
<field name="area_id" position="attributes">
<attribute name="required">1</attribute>
</field>
</field>
</record>
</data>
</odoo>

+ 65
- 0
golem_activity_registration_custom_price/views/golem_payment_rule_quotient_slice_views.xml View File

@ -0,0 +1,65 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright 2018 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/>.
-->
<odoo>
<data>
<!-- Tree -->
<record model="ir.ui.view" id="golem_payment_rule_qfslice_view_tree">
<field name="name">GOLEM Payment Rule QF Slice Tree</field>
<field name="model">golem.payment.rule.familyquotient.slice</field>
<field name="arch" type="xml">
<tree editable="bottom">
<field name="name" />
<field name="currency_id" invisible="1" />
<field name="family_quotient_from" />
<field name="family_quotient_to" />
</tree>
</field>
</record>
<!-- Search -->
<record model="ir.ui.view" id="golem_payment_rule_qfslice_view_search">
<field name="name">GOLEM Payment Rule QF Slice Search</field>
<field name="model">golem.payment.rule.familyquotient.slice</field>
<field name="arch" type="xml">
<search>
<field name="name" />
</search>
</field>
</record>
<!-- Actions -->
<act_window id="golem_payment_rule_qfslice_action"
name="Family Quotients" view_mode="tree"
res_model="golem.payment.rule.familyquotient.slice" />
<!-- Menus -->
<menuitem id="golem_payment_rule_menu" name="Pricing rules"
parent="golem_activity.golem_activity_menu_configuration"
groups="golem_base.group_golem_manager" sequence="20" />
<menuitem id="golem_payment_rule_qfslice_menu" name="Family Quotients"
parent="golem_payment_rule_menu" action="golem_payment_rule_qfslice_action"
sequence="10" />
<menuitem id="golem_partner_area_menu" name="Areas"
parent="golem_payment_rule_menu" sequence="20"
action="golem_member.golem_partner_area_action" />
</data>
</odoo>

+ 18
- 0
golem_activity_registration_custom_price/wizard/__init__.py View File

@ -0,0 +1,18 @@
# -*- coding: utf-8 -*-
# Copyright 2018 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_activity_registration_invoicing

+ 27
- 0
golem_activity_registration_custom_price/wizard/golem_activity_registration_invoicing.py View File

@ -0,0 +1,27 @@
# -*- coding: utf-8 -*-
# Copyright 2018 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/>.
""" GOLEM Activity Registration Invoicing Wizard """
from odoo import models, fields
class GolemActivityRegistrationInvoicingLine(models.TransientModel):
""" GOLEM Activity Registration Invoicing Line adaptations """
_inherit = 'golem.activity.registration.invoicing.line'
pricing_info = fields.Char()
activity_price = fields.Float(related='activity_id.product_id.list_price')

+ 41
- 0
golem_activity_registration_custom_price/wizard/golem_activity_registration_invoicing_views.xml View File

@ -0,0 +1,41 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright 2018 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/>.
-->
<odoo>
<data>
<!-- Form -->
<record id="golem_activity_registration_invoicing_form_inherit_custom_price"
model="ir.ui.view">
<field name="name">GOLEM Activity Registration Invoicing Form adaptations</field>
<field name="model">golem.activity.registration.invoicing</field>
<field name="inherit_id"
ref="golem_activity_registration_payment.golem_activity_registration_invoicing_view_form" />
<field name="arch" type="xml">
<field name="price" position="before">
<field name="activity_price" readonly="1" string="Default price" />
</field>
<field name="price" position="after">
<field name="pricing_info" readonly="1" />
</field>
</field>
</record>
</data>
</odoo>

Loading…
Cancel
Save