diff --git a/account_avatax_sale_oca/views/sale_order_view.xml b/account_avatax_sale_oca/views/sale_order_view.xml index cbc213042..b16d9e148 100644 --- a/account_avatax_sale_oca/views/sale_order_view.xml +++ b/account_avatax_sale_oca/views/sale_order_view.xml @@ -63,7 +63,7 @@ - + `_. +In case of trouble, please check there if your issue has already been reported. +If you spotted it first, help us to smash it by providing a detailed and welcomed +`feedback `_. + +Do not contact contributors directly about support or help with technical issues. + +Credits +======= + +Authors +------- + +* Akretion + +Contributors +------------ + +- Mourad EL HADJ MIMOUNE +- Florian DA COSTA + +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. + +.. |maintainer-mourad-ehm| image:: https://github.com/mourad-ehm.png?size=40px + :target: https://github.com/mourad-ehm + :alt: mourad-ehm +.. |maintainer-florian-dacosta| image:: https://github.com/florian-dacosta.png?size=40px + :target: https://github.com/florian-dacosta + :alt: florian-dacosta + +Current `maintainers `__: + +|maintainer-mourad-ehm| |maintainer-florian-dacosta| + +This module is part of the `OCA/account-fiscal-rule `_ project on GitHub. + +You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/account_ecotax_sale/__init__.py b/account_ecotax_sale/__init__.py new file mode 100644 index 000000000..fda11c91d --- /dev/null +++ b/account_ecotax_sale/__init__.py @@ -0,0 +1,2 @@ +from . import models +from .hook import pre_init_hook diff --git a/account_ecotax_sale/__manifest__.py b/account_ecotax_sale/__manifest__.py new file mode 100644 index 000000000..74a481bb9 --- /dev/null +++ b/account_ecotax_sale/__manifest__.py @@ -0,0 +1,20 @@ +# © FROM 2014 Akretion (http://www.akretion.com) +# @author Mourad EL HADJ MIMOUNE +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). +{ + "name": "sale Ecotax Management", + "summary": "Sale Ecotaxe", + "version": "18.0.1.0.0", + "maintainers": ["mourad-ehm", "florian-dacosta"], + "author": "Akretion,Odoo Community Association (OCA)", + "website": "https://github.com/OCA/account-fiscal-rule", + "category": "Localization/Account Taxes", + "license": "AGPL-3", + "depends": ["account_ecotax", "sale"], + "data": [ + "views/sale_view.xml", + "security/ir.model.access.csv", + ], + "installable": True, + "pre_init_hook": "pre_init_hook", +} diff --git a/account_ecotax_sale/hook.py b/account_ecotax_sale/hook.py new file mode 100644 index 000000000..f636cd6b6 --- /dev/null +++ b/account_ecotax_sale/hook.py @@ -0,0 +1,28 @@ +def pre_init_hook(env): + env.cr.execute( + """ + ALTER TABLE sale_order ADD COLUMN IF NOT EXISTS amount_ecotax numeric + """ + ) + env.cr.execute( + """ + UPDATE sale_order SET amount_ecotax = 0.0 WHERE amount_ecotax IS NULL + """ + ) + env.cr.execute( + """ + ALTER TABLE sale_order_line ADD COLUMN IF NOT EXISTS subtotal_ecotax numeric + """ + ) + env.cr.execute( + """ + ALTER TABLE sale_order_line ADD COLUMN IF NOT EXISTS ecotax_amount_unit numeric + """ + ) + env.cr.execute( + """ + UPDATE sale_order_line + SET ecotax_amount_unit = 0.0, subtotal_ecotax = 0.0 + WHERE ecotax_amount_unit IS NULL + """ + ) diff --git a/account_ecotax_sale/i18n/account_ecotax_sale.pot b/account_ecotax_sale/i18n/account_ecotax_sale.pot new file mode 100644 index 000000000..6eb41bbf0 --- /dev/null +++ b/account_ecotax_sale/i18n/account_ecotax_sale.pot @@ -0,0 +1,183 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * account_ecotax_sale +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 17.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: account_ecotax_sale +#: model:ir.model.fields,field_description:account_ecotax_sale.field_sale_order_line_ecotax__amount_total +msgid "Amount Total" +msgstr "" + +#. module: account_ecotax_sale +#: model:ir.model.fields,field_description:account_ecotax_sale.field_sale_order_line_ecotax__amount_unit +msgid "Amount Unit" +msgstr "" + +#. module: account_ecotax_sale +#: model:ir.model.fields,field_description:account_ecotax_sale.field_sale_order_line_ecotax__classification_id +msgid "Classification" +msgstr "" + +#. module: account_ecotax_sale +#: model:ir.model.fields,field_description:account_ecotax_sale.field_sale_order_line_ecotax__create_uid +msgid "Created by" +msgstr "" + +#. module: account_ecotax_sale +#: model:ir.model.fields,field_description:account_ecotax_sale.field_sale_order_line_ecotax__create_date +msgid "Created on" +msgstr "" + +#. module: account_ecotax_sale +#: model:ir.model.fields,field_description:account_ecotax_sale.field_sale_order_line_ecotax__currency_id +msgid "Currency" +msgstr "" + +#. module: account_ecotax_sale +#: model_terms:ir.ui.view,arch_db:account_ecotax_sale.view_sale_line_ecotax_form +msgid "Delivered" +msgstr "" + +#. module: account_ecotax_sale +#: model_terms:ir.ui.view,arch_db:account_ecotax_sale.view_sale_line_ecotax_form +msgid "Description" +msgstr "" + +#. module: account_ecotax_sale +#: model:ir.model.fields,field_description:account_ecotax_sale.field_sale_order_line_ecotax__display_name +msgid "Display Name" +msgstr "" + +#. module: account_ecotax_sale +#: model:ir.model.fields,field_description:account_ecotax_sale.field_sale_order_line__subtotal_ecotax +#: model_terms:ir.ui.view,arch_db:account_ecotax_sale.view_order_form +msgid "Ecotax" +msgstr "" + +#. module: account_ecotax_sale +#: model:ir.model.fields,help:account_ecotax_sale.field_sale_order_line_ecotax__amount_unit +msgid "Ecotax Amount computed from Classification or Manual ecotax" +msgstr "" + +#. module: account_ecotax_sale +#: model:ir.model.fields,help:account_ecotax_sale.field_sale_order_line_ecotax__amount_total +msgid "" +"Ecotax Amount total computed from Classification or forced ecotax amount" +msgstr "" + +#. module: account_ecotax_sale +#: model:ir.model.fields,field_description:account_ecotax_sale.field_sale_order_line__ecotax_line_ids +msgid "Ecotax Lines" +msgstr "" + +#. module: account_ecotax_sale +#: model:ir.model.fields,field_description:account_ecotax_sale.field_sale_order_line__ecotax_amount_unit +msgid "Ecotax Unit" +msgstr "" + +#. module: account_ecotax_sale +#: model_terms:ir.ui.view,arch_db:account_ecotax_sale.view_sale_line_ecotax_form +msgid "Ecotax lines" +msgstr "" + +#. module: account_ecotax_sale +#: model:ir.model.fields,field_description:account_ecotax_sale.field_sale_order_line_ecotax__force_amount_unit +msgid "Force Amount Unit" +msgstr "" + +#. module: account_ecotax_sale +#: model:ir.model.fields,help:account_ecotax_sale.field_sale_order_line_ecotax__force_amount_unit +msgid "" +"Force ecotax.\n" +"Allow to add a subtitle to the default Ecotax Classification" +msgstr "" + +#. module: account_ecotax_sale +#: model:ir.model.fields,field_description:account_ecotax_sale.field_sale_order_line_ecotax__id +msgid "ID" +msgstr "" + +#. module: account_ecotax_sale +#: model:ir.model.fields,field_description:account_ecotax_sale.field_sale_order__amount_ecotax +msgid "Included Ecotaxe" +msgstr "" + +#. module: account_ecotax_sale +#: model_terms:ir.ui.view,arch_db:account_ecotax_sale.view_sale_line_ecotax_form +msgid "Invoiced" +msgstr "" + +#. module: account_ecotax_sale +#: model:ir.model.fields,field_description:account_ecotax_sale.field_sale_order_line_ecotax__write_uid +msgid "Last Updated by" +msgstr "" + +#. module: account_ecotax_sale +#: model:ir.model.fields,field_description:account_ecotax_sale.field_sale_order_line_ecotax__write_date +msgid "Last Updated on" +msgstr "" + +#. module: account_ecotax_sale +#: model_terms:ir.ui.view,arch_db:account_ecotax_sale.view_sale_line_ecotax_form +msgid "Note" +msgstr "" + +#. module: account_ecotax_sale +#: model:ir.model.fields,field_description:account_ecotax_sale.field_sale_order_line_ecotax__product_id +msgid "Product" +msgstr "" + +#. module: account_ecotax_sale +#: model:ir.model.fields,field_description:account_ecotax_sale.field_sale_order_line_ecotax__quantity +msgid "Quantity" +msgstr "" + +#. module: account_ecotax_sale +#: model:ir.model.fields,field_description:account_ecotax_sale.field_sale_order_line_ecotax__sale_order_line_id +msgid "Sale Line" +msgstr "" + +#. module: account_ecotax_sale +#: model:ir.model,name:account_ecotax_sale.model_sale_order_line_ecotax +msgid "Sale order line ecotax" +msgstr "" + +#. module: account_ecotax_sale +#: model:ir.model,name:account_ecotax_sale.model_sale_order +msgid "Sales Order" +msgstr "" + +#. module: account_ecotax_sale +#: model:ir.model,name:account_ecotax_sale.model_sale_order_line +msgid "Sales Order Line" +msgstr "" + +#. module: account_ecotax_sale +#: model_terms:ir.ui.view,arch_db:account_ecotax_sale.view_sale_line_ecotax_form +msgid "Section Name (eg. Products, Services)" +msgstr "" + +#. module: account_ecotax_sale +#: model_terms:ir.ui.view,arch_db:account_ecotax_sale.view_sale_line_ecotax_form +msgid "Subtotal" +msgstr "" + +#. module: account_ecotax_sale +#: model_terms:ir.ui.view,arch_db:account_ecotax_sale.view_sale_line_ecotax_form +msgid "Total" +msgstr "" + +#. module: account_ecotax_sale +#: model_terms:ir.ui.view,arch_db:account_ecotax_sale.view_sale_line_ecotax_form +msgid "Total Ecotax" +msgstr "" diff --git a/account_ecotax_sale/i18n/account_ecotaxe_sale.pot b/account_ecotax_sale/i18n/account_ecotaxe_sale.pot new file mode 100644 index 000000000..097bb7fc3 --- /dev/null +++ b/account_ecotax_sale/i18n/account_ecotaxe_sale.pot @@ -0,0 +1,39 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * l10n_fr_ecotaxe_sale +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 15.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: l10n_fr_ecotaxe_sale +#: model:ir.model.fields,field_description:l10n_fr_ecotaxe_sale.field_sale_order__amount_ecotaxe +msgid "Included Ecotaxe" +msgstr "" + +#. module: l10n_fr_ecotaxe_sale +#: model:ir.model,name:l10n_fr_ecotaxe_sale.model_sale_order +msgid "Sales Order" +msgstr "" + +#. module: l10n_fr_ecotaxe_sale +#: model:ir.model,name:l10n_fr_ecotaxe_sale.model_sale_order_line +msgid "Sales Order Line" +msgstr "" + +#. module: l10n_fr_ecotaxe_sale +#: model:ir.model.fields,field_description:l10n_fr_ecotaxe_sale.field_sale_order_line__subtotal_ecotaxe +msgid "Subtotal Ecotaxe" +msgstr "" + +#. module: l10n_fr_ecotaxe_sale +#: model:ir.model.fields,field_description:l10n_fr_ecotaxe_sale.field_sale_order_line__unit_ecotaxe_amount +msgid "ecotaxe Unit." +msgstr "" diff --git a/account_ecotax_sale/i18n/fr.po b/account_ecotax_sale/i18n/fr.po new file mode 100644 index 000000000..42f1c900d --- /dev/null +++ b/account_ecotax_sale/i18n/fr.po @@ -0,0 +1,197 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * l10n_fr_ecotaxe_sale +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 15.0+e\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2022-03-01 13:01+0000\n" +"PO-Revision-Date: 2025-04-14 18:24+0000\n" +"Last-Translator: epanisset \n" +"Language-Team: \n" +"Language: fr\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 5.10.4\n" + +#. module: account_ecotax_sale +#: model:ir.model.fields,field_description:account_ecotax_sale.field_sale_order_line_ecotax__amount_total +msgid "Amount Total" +msgstr "Montant Total" + +#. module: account_ecotax_sale +#: model:ir.model.fields,field_description:account_ecotax_sale.field_sale_order_line_ecotax__amount_unit +msgid "Amount Unit" +msgstr "Montant unitaire" + +#. module: account_ecotax_sale +#: model:ir.model.fields,field_description:account_ecotax_sale.field_sale_order_line_ecotax__classification_id +msgid "Classification" +msgstr "Classification" + +#. module: account_ecotax_sale +#: model:ir.model.fields,field_description:account_ecotax_sale.field_sale_order_line_ecotax__create_uid +msgid "Created by" +msgstr "Créé par" + +#. module: account_ecotax_sale +#: model:ir.model.fields,field_description:account_ecotax_sale.field_sale_order_line_ecotax__create_date +msgid "Created on" +msgstr "Créé le" + +#. module: account_ecotax_sale +#: model:ir.model.fields,field_description:account_ecotax_sale.field_sale_order_line_ecotax__currency_id +msgid "Currency" +msgstr "Devise" + +#. module: account_ecotax_sale +#: model_terms:ir.ui.view,arch_db:account_ecotax_sale.view_sale_line_ecotax_form +msgid "Delivered" +msgstr "Livré" + +#. module: account_ecotax_sale +#: model_terms:ir.ui.view,arch_db:account_ecotax_sale.view_sale_line_ecotax_form +msgid "Description" +msgstr "Description" + +#. module: account_ecotax_sale +#: model:ir.model.fields,field_description:account_ecotax_sale.field_sale_order_line_ecotax__display_name +msgid "Display Name" +msgstr "Nom Affiché" + +#. module: account_ecotax_sale +#: model:ir.model.fields,field_description:account_ecotax_sale.field_sale_order_line__subtotal_ecotax +#: model_terms:ir.ui.view,arch_db:account_ecotax_sale.view_order_form +msgid "Ecotax" +msgstr "Ecotaxe" + +#. module: account_ecotax_sale +#: model:ir.model.fields,help:account_ecotax_sale.field_sale_order_line_ecotax__amount_unit +msgid "Ecotax Amount computed from Classification or Manual ecotax" +msgstr "" +"Montant de l'écotaxe calculé à partir de la classification ou de l'écotaxe " +"manuelle" + +#. module: account_ecotax_sale +#: model:ir.model.fields,help:account_ecotax_sale.field_sale_order_line_ecotax__amount_total +msgid "" +"Ecotax Amount total computed from Classification or forced ecotax amount" +msgstr "" +"Montant total de l'écotaxe calculé à partir de la classification ou du " +"montant d'écotaxe forcé" + +#. module: account_ecotax_sale +#: model:ir.model.fields,field_description:account_ecotax_sale.field_sale_order_line__ecotax_line_ids +msgid "Ecotax Lines" +msgstr "Lignes d'Ecotaxe" + +#. module: account_ecotax_sale +#: model:ir.model.fields,field_description:account_ecotax_sale.field_sale_order_line__ecotax_amount_unit +#, fuzzy +msgid "Ecotax Unit" +msgstr "Ecotaxe par Unité" + +#. module: account_ecotax_sale +#: model_terms:ir.ui.view,arch_db:account_ecotax_sale.view_sale_line_ecotax_form +msgid "Ecotax lines" +msgstr "Lignes d'Ecotaxe" + +#. module: account_ecotax_sale +#: model:ir.model.fields,field_description:account_ecotax_sale.field_sale_order_line_ecotax__force_amount_unit +msgid "Force Amount Unit" +msgstr "Montant forcé à l'unité" + +#. module: account_ecotax_sale +#: model:ir.model.fields,help:account_ecotax_sale.field_sale_order_line_ecotax__force_amount_unit +msgid "" +"Force ecotax.\n" +"Allow to add a subtitle to the default Ecotax Classification" +msgstr "" +"Forcer l'écotaxe.\n" +"Autoriser un sous-titre pour la classification d'écotaxe par défaut" + +#. module: account_ecotax_sale +#: model:ir.model.fields,field_description:account_ecotax_sale.field_sale_order_line_ecotax__id +msgid "ID" +msgstr "ID" + +#. module: account_ecotax_sale +#: model:ir.model.fields,field_description:account_ecotax_sale.field_sale_order__amount_ecotax +msgid "Included Ecotaxe" +msgstr "Ecotaxe Incluse" + +#. module: account_ecotax_sale +#: model_terms:ir.ui.view,arch_db:account_ecotax_sale.view_sale_line_ecotax_form +msgid "Invoiced" +msgstr "Facturé" + +#. module: account_ecotax_sale +#: model:ir.model.fields,field_description:account_ecotax_sale.field_sale_order_line_ecotax__write_uid +msgid "Last Updated by" +msgstr "Mis à jour par" + +#. module: account_ecotax_sale +#: model:ir.model.fields,field_description:account_ecotax_sale.field_sale_order_line_ecotax__write_date +msgid "Last Updated on" +msgstr "Mis à jour le" + +#. module: account_ecotax_sale +#: model_terms:ir.ui.view,arch_db:account_ecotax_sale.view_sale_line_ecotax_form +msgid "Note" +msgstr "Note" + +#. module: account_ecotax_sale +#: model:ir.model.fields,field_description:account_ecotax_sale.field_sale_order_line_ecotax__product_id +msgid "Product" +msgstr "Produit" + +#. module: account_ecotax_sale +#: model:ir.model.fields,field_description:account_ecotax_sale.field_sale_order_line_ecotax__quantity +msgid "Quantity" +msgstr "Quantité" + +#. module: account_ecotax_sale +#: model:ir.model.fields,field_description:account_ecotax_sale.field_sale_order_line_ecotax__sale_order_line_id +#, fuzzy +msgid "Sale Line" +msgstr "Ligne de bons de commande" + +#. module: account_ecotax_sale +#: model:ir.model,name:account_ecotax_sale.model_sale_order_line_ecotax +msgid "Sale order line ecotax" +msgstr "Ligne d'Ecotaxe du bon de commande" + +#. module: account_ecotax_sale +#: model:ir.model,name:account_ecotax_sale.model_sale_order +msgid "Sales Order" +msgstr "Bon de commande" + +#. module: account_ecotax_sale +#: model:ir.model,name:account_ecotax_sale.model_sale_order_line +msgid "Sales Order Line" +msgstr "Ligne de bons de commande" + +#. module: account_ecotax_sale +#: model_terms:ir.ui.view,arch_db:account_ecotax_sale.view_sale_line_ecotax_form +msgid "Section Name (eg. Products, Services)" +msgstr "Nom de section (ex. Produits, Services)" + +#. module: account_ecotax_sale +#: model_terms:ir.ui.view,arch_db:account_ecotax_sale.view_sale_line_ecotax_form +#, fuzzy +msgid "Subtotal" +msgstr "Sous-total Ecotaxe" + +#. module: account_ecotax_sale +#: model_terms:ir.ui.view,arch_db:account_ecotax_sale.view_sale_line_ecotax_form +msgid "Total" +msgstr "Total" + +#. module: account_ecotax_sale +#: model_terms:ir.ui.view,arch_db:account_ecotax_sale.view_sale_line_ecotax_form +#, fuzzy +msgid "Total Ecotax" +msgstr "Sous-total Ecotaxe" diff --git a/account_ecotax_sale/i18n/it.po b/account_ecotax_sale/i18n/it.po new file mode 100644 index 000000000..612431be3 --- /dev/null +++ b/account_ecotax_sale/i18n/it.po @@ -0,0 +1,193 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * account_ecotax_sale +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 17.0\n" +"Report-Msgid-Bugs-To: \n" +"PO-Revision-Date: 2025-03-19 13:06+0000\n" +"Last-Translator: mymage \n" +"Language-Team: none\n" +"Language: it\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 5.10.2\n" + +#. module: account_ecotax_sale +#: model:ir.model.fields,field_description:account_ecotax_sale.field_sale_order_line_ecotax__amount_total +msgid "Amount Total" +msgstr "Importo totale" + +#. module: account_ecotax_sale +#: model:ir.model.fields,field_description:account_ecotax_sale.field_sale_order_line_ecotax__amount_unit +msgid "Amount Unit" +msgstr "Unità valore" + +#. module: account_ecotax_sale +#: model:ir.model.fields,field_description:account_ecotax_sale.field_sale_order_line_ecotax__classification_id +msgid "Classification" +msgstr "Classificazione" + +#. module: account_ecotax_sale +#: model:ir.model.fields,field_description:account_ecotax_sale.field_sale_order_line_ecotax__create_uid +msgid "Created by" +msgstr "Creato da" + +#. module: account_ecotax_sale +#: model:ir.model.fields,field_description:account_ecotax_sale.field_sale_order_line_ecotax__create_date +msgid "Created on" +msgstr "Creato il" + +#. module: account_ecotax_sale +#: model:ir.model.fields,field_description:account_ecotax_sale.field_sale_order_line_ecotax__currency_id +msgid "Currency" +msgstr "Valuta" + +#. module: account_ecotax_sale +#: model_terms:ir.ui.view,arch_db:account_ecotax_sale.view_sale_line_ecotax_form +msgid "Delivered" +msgstr "Consegnato" + +#. module: account_ecotax_sale +#: model_terms:ir.ui.view,arch_db:account_ecotax_sale.view_sale_line_ecotax_form +msgid "Description" +msgstr "Descrizione" + +#. module: account_ecotax_sale +#: model:ir.model.fields,field_description:account_ecotax_sale.field_sale_order_line_ecotax__display_name +msgid "Display Name" +msgstr "Nome visualizzato" + +#. module: account_ecotax_sale +#: model:ir.model.fields,field_description:account_ecotax_sale.field_sale_order_line__subtotal_ecotax +#: model_terms:ir.ui.view,arch_db:account_ecotax_sale.view_order_form +msgid "Ecotax" +msgstr "Imposta ecologica" + +#. module: account_ecotax_sale +#: model:ir.model.fields,help:account_ecotax_sale.field_sale_order_line_ecotax__amount_unit +msgid "Ecotax Amount computed from Classification or Manual ecotax" +msgstr "" +"Valore imposte ecologica calcolato dalla classificazione o imposta ecologica " +"manuale" + +#. module: account_ecotax_sale +#: model:ir.model.fields,help:account_ecotax_sale.field_sale_order_line_ecotax__amount_total +msgid "" +"Ecotax Amount total computed from Classification or forced ecotax amount" +msgstr "" +"Totale valore imposte ecologica calcolato dalla classificazione o valore " +"imposte ecologica forzato" + +#. module: account_ecotax_sale +#: model:ir.model.fields,field_description:account_ecotax_sale.field_sale_order_line__ecotax_line_ids +msgid "Ecotax Lines" +msgstr "Righe imposte ecologica" + +#. module: account_ecotax_sale +#: model:ir.model.fields,field_description:account_ecotax_sale.field_sale_order_line__ecotax_amount_unit +msgid "Ecotax Unit" +msgstr "Unità imposta ecologica" + +#. module: account_ecotax_sale +#: model_terms:ir.ui.view,arch_db:account_ecotax_sale.view_sale_line_ecotax_form +msgid "Ecotax lines" +msgstr "Righe imposte ecologica" + +#. module: account_ecotax_sale +#: model:ir.model.fields,field_description:account_ecotax_sale.field_sale_order_line_ecotax__force_amount_unit +msgid "Force Amount Unit" +msgstr "Forza unità valore" + +#. module: account_ecotax_sale +#: model:ir.model.fields,help:account_ecotax_sale.field_sale_order_line_ecotax__force_amount_unit +msgid "" +"Force ecotax.\n" +"Allow to add a subtitle to the default Ecotax Classification" +msgstr "" +"Forza imposta ecologica.\n" +"Consente di aggiungere un sotto titolo alla classificazione imposta " +"ecologica predefinita" + +#. module: account_ecotax_sale +#: model:ir.model.fields,field_description:account_ecotax_sale.field_sale_order_line_ecotax__id +msgid "ID" +msgstr "ID" + +#. module: account_ecotax_sale +#: model:ir.model.fields,field_description:account_ecotax_sale.field_sale_order__amount_ecotax +msgid "Included Ecotaxe" +msgstr "Inclusa tassa ecologica" + +#. module: account_ecotax_sale +#: model_terms:ir.ui.view,arch_db:account_ecotax_sale.view_sale_line_ecotax_form +msgid "Invoiced" +msgstr "Fatturato" + +#. module: account_ecotax_sale +#: model:ir.model.fields,field_description:account_ecotax_sale.field_sale_order_line_ecotax__write_uid +msgid "Last Updated by" +msgstr "Ultimo aggiornamento di" + +#. module: account_ecotax_sale +#: model:ir.model.fields,field_description:account_ecotax_sale.field_sale_order_line_ecotax__write_date +msgid "Last Updated on" +msgstr "Ultimo aggiornamento il" + +#. module: account_ecotax_sale +#: model_terms:ir.ui.view,arch_db:account_ecotax_sale.view_sale_line_ecotax_form +msgid "Note" +msgstr "Nota" + +#. module: account_ecotax_sale +#: model:ir.model.fields,field_description:account_ecotax_sale.field_sale_order_line_ecotax__product_id +msgid "Product" +msgstr "Prodotto" + +#. module: account_ecotax_sale +#: model:ir.model.fields,field_description:account_ecotax_sale.field_sale_order_line_ecotax__quantity +msgid "Quantity" +msgstr "Quantità" + +#. module: account_ecotax_sale +#: model:ir.model.fields,field_description:account_ecotax_sale.field_sale_order_line_ecotax__sale_order_line_id +msgid "Sale Line" +msgstr "Riga di vendita" + +#. module: account_ecotax_sale +#: model:ir.model,name:account_ecotax_sale.model_sale_order_line_ecotax +msgid "Sale order line ecotax" +msgstr "Tassa ecologica riga ordine di vendita" + +#. module: account_ecotax_sale +#: model:ir.model,name:account_ecotax_sale.model_sale_order +msgid "Sales Order" +msgstr "Ordine di vendita" + +#. module: account_ecotax_sale +#: model:ir.model,name:account_ecotax_sale.model_sale_order_line +msgid "Sales Order Line" +msgstr "Riga ordine di vendita" + +#. module: account_ecotax_sale +#: model_terms:ir.ui.view,arch_db:account_ecotax_sale.view_sale_line_ecotax_form +msgid "Section Name (eg. Products, Services)" +msgstr "Nome sezione (es. prodotti, servizi)" + +#. module: account_ecotax_sale +#: model_terms:ir.ui.view,arch_db:account_ecotax_sale.view_sale_line_ecotax_form +msgid "Subtotal" +msgstr "Subtotale" + +#. module: account_ecotax_sale +#: model_terms:ir.ui.view,arch_db:account_ecotax_sale.view_sale_line_ecotax_form +msgid "Total" +msgstr "Totale" + +#. module: account_ecotax_sale +#: model_terms:ir.ui.view,arch_db:account_ecotax_sale.view_sale_line_ecotax_form +msgid "Total Ecotax" +msgstr "Totale imposta ecologica" diff --git a/account_ecotax_sale/models/__init__.py b/account_ecotax_sale/models/__init__.py new file mode 100644 index 000000000..e95c7e574 --- /dev/null +++ b/account_ecotax_sale/models/__init__.py @@ -0,0 +1,3 @@ +from . import sale_order_line_ecotax +from . import sale_order_line +from . import sale_order diff --git a/account_ecotax_sale/models/sale_order.py b/account_ecotax_sale/models/sale_order.py new file mode 100644 index 000000000..0eb0280e6 --- /dev/null +++ b/account_ecotax_sale/models/sale_order.py @@ -0,0 +1,24 @@ +# © FROM 2015 Akretion (http://www.akretion.com) +# @author Mourad EL HADJ MIMOUNE +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). + +from odoo import api, fields, models + + +class SaleOrder(models.Model): + _inherit = "sale.order" + + amount_ecotax = fields.Float( + digits="Ecotaxe", + string="Included Ecotaxe", + store=True, + compute="_compute_ecotax", + ) + + @api.depends("order_line.subtotal_ecotax") + def _compute_ecotax(self): + for order in self: + val_ecotax = 0.0 + for line in order.order_line: + val_ecotax += line.subtotal_ecotax + order.amount_ecotax = val_ecotax diff --git a/account_ecotax_sale/models/sale_order_line.py b/account_ecotax_sale/models/sale_order_line.py new file mode 100644 index 000000000..9fe1b54cf --- /dev/null +++ b/account_ecotax_sale/models/sale_order_line.py @@ -0,0 +1,106 @@ +# © FROM 2015 Akretion (http://www.akretion.com) +# @author Mourad EL HADJ MIMOUNE +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). + +from odoo import Command, api, fields, models + + +class SaleOrderLine(models.Model): + _inherit = "sale.order.line" + + ecotax_line_ids = fields.One2many( + "sale.order.line.ecotax", + "sale_order_line_id", + compute="_compute_ecotax_line_ids", + store=True, + readonly=False, + string="Ecotax Lines", + copy=True, + ) + subtotal_ecotax = fields.Float( + string="Ecotax", digits="Ecotax", store=True, compute="_compute_ecotax" + ) + ecotax_amount_unit = fields.Float( + digits="Ecotax", + string="Ecotax Unit", + store=True, + compute="_compute_ecotax", + ) + + def _get_ecotax_amounts(self): + self.ensure_one() + unit = sum(self.ecotax_line_ids.mapped("amount_unit")) + subtotal_ecotax = sum(self.ecotax_line_ids.mapped("amount_total")) + return unit, subtotal_ecotax + + @api.depends( + "currency_id", + "product_uom_qty", + "ecotax_line_ids", + "ecotax_line_ids.amount_unit", + "ecotax_line_ids.amount_total", + ) + def _compute_ecotax(self): + for line in self: + amount_unit, subtotal = line._get_ecotax_amounts() + line.subtotal_ecotax = subtotal + line.ecotax_amount_unit = amount_unit + + def _get_new_vals_list(self): + self.ensure_one() + new_vals_list = [ + Command.create( + { + "classification_id": ecotaxline_prod.classification_id.id, + "force_amount_unit": ecotaxline_prod.force_amount, + } + ) + for ecotaxline_prod in self.product_id.all_ecotax_line_product_ids + ] + return new_vals_list + + @api.depends("product_id") + def _compute_ecotax_line_ids(self): + """Unlink and recreate ecotax_lines when modifying the product_id.""" + for line in self: + delete_vals_list = [ + Command.delete(taxline.id) for taxline in line.ecotax_line_ids + ] + new_vals_list = line._get_new_vals_list() + update = new_vals_list + delete_vals_list + line.ecotax_line_ids = update + + def edit_ecotax_lines(self): + view = { + "name": ("Ecotax classification"), + "view_type": "form", + "view_mode": "form", + "res_model": "sale.order.line", + "view_id": self.env.ref( + "account_ecotax_sale.view_sale_line_ecotax_form" + ).id, + "type": "ir.actions.act_window", + "target": "new", + "res_id": self.id, + } + return view + + def _prepare_invoice_line(self, **optional_values): + """Create equivalente ecotax_line_ids for account move line + from sale order line ecotax_line_ids . + """ + res = super()._prepare_invoice_line(**optional_values) + ecotax_cls_vals = [] + for ecotaxline in self.ecotax_line_ids: + ecotax_cls_vals.append( + ( + 0, + 0, + { + "classification_id": ecotaxline.classification_id.id, + "force_amount_unit": ecotaxline.force_amount_unit, + }, + ) + ) + res["ecotax_line_ids"] = ecotax_cls_vals + return res diff --git a/account_ecotax_sale/models/sale_order_line_ecotax.py b/account_ecotax_sale/models/sale_order_line_ecotax.py new file mode 100644 index 000000000..f7708a5c5 --- /dev/null +++ b/account_ecotax_sale/models/sale_order_line_ecotax.py @@ -0,0 +1,28 @@ +# © FROM 2014 Akretion (http://www.akretion.com) +# @author Mourad EL HADJ MIMOUNE +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). + +from odoo import fields, models + + +class SaleOrderLineEcotaxe(models.Model): + _name = "sale.order.line.ecotax" + _inherit = "ecotax.line.mixin" + _description = "Sale order line ecotax" + + sale_order_line_id = fields.Many2one( + comodel_name="sale.order.line", + string="Sale Line", + required=True, + readonly=True, + index=True, + auto_join=True, + ondelete="cascade", + ) + product_id = fields.Many2one( + "product.product", related="sale_order_line_id.product_id", readonly=True + ) + quantity = fields.Float(related="sale_order_line_id.product_uom_qty", readonly=True) + currency_id = fields.Many2one( + related="sale_order_line_id.currency_id", readonly=True + ) diff --git a/account_ecotax_sale/pyproject.toml b/account_ecotax_sale/pyproject.toml new file mode 100644 index 000000000..4231d0ccc --- /dev/null +++ b/account_ecotax_sale/pyproject.toml @@ -0,0 +1,3 @@ +[build-system] +requires = ["whool"] +build-backend = "whool.buildapi" diff --git a/account_ecotax_sale/readme/CONTRIBUTORS.md b/account_ecotax_sale/readme/CONTRIBUTORS.md new file mode 100644 index 000000000..d0f67c272 --- /dev/null +++ b/account_ecotax_sale/readme/CONTRIBUTORS.md @@ -0,0 +1,2 @@ +- Mourad EL HADJ MIMOUNE \ +- Florian DA COSTA \ diff --git a/account_ecotax_sale/readme/DESCRIPTION.md b/account_ecotax_sale/readme/DESCRIPTION.md new file mode 100644 index 000000000..c3ca598a8 --- /dev/null +++ b/account_ecotax_sale/readme/DESCRIPTION.md @@ -0,0 +1,3 @@ +This module is an extension of the module *account_ecotax* for sale +orders. Please refer to the README of the module *account_ecotax* for +more info about ecotax management. diff --git a/account_ecotax_sale/security/ir.model.access.csv b/account_ecotax_sale/security/ir.model.access.csv new file mode 100644 index 000000000..4bf00332b --- /dev/null +++ b/account_ecotax_sale/security/ir.model.access.csv @@ -0,0 +1,4 @@ +id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink +access_ecotax_line_product_sale_readonly,ecotax.line.product readonly,account_ecotax.model_ecotax_line_product,sales_team.group_sale_salesman,1,0,0,0 +access_account_move_line_ecotax_readonly_sale_user,account.move.line.ecotax readonly sale user,account_ecotax.model_account_move_line_ecotax,sales_team.group_sale_salesman,1,0,0,0 +ir_model_access_sale_order_line_ecotax_group_sale_salesman,Read Full acess to model_sale_order_line_ecotax to group sale_salesman,model_sale_order_line_ecotax,sales_team.group_sale_salesman,1,1,1,1 diff --git a/account_ecotax_sale/static/description/icon.png b/account_ecotax_sale/static/description/icon.png new file mode 100644 index 000000000..3a0328b51 Binary files /dev/null and b/account_ecotax_sale/static/description/icon.png differ diff --git a/account_ecotax_sale/static/description/index.html b/account_ecotax_sale/static/description/index.html new file mode 100644 index 000000000..c49322ef4 --- /dev/null +++ b/account_ecotax_sale/static/description/index.html @@ -0,0 +1,428 @@ + + + + + +sale Ecotax Management + + + +
+

sale Ecotax Management

+ + +

Beta License: AGPL-3 OCA/account-fiscal-rule Translate me on Weblate Try me on Runboat

+

This module is an extension of the module account_ecotax for sale +orders. Please refer to the README of the module account_ecotax for +more info about ecotax management.

+

Table of contents

+ +
+

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 to smash it by providing a detailed and welcomed +feedback.

+

Do not contact contributors directly about support or help with technical issues.

+
+
+

Credits

+
+

Authors

+
    +
  • Akretion
  • +
+
+
+

Contributors

+ +
+
+

Maintainers

+

This module is maintained by the OCA.

+ +Odoo Community Association + +

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.

+

Current maintainers:

+

mourad-ehm florian-dacosta

+

This module is part of the OCA/account-fiscal-rule project on GitHub.

+

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

+
+
+
+ + diff --git a/account_ecotax_sale/tests/__init__.py b/account_ecotax_sale/tests/__init__.py new file mode 100644 index 000000000..809acf6a1 --- /dev/null +++ b/account_ecotax_sale/tests/__init__.py @@ -0,0 +1 @@ +from . import test_sale_ecotax diff --git a/account_ecotax_sale/tests/test_sale_ecotax.py b/account_ecotax_sale/tests/test_sale_ecotax.py new file mode 100644 index 000000000..fb0e3faef --- /dev/null +++ b/account_ecotax_sale/tests/test_sale_ecotax.py @@ -0,0 +1,116 @@ +# © 2021-2023 Akretion (http://www.akretion.com) +# @author Mourad EL HADJ MIMOUNE +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). + +from odoo.tests import Form + +from odoo.addons.account_ecotax.tests.test_ecotax import TestInvoiceEcotaxCommon + + +class TestsaleEcotaxCommon(TestInvoiceEcotaxCommon): + @classmethod + def setUpClass(cls): + super().setUpClass() + cls.product_a = cls.env["product.product"].create( + { + "name": "product_a", + "uom_id": cls.env.ref("uom.product_uom_unit").id, + "weight": 100, + "list_price": 200, + } + ) + cls.product_b = cls.env["product.product"].create( + { + "name": "product_b", + "uom_id": cls.env.ref("uom.product_uom_unit").id, + "list_price": 200, + "weight": 400, + } + ) + + cls.product_a.ecotax_line_product_ids = [ + ( + 0, + 0, + { + # 2.4 + "classification_id": cls.ecotax_fixed.id, + }, + ) + ] + cls.product_b.ecotax_line_product_ids = [ + ( + 0, + 0, + { + "classification_id": cls.ecotax_weight.id, + }, + ) + ] + + def create_sale_partner(self, partner_id, products_and_qty): + sale_form = Form(self.env["sale.order"]) + sale_form.partner_id = partner_id + + for product, qty in products_and_qty: + with sale_form.order_line.new() as line_form: + line_form.product_id = product + line_form.product_uom_qty = qty + + sale = sale_form.save() + + return sale + + def _test_01_classification_weight_based_ecotax(self): + """Tests with weight based ecotaxs""" + # in order to test the correct assignment of weight ecotax + # I create a customer sale. + partner12 = self.env.ref("base.res_partner_12") + self.sale = self.create_sale_partner( + partner_id=partner12, products_and_qty=[(self.product_b, 1.0)] + ) + self.assertEqual(self.product_b.ecotax_amount, 16) + so_form = Form(self.sale) + with so_form.order_line.edit(0) as line: + line.product_uom_qty = 3.0 + so_form.save() + self.sale.order_line._compute_ecotax_line_ids() + self.assertEqual(self.sale.order_line.ecotax_amount_unit, 16) + self.assertEqual(self.sale.order_line.subtotal_ecotax, 48) + self.assertEqual(self.sale.amount_untaxed, 600) + self.assertEqual(self.sale.amount_ecotax, 48) + + def _test_02_classification_ecotax(self): + """Tests multiple lines with mixed ecotaxs""" + # in order to test the correct assignment of fixed ecotax and weight ecotax + # I create a customer sale. + partner12 = self.env.ref("base.res_partner_12") + self.sale = self.create_sale_partner( + partner_id=partner12, + products_and_qty=[(self.product_a, 1.0), (self.product_b, 2.0)], + ) + # I assign a product with fixed ecotaxte to sale line + sale_line1 = self.sale.order_line[0] + # make sure to have 1 tax and fix tax rate + sale_line2 = self.sale.order_line[1] + # make sure to have 1 tax and fix tax rate + self.assertEqual(self.product_a.ecotax_amount, 5.0) + so_form = Form(self.sale) + with so_form.order_line.edit(0) as line: + line.product_uom_qty = 3.0 + so_form.save() + self.sale.order_line._compute_ecotax_line_ids() + self.assertEqual(sale_line1.ecotax_amount_unit, 5.0) + self.assertAlmostEqual(sale_line1.subtotal_ecotax, 15.0) + self.assertEqual(sale_line2.ecotax_amount_unit, 16) + self.assertEqual(sale_line2.subtotal_ecotax, 32) + self.assertEqual(self.sale.amount_untaxed, 1000.0) + self.assertEqual(self.sale.amount_ecotax, 47.0) + + +class TestsaleEcotax(TestsaleEcotaxCommon): + def test_01_classification_weight_based_ecotax(self): + self._test_01_classification_weight_based_ecotax() + + def test_02_classification_ecotax(self): + self._test_02_classification_ecotax() diff --git a/account_ecotax_sale/views/sale_view.xml b/account_ecotax_sale/views/sale_view.xml new file mode 100644 index 000000000..8a0d1e6b0 --- /dev/null +++ b/account_ecotax_sale/views/sale_view.xml @@ -0,0 +1,162 @@ + + + + + sale.order + + + + + + + + + + + + + + + + + + + + + +