Skip to content

Commit

Permalink
[ADD][16.0] Sale Margin Update
Browse files Browse the repository at this point in the history
  • Loading branch information
ljimenezsidoo committed Oct 23, 2024
1 parent 327cc27 commit c5e288e
Show file tree
Hide file tree
Showing 16 changed files with 822 additions and 0 deletions.
83 changes: 83 additions & 0 deletions sale_margin_update/README.rst
Original file line number Diff line number Diff line change
@@ -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 <https://github.com/OCA/sale-workflow/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 <https://github.com/OCA/sale-workflow/issues/new?body=module:%20sale_margin_update%0Aversion:%2016.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.

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

Credits
=======

Authors
~~~~~~~

* Sidoo Soluciones S.L

Contributors
~~~~~~~~~~~~

* Oscar Soto Ochoa <[email protected]>

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 <https://github.com/OCA/sale-workflow/tree/16.0/sale_margin_update>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
5 changes: 5 additions & 0 deletions sale_margin_update/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
###############################################################################
# For copyright and license notices, see __manifest__.py file in root directory
###############################################################################
from . import models
from . import wizard
38 changes: 38 additions & 0 deletions sale_margin_update/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
###############################################################################
#
# Sidoo Soluciones S.L.
# Copyright (C) 2023-Today SDi Sidoo Soluciones S.L. <www.sidoo.es>
#
# 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": "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",
],
}
119 changes: 119 additions & 0 deletions sale_margin_update/i18n/es.po
Original file line number Diff line number Diff line change
@@ -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 ""
5 changes: 5 additions & 0 deletions sale_margin_update/models/__init__.py
Original file line number Diff line number Diff line change
@@ -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
15 changes: 15 additions & 0 deletions sale_margin_update/models/sale_order.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
from odoo import _, models


class SaleOrder(models.Model):
_inherit = "sale.order"

def wizard_price_unit_by_margin(self):
return {

Check warning on line 8 in sale_margin_update/models/sale_order.py

View check run for this annotation

Codecov / codecov/patch

sale_margin_update/models/sale_order.py#L8

Added line #L8 was not covered by tests
"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},
}
19 changes: 19 additions & 0 deletions sale_margin_update/models/sale_order_line.py
Original file line number Diff line number Diff line change
@@ -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 {

Check warning on line 12 in sale_margin_update/models/sale_order_line.py

View check run for this annotation

Codecov / codecov/patch

sale_margin_update/models/sale_order_line.py#L12

Added line #L12 was not covered by tests
"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},
}
2 changes: 2 additions & 0 deletions sale_margin_update/security/ir.model.access.csv
Original file line number Diff line number Diff line change
@@ -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
Binary file added sale_margin_update/static/description/icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit c5e288e

Please sign in to comment.