diff --git a/sale_margin_update/README.rst b/sale_margin_update/README.rst new file mode 100644 index 00000000000..5b6fce2e96c --- /dev/null +++ b/sale_margin_update/README.rst @@ -0,0 +1,83 @@ +=================== +Sale Margin Update +=================== + +.. + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! This file is generated by oca-gen-addon-readme !! + !! changes will be overwritten. !! + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! source digest: sha256:c97ec053f6a06fcb824861d16be9e31cc8a53549f47a0f38b6f54f534d09138b + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +.. |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%2Fsale--workflow-lightgray.png?logo=github + :target: https://github.com/OCA/sale-workflow/tree/16.0/sale_margin_update + :alt: OCA/sale-workflow +.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png + :target: https://translation.odoo-community.org/projects/sale-workflow-16-0/sale-workflow-16-0-sale_margin_update + :alt: Translate me on Weblate +.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png + :target: https://runboat.odoo-community.org/builds?repo=OCA/sale-workflow&target_branch=16.0 + :alt: Try me on Runboat + +|badge1| |badge2| |badge3| |badge4| |badge5| + +This modules use a wizard to update the margin on sale orders. + +**Table of contents** + +.. contents:: + :local: + +Usage +===== + +* Go to desire sale order +* Close to margin field there is a button with refresh icon +* This open new wizard and you can update the margin + +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 +~~~~~~~ + +* Sidoo Soluciones S.L + +Contributors +~~~~~~~~~~~~ + +* Oscar Soto Ochoa + +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/sale-workflow `_ project on GitHub. + +You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/sale_margin_update/__init__.py b/sale_margin_update/__init__.py new file mode 100644 index 00000000000..1ceb68a86af --- /dev/null +++ b/sale_margin_update/__init__.py @@ -0,0 +1,5 @@ +############################################################################### +# For copyright and license notices, see __manifest__.py file in root directory +############################################################################### +from . import models +from . import wizard diff --git a/sale_margin_update/__manifest__.py b/sale_margin_update/__manifest__.py new file mode 100644 index 00000000000..8b4ed5bfa72 --- /dev/null +++ b/sale_margin_update/__manifest__.py @@ -0,0 +1,38 @@ +############################################################################### +# +# Sidoo Soluciones S.L. +# Copyright (C) 2023-Today SDi Sidoo Soluciones S.L. +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as +# published by the Free Software Foundation, either version 3 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see . +# +############################################################################### + +{ + "name": "Sale Margin Update", + "summary": "Recalculate expected unit price from margin.", + "author": "Oscar Soto, Sidoo Soluciones S.L., Odoo Community Association (OCA)", + "website": "https://github.com/OCA/sale-workflow", + "license": "LGPL-3", + "version": "16.0.1.0.0", + "depends": [ + "sale", + "sales_team", + "sale_margin", + ], + "data": [ + "security/ir.model.access.csv", + "views/sale_order_views.xml", + "wizard/recalculate_price_margin.xml", + ], +} diff --git a/sale_margin_update/i18n/es.po b/sale_margin_update/i18n/es.po new file mode 100644 index 00000000000..042cd1eb46b --- /dev/null +++ b/sale_margin_update/i18n/es.po @@ -0,0 +1,119 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * sale_margin_update +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 16.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2024-09-30 15:43+0000\n" +"PO-Revision-Date: 2024-09-30 15:43+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: sale_margin_update +#: model_terms:ir.ui.view,arch_db:sale_margin_update.recalculate_price_margin_view_form +msgid "Cancel" +msgstr "" + +#. module: sale_margin_update +#: model:ir.model.fields,field_description:sale_margin_update.field_recalculate_price_margin__create_uid +msgid "Created by" +msgstr "" + +#. module: sale_margin_update +#: model:ir.model.fields,field_description:sale_margin_update.field_recalculate_price_margin__create_date +msgid "Created on" +msgstr "" + +#. module: sale_margin_update +#: model:ir.model.fields,field_description:sale_margin_update.field_recalculate_price_margin__display_name +msgid "Display Name" +msgstr "" + +#. module: sale_margin_update +#: model:ir.model.fields,field_description:sale_margin_update.field_recalculate_price_margin__id +msgid "ID" +msgstr "" + +#. module: sale_margin_update +#: model:ir.model.fields,field_description:sale_margin_update.field_recalculate_price_margin____last_update +msgid "Last Modified on" +msgstr "" + +#. module: sale_margin_update +#: model:ir.model.fields,field_description:sale_margin_update.field_recalculate_price_margin__write_uid +msgid "Last Updated by" +msgstr "" + +#. module: sale_margin_update +#: model:ir.model.fields,field_description:sale_margin_update.field_recalculate_price_margin__write_date +msgid "Last Updated on" +msgstr "" + +#. module: sale_margin_update +#: model:ir.model.fields,field_description:sale_margin_update.field_recalculate_price_margin__line_id +msgid "Line" +msgstr "Línea" + +#. module: sale_margin_update +#: model:ir.model.fields,field_description:sale_margin_update.field_recalculate_price_margin__sale_margin_percent +msgid "Margin (%)" +msgstr "Margen (%)" + +#. module: sale_margin_update +#. odoo-python +#: code:addons/sale_margin_update/wizard/recalculate_price_margin.py:0 +#, python-format +msgid "Margin can't be greater than 100" +msgstr "" + +#. module: sale_margin_update +#. odoo-python +#: code:addons/sale_margin_update/wizard/recalculate_price_margin.py:0 +#, python-format +msgid "Margin can't be negative" +msgstr "" + +#. module: sale_margin_update +#: model:ir.model.fields,field_description:sale_margin_update.field_recalculate_price_margin__order_id +msgid "Order" +msgstr "" + +#. module: sale_margin_update +#: model_terms:ir.ui.view,arch_db:sale_margin_update.recalculate_price_margin_view_form +msgid "Recalculate" +msgstr "" + +#. module: sale_margin_update +#: model:ir.model,name:sale_margin_update.model_recalculate_price_margin +msgid "Recalculate Price By Margin" +msgstr "" + +#. module: sale_margin_update +#: model:ir.model,name:sale_margin_update.model_sale_order +msgid "Sales Order" +msgstr "Pedido de venta" + +#. module: sale_margin_update +#: model:ir.model,name:sale_margin_update.model_sale_order_line +msgid "Sales Order Line" +msgstr "Línea de pedido de venta" + +#. module: sale_margin_update +#: model_terms:ir.ui.view,arch_db:sale_margin_update.sale_margin_sale_order +#: model_terms:ir.ui.view,arch_db:sale_margin_update.sale_margin_sale_order_line_form +msgid "Update Margin" +msgstr "Actualizar margen" + +#. module: sale_margin_update +#. odoo-python +#: code:addons/sale_margin_update/models/sale_order.py:0 +#: code:addons/sale_margin_update/models/sale_order_line.py:0 +#, python-format +msgid "Update Sale Order Line Price by Margin" +msgstr "" diff --git a/sale_margin_update/models/__init__.py b/sale_margin_update/models/__init__.py new file mode 100644 index 00000000000..7713a0e2eea --- /dev/null +++ b/sale_margin_update/models/__init__.py @@ -0,0 +1,5 @@ +############################################################################### +# For copyright and license notices, see __manifest__.py file in root directory +############################################################################### +from . import sale_order +from . import sale_order_line diff --git a/sale_margin_update/models/sale_order.py b/sale_margin_update/models/sale_order.py new file mode 100644 index 00000000000..c727ba13960 --- /dev/null +++ b/sale_margin_update/models/sale_order.py @@ -0,0 +1,15 @@ +from odoo import _, models + + +class SaleOrder(models.Model): + _inherit = "sale.order" + + def wizard_price_unit_by_margin(self): + return { + "name": _("Update Sale Order Line Price by Margin"), + "type": "ir.actions.act_window", + "res_model": "recalculate.price.margin", + "view_mode": "form", + "target": "new", + "context": {"default_order_id": self.id}, + } diff --git a/sale_margin_update/models/sale_order_line.py b/sale_margin_update/models/sale_order_line.py new file mode 100644 index 00000000000..05fbf173fa4 --- /dev/null +++ b/sale_margin_update/models/sale_order_line.py @@ -0,0 +1,19 @@ +############################################################################### +# For copyright and license notices, see __manifest__.py file in root directory +############################################################################### + +from odoo import _, models + + +class SaleOrderLine(models.Model): + _inherit = "sale.order.line" + + def wizard_price_unit_by_margin(self): + return { + "name": _("Update Sale Order Line Price by Margin"), + "type": "ir.actions.act_window", + "res_model": "recalculate.price.margin", + "view_mode": "form", + "target": "new", + "context": {"default_line_id": self.id}, + } diff --git a/sale_margin_update/security/ir.model.access.csv b/sale_margin_update/security/ir.model.access.csv new file mode 100644 index 00000000000..47b956b6ec3 --- /dev/null +++ b/sale_margin_update/security/ir.model.access.csv @@ -0,0 +1,2 @@ +id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink +access_recalculate_price_margin,access_recalculate_price_margin,model_recalculate_price_margin,sales_team.group_sale_salesman,1,1,1,1 diff --git a/sale_margin_update/static/description/icon.png b/sale_margin_update/static/description/icon.png new file mode 100644 index 00000000000..3a0328b516c Binary files /dev/null and b/sale_margin_update/static/description/icon.png differ diff --git a/sale_margin_update/static/description/index.html b/sale_margin_update/static/description/index.html new file mode 100644 index 00000000000..d33afaab642 --- /dev/null +++ b/sale_margin_update/static/description/index.html @@ -0,0 +1,429 @@ + + + + + +Sale Margin Update + + + +
+

Sale Margin Update

+ + +

Beta License: AGPL-3 OCA/sale-workflow Translate me on Weblate Try me on Runboat

+

This module allow to update the margin in sale orders using a new wizard

+

Table of contents

+ +
+

Usage

+
    +
  • Go to desire sale order
  • +
  • Click on refresh button under the margin field
  • +
  • In the wizard change the margin to update the sale order
  • +
+
+
+

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

+
    +
  • Sidoo Soluciones S.L
  • +
+
+
+

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.

+

This module is part of the OCA/sale-workflow project on GitHub.

+

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

+
+
+
+ + diff --git a/sale_margin_update/views/sale_order_views.xml b/sale_margin_update/views/sale_order_views.xml new file mode 100644 index 00000000000..616b2314155 --- /dev/null +++ b/sale_margin_update/views/sale_order_views.xml @@ -0,0 +1,31 @@ + + + + sale.order + + + +