diff --git a/base_global_discount/README.rst b/base_global_discount/README.rst new file mode 100644 index 000000000..17cbdba7d --- /dev/null +++ b/base_global_discount/README.rst @@ -0,0 +1,102 @@ +==================== +Base Global Discount +==================== + +.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! This file is generated by oca-gen-addon-readme !! + !! changes will be overwritten. !! + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png + :target: https://odoo-community.org/page/development-status + :alt: Beta +.. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png + :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html + :alt: License: AGPL-3 +.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fserver--backend-lightgray.png?logo=github + :target: https://github.com/OCA/server-backend/tree/13.0/base_global_discount + :alt: OCA/server-backend +.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png + :target: https://translation.odoo-community.org/projects/server-backend-13-0/server-backend-13-0-base_global_discount + :alt: Translate me on Weblate +.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png + :target: https://runbot.odoo-community.org/runbot/253/13.0 + :alt: Try me on Runbot + +|badge1| |badge2| |badge3| |badge4| |badge5| + +Base module to have global discounts applied to either sales or purchases. It +doesn't do much for itself, so account_global_discount or +purchase_global_discount should be installed to benefit from it. + +**Table of contents** + +.. contents:: + :local: + +Configuration +============= + +To use this module, you need to: + +#. Go to *Settings > Users*, choose yours and set *Manage Global Discounts*. +#. Go to *Settings > Parameters > Global Discounts* +#. Choose the discount scope (sales or purchases). +#. You can also restrict it to a certain company if needed. + +Usage +===== + +You can assign global discounts to partners as well. You'll need the proper +permission (*Manage Global Discounts*): + +#. Go to a partner that is a company. +#. Go to the *Sales & Purchases* tab. +#. In section sale, you can set sale discounts. +#. In section purchase, you can set purchase discounts. + +Bug Tracker +=========== + +Bugs are tracked on `GitHub Issues `_. +In case of trouble, please check there if your issue has already been reported. +If you spotted it first, help us smashing it by providing a detailed and welcomed +`feedback `_. + +Do not contact contributors directly about support or help with technical issues. + +Credits +======= + +Authors +~~~~~~~ + +* Tecnativa + +Contributors +~~~~~~~~~~~~ + +* `Tecnativa `_ + + * Pedro M. Baeza + * David Vidal + * Carlos Dauden + * Rafael Blasco + * Ernesto Tejeda + +Maintainers +~~~~~~~~~~~ + +This module is maintained by the OCA. + +.. image:: https://odoo-community.org/logo.png + :alt: Odoo Community Association + :target: https://odoo-community.org + +OCA, or the Odoo Community Association, is a nonprofit organization whose +mission is to support the collaborative development of Odoo features and +promote its widespread use. + +This module is part of the `OCA/server-backend `_ project on GitHub. + +You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/base_global_discount/__init__.py b/base_global_discount/__init__.py new file mode 100644 index 000000000..0650744f6 --- /dev/null +++ b/base_global_discount/__init__.py @@ -0,0 +1 @@ +from . import models diff --git a/base_global_discount/__manifest__.py b/base_global_discount/__manifest__.py new file mode 100644 index 000000000..e277717e4 --- /dev/null +++ b/base_global_discount/__manifest__.py @@ -0,0 +1,20 @@ +# Copyright 2019 Tecnativa S.L. - David Vidal +# Copyright 2020 Xtendoo - Manuel Calero +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). +{ + "name": "Base Global Discount", + "version": "14.0.1.0.0", + "category": "Base", + "author": "Tecnativa, Odoo Community Association (OCA)", + "website": "https://github.com/OCA/server-backend", + "license": "AGPL-3", + "depends": ["product"], + "data": [ + "security/security.xml", + "security/ir.model.access.csv", + "views/global_discount_views.xml", + "views/res_partner_views.xml", + ], + "application": False, + "installable": True, +} diff --git a/base_global_discount/i18n/base_global_discount.pot b/base_global_discount/i18n/base_global_discount.pot new file mode 100644 index 000000000..52e6ea435 --- /dev/null +++ b/base_global_discount/i18n/base_global_discount.pot @@ -0,0 +1,138 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * base_global_discount +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 13.0\n" +"Report-Msgid-Bugs-To: \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: base_global_discount +#: model:ir.model.fields,field_description:base_global_discount.field_global_discount__company_id +msgid "Company" +msgstr "" + +#. module: base_global_discount +#: model:ir.model,name:base_global_discount.model_res_partner +msgid "Contact" +msgstr "" + +#. module: base_global_discount +#: model:ir.model.fields,field_description:base_global_discount.field_global_discount__create_uid +msgid "Created by" +msgstr "" + +#. module: base_global_discount +#: model:ir.model.fields,field_description:base_global_discount.field_global_discount__create_date +msgid "Created on" +msgstr "" + +#. module: base_global_discount +#: model:ir.model.fields,field_description:base_global_discount.field_global_discount__discount +msgid "Discount" +msgstr "" + +#. module: base_global_discount +#: model:ir.model.fields,field_description:base_global_discount.field_global_discount__name +msgid "Discount Name" +msgstr "" + +#. module: base_global_discount +#: model:ir.model.fields,field_description:base_global_discount.field_global_discount__discount_scope +msgid "Discount Scope" +msgstr "" + +#. module: base_global_discount +#: model:ir.model.fields,field_description:base_global_discount.field_global_discount__display_name +msgid "Display Name" +msgstr "" + +#. module: base_global_discount +#: model:ir.model.fields,help:base_global_discount.field_global_discount__sequence +msgid "Gives the order to apply discounts" +msgstr "" + +#. module: base_global_discount +#: model:ir.model,name:base_global_discount.model_global_discount +msgid "Global Discount" +msgstr "" + +#. module: base_global_discount +#: model:ir.actions.act_window,name:base_global_discount.action_global_discount_tree +#: model:ir.ui.menu,name:base_global_discount.menu_global_discount +#: model_terms:ir.ui.view,arch_db:base_global_discount.global_discount_view_form +#: model_terms:ir.ui.view,arch_db:base_global_discount.global_discount_view_tree +msgid "Global Discounts" +msgstr "" + +#. module: base_global_discount +#: model:ir.model.fields,field_description:base_global_discount.field_global_discount__id +msgid "ID" +msgstr "" + +#. module: base_global_discount +#: model:ir.model.fields,field_description:base_global_discount.field_global_discount____last_update +msgid "Last Modified on" +msgstr "" + +#. module: base_global_discount +#: model:ir.model.fields,field_description:base_global_discount.field_global_discount__write_uid +msgid "Last Updated by" +msgstr "" + +#. module: base_global_discount +#: model:ir.model.fields,field_description:base_global_discount.field_global_discount__write_date +msgid "Last Updated on" +msgstr "" + +#. module: base_global_discount +#: model:res.groups,name:base_global_discount.group_global_discount +msgid "Manage Global Discounts" +msgstr "" + +#. module: base_global_discount +#: model:ir.model.fields,field_description:base_global_discount.field_res_partner__supplier_global_discount_ids +#: model:ir.model.fields,field_description:base_global_discount.field_res_users__supplier_global_discount_ids +#: model_terms:ir.ui.view,arch_db:base_global_discount.res_partner_form_view +msgid "Purchase Global Discounts" +msgstr "" + +#. module: base_global_discount +#: model:ir.model.fields,field_description:base_global_discount.field_res_partner__supplier_global_discount_ids_readonly +#: model:ir.model.fields,field_description:base_global_discount.field_res_users__supplier_global_discount_ids_readonly +msgid "Purchase Global Discounts (readonly)" +msgstr "" + +#. module: base_global_discount +#: model:ir.model.fields.selection,name:base_global_discount.selection__global_discount__discount_scope__purchase +msgid "Purchases" +msgstr "" + +#. module: base_global_discount +#: model:ir.model.fields,field_description:base_global_discount.field_res_partner__customer_global_discount_ids +#: model:ir.model.fields,field_description:base_global_discount.field_res_users__customer_global_discount_ids +#: model_terms:ir.ui.view,arch_db:base_global_discount.res_partner_form_view +msgid "Sale Global Discounts" +msgstr "" + +#. module: base_global_discount +#: model:ir.model.fields,field_description:base_global_discount.field_res_partner__customer_global_discount_ids_readonly +#: model:ir.model.fields,field_description:base_global_discount.field_res_users__customer_global_discount_ids_readonly +msgid "Sale Global Discounts (readonly)" +msgstr "" + +#. module: base_global_discount +#: model:ir.model.fields.selection,name:base_global_discount.selection__global_discount__discount_scope__sale +msgid "Sales" +msgstr "" + +#. module: base_global_discount +#: model:ir.model.fields,field_description:base_global_discount.field_global_discount__sequence +msgid "Sequence" +msgstr "" diff --git a/base_global_discount/i18n/es.po b/base_global_discount/i18n/es.po new file mode 100644 index 000000000..4d3bb2bf5 --- /dev/null +++ b/base_global_discount/i18n/es.po @@ -0,0 +1,141 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * base_global_discount +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 11.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2019-08-23 06:22+0000\n" +"PO-Revision-Date: 2019-08-23 06:22+0000\n" +"Last-Translator: <>\n" +"Language-Team: \n" +"Language: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: \n" + +#. module: base_global_discount +#: model:ir.model.fields,field_description:base_global_discount.field_global_discount__company_id +msgid "Company" +msgstr "Compañía" + +#. module: base_global_discount +#: model:ir.model,name:base_global_discount.model_res_partner +msgid "Contact" +msgstr "Contacto" + +#. module: base_global_discount +#: model:ir.model.fields,field_description:base_global_discount.field_global_discount__create_uid +msgid "Created by" +msgstr "Creado por" + +#. module: base_global_discount +#: model:ir.model.fields,field_description:base_global_discount.field_global_discount__create_date +msgid "Created on" +msgstr "Creado el" + +#. module: base_global_discount +#: model:ir.model.fields,field_description:base_global_discount.field_global_discount__discount +msgid "Discount" +msgstr "Descuento" + +#. module: base_global_discount +#: model:ir.model.fields,field_description:base_global_discount.field_global_discount__name +msgid "Discount Name" +msgstr "Nombre del descuento" + +#. module: base_global_discount +#: model:ir.model.fields,field_description:base_global_discount.field_global_discount__discount_scope +msgid "Discount Scope" +msgstr "Ámbito del descuento" + +#. module: base_global_discount +#: model:ir.model.fields,field_description:base_global_discount.field_global_discount__display_name +msgid "Display Name" +msgstr "Nombre mostrado" + +#. module: base_global_discount +#: model:ir.model.fields,help:base_global_discount.field_global_discount__sequence +msgid "Gives the order to apply discounts" +msgstr "Orden en el que se aplicarán los descuentos" + +#. module: base_global_discount +#: model:ir.model,name:base_global_discount.model_global_discount +msgid "Global Discount" +msgstr "Descuento Global" + +#. module: base_global_discount +#: model:ir.actions.act_window,name:base_global_discount.action_global_discount_tree +#: model:ir.ui.menu,name:base_global_discount.menu_global_discount +#: model_terms:ir.ui.view,arch_db:base_global_discount.global_discount_view_form +#: model_terms:ir.ui.view,arch_db:base_global_discount.global_discount_view_tree +msgid "Global Discounts" +msgstr "Descuentos Globales" + +#. module: base_global_discount +#: model:ir.model.fields,field_description:base_global_discount.field_global_discount__id +msgid "ID" +msgstr "ID" + +#. module: base_global_discount +#: model:ir.model.fields,field_description:base_global_discount.field_global_discount____last_update +msgid "Last Modified on" +msgstr "Última Modificación en" + +#. module: base_global_discount +#: model:ir.model.fields,field_description:base_global_discount.field_global_discount__write_uid +msgid "Last Updated by" +msgstr "Última Actualización por" + +#. module: base_global_discount +#: model:ir.model.fields,field_description:base_global_discount.field_global_discount__write_date +msgid "Last Updated on" +msgstr "Última Actualización el" + +#. module: base_global_discount +#: model:res.groups,name:base_global_discount.group_global_discount +msgid "Manage Global Discounts" +msgstr "" + +#. module: base_global_discount +#: model:ir.model.fields,field_description:base_global_discount.field_res_partner__supplier_global_discount_ids +#: model:ir.model.fields,field_description:base_global_discount.field_res_users__supplier_global_discount_ids +#: model_terms:ir.ui.view,arch_db:base_global_discount.res_partner_form_view +msgid "Purchase Global Discounts" +msgstr "Descuentos globales de compra" + +#. module: base_global_discount +#: model:ir.model.fields,field_description:base_global_discount.field_res_partner__supplier_global_discount_ids_readonly +#: model:ir.model.fields,field_description:base_global_discount.field_res_users__supplier_global_discount_ids_readonly +msgid "Purchase Global Discounts (readonly)" +msgstr "" + +#. module: base_global_discount +#: model:ir.model.fields.selection,name:base_global_discount.selection__global_discount__discount_scope__purchase +msgid "Purchases" +msgstr "Compras" + +#. module: base_global_discount +#: model:ir.model.fields,field_description:base_global_discount.field_res_partner__customer_global_discount_ids +#: model:ir.model.fields,field_description:base_global_discount.field_res_users__customer_global_discount_ids +#: model_terms:ir.ui.view,arch_db:base_global_discount.res_partner_form_view +msgid "Sale Global Discounts" +msgstr "Descuentos de venta globales" + +#. module: base_global_discount +#: model:ir.model.fields,field_description:base_global_discount.field_res_partner__customer_global_discount_ids_readonly +#: model:ir.model.fields,field_description:base_global_discount.field_res_users__customer_global_discount_ids_readonly +msgid "Sale Global Discounts (readonly)" +msgstr "" + +#. module: base_global_discount +#: model:ir.model.fields.selection,name:base_global_discount.selection__global_discount__discount_scope__sale +msgid "Sales" +msgstr "Ventas" + +#. module: base_global_discount +#: model:ir.model.fields,field_description:base_global_discount.field_global_discount__sequence +msgid "Sequence" +msgstr "Secuencia" diff --git a/base_global_discount/i18n/nl_NL.po b/base_global_discount/i18n/nl_NL.po new file mode 100644 index 000000000..212098ffe --- /dev/null +++ b/base_global_discount/i18n/nl_NL.po @@ -0,0 +1,141 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * base_global_discount +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 13.0\n" +"Report-Msgid-Bugs-To: \n" +"PO-Revision-Date: 2021-01-29 11:44+0000\n" +"Last-Translator: Cas Vissers \n" +"Language-Team: none\n" +"Language: nl_NL\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: nplurals=2; plural=n != 1;\n" +"X-Generator: Weblate 4.3.2\n" + +#. module: base_global_discount +#: model:ir.model.fields,field_description:base_global_discount.field_global_discount__company_id +msgid "Company" +msgstr "Bedrijf" + +#. module: base_global_discount +#: model:ir.model,name:base_global_discount.model_res_partner +msgid "Contact" +msgstr "Contact" + +#. module: base_global_discount +#: model:ir.model.fields,field_description:base_global_discount.field_global_discount__create_uid +msgid "Created by" +msgstr "Aangemaakt door" + +#. module: base_global_discount +#: model:ir.model.fields,field_description:base_global_discount.field_global_discount__create_date +msgid "Created on" +msgstr "Aangemaakt op" + +#. module: base_global_discount +#: model:ir.model.fields,field_description:base_global_discount.field_global_discount__discount +msgid "Discount" +msgstr "Korting" + +#. module: base_global_discount +#: model:ir.model.fields,field_description:base_global_discount.field_global_discount__name +msgid "Discount Name" +msgstr "Kortingsnaam" + +#. module: base_global_discount +#: model:ir.model.fields,field_description:base_global_discount.field_global_discount__discount_scope +msgid "Discount Scope" +msgstr "Kortingsbereik" + +#. module: base_global_discount +#: model:ir.model.fields,field_description:base_global_discount.field_global_discount__display_name +msgid "Display Name" +msgstr "Schermnaam" + +#. module: base_global_discount +#: model:ir.model.fields,help:base_global_discount.field_global_discount__sequence +msgid "Gives the order to apply discounts" +msgstr "Geeft de opdracht om kortingen toe te passen" + +#. module: base_global_discount +#: model:ir.model,name:base_global_discount.model_global_discount +msgid "Global Discount" +msgstr "Algemene korting" + +#. module: base_global_discount +#: model:ir.actions.act_window,name:base_global_discount.action_global_discount_tree +#: model:ir.ui.menu,name:base_global_discount.menu_global_discount +#: model_terms:ir.ui.view,arch_db:base_global_discount.global_discount_view_form +#: model_terms:ir.ui.view,arch_db:base_global_discount.global_discount_view_tree +msgid "Global Discounts" +msgstr "Algemene korting" + +#. module: base_global_discount +#: model:ir.model.fields,field_description:base_global_discount.field_global_discount__id +msgid "ID" +msgstr "ID" + +#. module: base_global_discount +#: model:ir.model.fields,field_description:base_global_discount.field_global_discount____last_update +msgid "Last Modified on" +msgstr "Laatst gewijzigd op" + +#. module: base_global_discount +#: model:ir.model.fields,field_description:base_global_discount.field_global_discount__write_uid +msgid "Last Updated by" +msgstr "Laatst bijgewerkt door" + +#. module: base_global_discount +#: model:ir.model.fields,field_description:base_global_discount.field_global_discount__write_date +msgid "Last Updated on" +msgstr "Laatst bijgewerkt op" + +#. module: base_global_discount +#: model:res.groups,name:base_global_discount.group_global_discount +msgid "Manage Global Discounts" +msgstr "" + +#. module: base_global_discount +#: model:ir.model.fields,field_description:base_global_discount.field_res_partner__supplier_global_discount_ids +#: model:ir.model.fields,field_description:base_global_discount.field_res_users__supplier_global_discount_ids +#: model_terms:ir.ui.view,arch_db:base_global_discount.res_partner_form_view +msgid "Purchase Global Discounts" +msgstr "Algemene inkoopkorting" + +#. module: base_global_discount +#: model:ir.model.fields,field_description:base_global_discount.field_res_partner__supplier_global_discount_ids_readonly +#: model:ir.model.fields,field_description:base_global_discount.field_res_users__supplier_global_discount_ids_readonly +msgid "Purchase Global Discounts (readonly)" +msgstr "" + +#. module: base_global_discount +#: model:ir.model.fields.selection,name:base_global_discount.selection__global_discount__discount_scope__purchase +msgid "Purchases" +msgstr "Inkopen" + +#. module: base_global_discount +#: model:ir.model.fields,field_description:base_global_discount.field_res_partner__customer_global_discount_ids +#: model:ir.model.fields,field_description:base_global_discount.field_res_users__customer_global_discount_ids +#: model_terms:ir.ui.view,arch_db:base_global_discount.res_partner_form_view +msgid "Sale Global Discounts" +msgstr "Algemene verkoopkorting" + +#. module: base_global_discount +#: model:ir.model.fields,field_description:base_global_discount.field_res_partner__customer_global_discount_ids_readonly +#: model:ir.model.fields,field_description:base_global_discount.field_res_users__customer_global_discount_ids_readonly +msgid "Sale Global Discounts (readonly)" +msgstr "" + +#. module: base_global_discount +#: model:ir.model.fields.selection,name:base_global_discount.selection__global_discount__discount_scope__sale +msgid "Sales" +msgstr "Verkoop" + +#. module: base_global_discount +#: model:ir.model.fields,field_description:base_global_discount.field_global_discount__sequence +msgid "Sequence" +msgstr "Volgorde" diff --git a/base_global_discount/i18n/pt.po b/base_global_discount/i18n/pt.po new file mode 100644 index 000000000..73ed8a20b --- /dev/null +++ b/base_global_discount/i18n/pt.po @@ -0,0 +1,141 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * base_global_discount +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 12.0\n" +"Report-Msgid-Bugs-To: \n" +"PO-Revision-Date: 2020-09-17 13:00+0000\n" +"Last-Translator: Pedro Castro Silva \n" +"Language-Team: none\n" +"Language: pt\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: nplurals=2; plural=n > 1;\n" +"X-Generator: Weblate 3.10\n" + +#. module: base_global_discount +#: model:ir.model.fields,field_description:base_global_discount.field_global_discount__company_id +msgid "Company" +msgstr "Empresa" + +#. module: base_global_discount +#: model:ir.model,name:base_global_discount.model_res_partner +msgid "Contact" +msgstr "Contacto" + +#. module: base_global_discount +#: model:ir.model.fields,field_description:base_global_discount.field_global_discount__create_uid +msgid "Created by" +msgstr "Criado por" + +#. module: base_global_discount +#: model:ir.model.fields,field_description:base_global_discount.field_global_discount__create_date +msgid "Created on" +msgstr "Criado em" + +#. module: base_global_discount +#: model:ir.model.fields,field_description:base_global_discount.field_global_discount__discount +msgid "Discount" +msgstr "Desconto" + +#. module: base_global_discount +#: model:ir.model.fields,field_description:base_global_discount.field_global_discount__name +msgid "Discount Name" +msgstr "Nome do Desconto" + +#. module: base_global_discount +#: model:ir.model.fields,field_description:base_global_discount.field_global_discount__discount_scope +msgid "Discount Scope" +msgstr "Âmbito do Desconto" + +#. module: base_global_discount +#: model:ir.model.fields,field_description:base_global_discount.field_global_discount__display_name +msgid "Display Name" +msgstr "Nome a Apresentar" + +#. module: base_global_discount +#: model:ir.model.fields,help:base_global_discount.field_global_discount__sequence +msgid "Gives the order to apply discounts" +msgstr "Dá a ordem de aplicação de descontos" + +#. module: base_global_discount +#: model:ir.model,name:base_global_discount.model_global_discount +msgid "Global Discount" +msgstr "Desconto Global" + +#. module: base_global_discount +#: model:ir.actions.act_window,name:base_global_discount.action_global_discount_tree +#: model:ir.ui.menu,name:base_global_discount.menu_global_discount +#: model_terms:ir.ui.view,arch_db:base_global_discount.global_discount_view_form +#: model_terms:ir.ui.view,arch_db:base_global_discount.global_discount_view_tree +msgid "Global Discounts" +msgstr "Descontos Globais" + +#. module: base_global_discount +#: model:ir.model.fields,field_description:base_global_discount.field_global_discount__id +msgid "ID" +msgstr "ID" + +#. module: base_global_discount +#: model:ir.model.fields,field_description:base_global_discount.field_global_discount____last_update +msgid "Last Modified on" +msgstr "Última Modificação Em" + +#. module: base_global_discount +#: model:ir.model.fields,field_description:base_global_discount.field_global_discount__write_uid +msgid "Last Updated by" +msgstr "Atualizado pela última vez por" + +#. module: base_global_discount +#: model:ir.model.fields,field_description:base_global_discount.field_global_discount__write_date +msgid "Last Updated on" +msgstr "Atualizado pela última vez em" + +#. module: base_global_discount +#: model:res.groups,name:base_global_discount.group_global_discount +msgid "Manage Global Discounts" +msgstr "" + +#. module: base_global_discount +#: model:ir.model.fields,field_description:base_global_discount.field_res_partner__supplier_global_discount_ids +#: model:ir.model.fields,field_description:base_global_discount.field_res_users__supplier_global_discount_ids +#: model_terms:ir.ui.view,arch_db:base_global_discount.res_partner_form_view +msgid "Purchase Global Discounts" +msgstr "Descontos Globais de Compras" + +#. module: base_global_discount +#: model:ir.model.fields,field_description:base_global_discount.field_res_partner__supplier_global_discount_ids_readonly +#: model:ir.model.fields,field_description:base_global_discount.field_res_users__supplier_global_discount_ids_readonly +msgid "Purchase Global Discounts (readonly)" +msgstr "" + +#. module: base_global_discount +#: model:ir.model.fields.selection,name:base_global_discount.selection__global_discount__discount_scope__purchase +msgid "Purchases" +msgstr "Compras" + +#. module: base_global_discount +#: model:ir.model.fields,field_description:base_global_discount.field_res_partner__customer_global_discount_ids +#: model:ir.model.fields,field_description:base_global_discount.field_res_users__customer_global_discount_ids +#: model_terms:ir.ui.view,arch_db:base_global_discount.res_partner_form_view +msgid "Sale Global Discounts" +msgstr "Descontos Globais de Vendas" + +#. module: base_global_discount +#: model:ir.model.fields,field_description:base_global_discount.field_res_partner__customer_global_discount_ids_readonly +#: model:ir.model.fields,field_description:base_global_discount.field_res_users__customer_global_discount_ids_readonly +msgid "Sale Global Discounts (readonly)" +msgstr "" + +#. module: base_global_discount +#: model:ir.model.fields.selection,name:base_global_discount.selection__global_discount__discount_scope__sale +msgid "Sales" +msgstr "Vendas" + +#. module: base_global_discount +#: model:ir.model.fields,field_description:base_global_discount.field_global_discount__sequence +msgid "Sequence" +msgstr "Sequência" diff --git a/base_global_discount/models/__init__.py b/base_global_discount/models/__init__.py new file mode 100644 index 000000000..8a1089eda --- /dev/null +++ b/base_global_discount/models/__init__.py @@ -0,0 +1,2 @@ +from . import global_discount +from . import res_partner diff --git a/base_global_discount/models/global_discount.py b/base_global_discount/models/global_discount.py new file mode 100644 index 000000000..3ef61c2a5 --- /dev/null +++ b/base_global_discount/models/global_discount.py @@ -0,0 +1,44 @@ +# Copyright 2019 Tecnativa - David Vidal +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). +from odoo import fields, models + + +class GlobalDiscount(models.Model): + _name = "global.discount" + _description = "Global Discount" + _order = "sequence, id desc" + + sequence = fields.Integer(help="Gives the order to apply discounts") + name = fields.Char(string="Discount Name", required=True) + discount = fields.Float(digits="Discount", required=True, default=0.0) + discount_scope = fields.Selection( + selection=[("sale", "Sales"), ("purchase", "Purchases")], + default="sale", + required="True", + string="Discount Scope", + ) + company_id = fields.Many2one( + comodel_name="res.company", + string="Company", + default=lambda self: self.env.company, + ) + + def name_get(self): + result = [] + for one in self: + result.append((one.id, "{} ({:.2f}%)".format(one.name, one.discount))) + return result + + def _get_global_discount_vals(self, base, **kwargs): + """Prepare the dict of values to create to obtain the discounted + amount + + :param float base: the amount to discount + :return: dict with the discounted amount + """ + self.ensure_one() + return { + "global_discount": self, + "base": base, + "base_discounted": base * (1 - (self.discount / 100)), + } diff --git a/base_global_discount/models/res_partner.py b/base_global_discount/models/res_partner.py new file mode 100644 index 000000000..e95e29ad4 --- /dev/null +++ b/base_global_discount/models/res_partner.py @@ -0,0 +1,38 @@ +# Copyright 2019 Tecnativa - David Vidal +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). +from odoo import fields, models + + +class ResPartner(models.Model): + _inherit = "res.partner" + + customer_global_discount_ids = fields.Many2many( + comodel_name="global.discount", + relation="customer_global_discount_rel", + column1="partner_id", + column2="global_discount_id", + string="Sale Global Discounts", + domain=[("discount_scope", "=", "sale")], + ) + supplier_global_discount_ids = fields.Many2many( + comodel_name="global.discount", + relation="supplier_global_discount_rel", + column1="partner_id", + column2="global_discount_id", + string="Purchase Global Discounts", + domain=[("discount_scope", "=", "purchase")], + ) + # HACK: Looks like UI doesn't behave well with Many2many fields and + # negative groups when the same field is shown. In this case, we want to + # show the readonly version to any not in the global discount group. + # TODO: Check in future versions if it's fixed + customer_global_discount_ids_readonly = fields.Many2many( + string="Sale Global Discounts (readonly)", + related="customer_global_discount_ids", + readonly=True, + ) + supplier_global_discount_ids_readonly = fields.Many2many( + string="Purchase Global Discounts (readonly)", + related="supplier_global_discount_ids", + readonly=True, + ) diff --git a/base_global_discount/readme/CONFIGURE.rst b/base_global_discount/readme/CONFIGURE.rst new file mode 100644 index 000000000..bb80f62da --- /dev/null +++ b/base_global_discount/readme/CONFIGURE.rst @@ -0,0 +1,6 @@ +To use this module, you need to: + +#. Go to *Settings > Users*, choose yours and set *Manage Global Discounts*. +#. Go to *Settings > Parameters > Global Discounts* +#. Choose the discount scope (sales or purchases). +#. You can also restrict it to a certain company if needed. diff --git a/base_global_discount/readme/CONTRIBUTORS.rst b/base_global_discount/readme/CONTRIBUTORS.rst new file mode 100644 index 000000000..c4649cea3 --- /dev/null +++ b/base_global_discount/readme/CONTRIBUTORS.rst @@ -0,0 +1,8 @@ +* `Tecnativa `_ + + * Pedro M. Baeza + * David Vidal + * Carlos Dauden + * Rafael Blasco + * Ernesto Tejeda +* Omar Castiñeira diff --git a/base_global_discount/readme/DESCRIPTION.rst b/base_global_discount/readme/DESCRIPTION.rst new file mode 100644 index 000000000..7006b9932 --- /dev/null +++ b/base_global_discount/readme/DESCRIPTION.rst @@ -0,0 +1,3 @@ +Base module to have global discounts applied to either sales or purchases. It +doesn't do much for itself, so account_global_discount or +purchase_global_discount should be installed to benefit from it. diff --git a/base_global_discount/readme/USAGE.rst b/base_global_discount/readme/USAGE.rst new file mode 100644 index 000000000..079332b79 --- /dev/null +++ b/base_global_discount/readme/USAGE.rst @@ -0,0 +1,7 @@ +You can assign global discounts to partners as well. You'll need the proper +permission (*Manage Global Discounts*): + +#. Go to a partner that is a company. +#. Go to the *Sales & Purchases* tab. +#. In section sale, you can set sale discounts. +#. In section purchase, you can set purchase discounts. diff --git a/base_global_discount/security/ir.model.access.csv b/base_global_discount/security/ir.model.access.csv new file mode 100644 index 000000000..e6e0d9faa --- /dev/null +++ b/base_global_discount/security/ir.model.access.csv @@ -0,0 +1,3 @@ +id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink +access_global_discount_user,Global Discount Users,model_global_discount,base.group_user,1,0,0,0 +access_global_discount_manager,Global Discount Manager,model_global_discount,base_global_discount.group_global_discount,1,1,1,1 diff --git a/base_global_discount/security/security.xml b/base_global_discount/security/security.xml new file mode 100644 index 000000000..234c7c0ed --- /dev/null +++ b/base_global_discount/security/security.xml @@ -0,0 +1,20 @@ + + + + + Global Discount multi-company + + ['|',('company_id','=',False),('company_id', 'in', company_ids)] + + + + + + + Manage Global Discounts + + + diff --git a/base_global_discount/static/description/icon.png b/base_global_discount/static/description/icon.png new file mode 100644 index 000000000..3a0328b51 Binary files /dev/null and b/base_global_discount/static/description/icon.png differ diff --git a/base_global_discount/static/description/index.html b/base_global_discount/static/description/index.html new file mode 100644 index 000000000..27f067420 --- /dev/null +++ b/base_global_discount/static/description/index.html @@ -0,0 +1,124 @@ +
+
+
+

Module name

+

This module was written to extend the functionality of ... to support ... and allow you to ...

+
+
+
+ +
+
+
+

Installation

+
+
+

To install this module, you need to: +

    +
  • ...
  • +
+

+
+
+
+ + + +
+
+
+
+ +
+
+
+

Configuration

+
+
+

To configure this module, you need to: +

    +
  • ...
  • +
+

+
+
+
+ + + +
+
+
+
+ +
+
+
+

Usage

+
+
+

To use this module, you need to: +

    +
  • ...
  • +
+

+

For further information, please visit: +

+

+
+
+
+ + + +
+
+
+
+ +
+
+
+

Known issues / Roadmap

+
+
+

+

    +
  • ...
  • +
+

+
+
+
+ + + +
+
+
+
+ +
+
+
+

Credits

+
+
+

Contributors

+ +
+
+

Maintainer

+

+ This module is maintained by the OCA.
+ OCA, or the Odoo Community Association, is a nonprofit organization whose mission is to support the collaborative development of Odoo features and promote its widespread use.
+ To contribute to this module, please visit http://odoo-community.org.
+ +

+
+
+
diff --git a/base_global_discount/tests/__init__.py b/base_global_discount/tests/__init__.py new file mode 100644 index 000000000..e9199cd7e --- /dev/null +++ b/base_global_discount/tests/__init__.py @@ -0,0 +1 @@ +from . import test_global_discount diff --git a/base_global_discount/tests/test_global_discount.py b/base_global_discount/tests/test_global_discount.py new file mode 100644 index 000000000..47ddd8348 --- /dev/null +++ b/base_global_discount/tests/test_global_discount.py @@ -0,0 +1,29 @@ +# Copyright 2019 Tecnativa - David Vidal +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). +from odoo.tests import common + + +class TestGlobalDiscount(common.SavepointCase): + @classmethod + def setUpClass(cls): + super().setUpClass() + cls.global_discount_obj = cls.env["global.discount"] + cls.global_discount_1 = cls.global_discount_obj.create( + {"name": "Test Discount 1", "discount_scope": "sale", "discount": 20} + ) + cls.global_discount_2 = cls.global_discount_obj.create( + {"name": "Test Discount 2", "discount_scope": "sale", "discount": 30} + ) + + def test_01_global_discounts(self): + """Chain two discounts of different types""" + discount_vals = self.global_discount_1._get_global_discount_vals(100.0) + self.assertAlmostEqual(discount_vals["base_discounted"], 80.0) + discount_vals = self.global_discount_2._get_global_discount_vals( + discount_vals["base_discounted"] + ) + self.assertAlmostEqual(discount_vals["base_discounted"], 56.0) + + def test_02_display_name(self): + """Test that the name is computed fine""" + self.assertTrue("%)" in self.global_discount_1.display_name) diff --git a/base_global_discount/views/global_discount_views.xml b/base_global_discount/views/global_discount_views.xml new file mode 100644 index 000000000..fd22e9257 --- /dev/null +++ b/base_global_discount/views/global_discount_views.xml @@ -0,0 +1,47 @@ + + + + + global.discount + + + + + + + + + + + + global.discount + +
+ + + + + + + + + +
+
+
+ + Global Discounts + ir.actions.act_window + global.discount + tree,form + + +
diff --git a/base_global_discount/views/res_partner_views.xml b/base_global_discount/views/res_partner_views.xml new file mode 100644 index 000000000..95d49ee22 --- /dev/null +++ b/base_global_discount/views/res_partner_views.xml @@ -0,0 +1,43 @@ + + + + + res.partner + + + + + + + + + + + + + diff --git a/setup/base_global_discount/odoo/addons/base_global_discount b/setup/base_global_discount/odoo/addons/base_global_discount new file mode 120000 index 000000000..4635850f7 --- /dev/null +++ b/setup/base_global_discount/odoo/addons/base_global_discount @@ -0,0 +1 @@ +../../../../base_global_discount \ No newline at end of file diff --git a/setup/base_global_discount/setup.py b/setup/base_global_discount/setup.py new file mode 100644 index 000000000..28c57bb64 --- /dev/null +++ b/setup/base_global_discount/setup.py @@ -0,0 +1,6 @@ +import setuptools + +setuptools.setup( + setup_requires=['setuptools-odoo'], + odoo_addon=True, +)