Skip to content

Commit

Permalink
[FIX] sale_order_line_price_history: Set history price from wizard tree
Browse files Browse the repository at this point in the history
- Set history price from wizard tree lines with a new widget: Apply changes in place the value of price_unit and discount
- Parameter to limit order lines displayed: Limit the number of sale order lines displayed on the wizard by system parameter
- Improved UX: Rearrange buttons, small icons, added tooltips, removed statusbar button from line form

Co-authored-by: Carlos Roca <[email protected]>
  • Loading branch information
Shide and CarlosRoca13 committed Jan 19, 2024
1 parent 579fa3f commit b73b110
Show file tree
Hide file tree
Showing 15 changed files with 219 additions and 117 deletions.
29 changes: 20 additions & 9 deletions sale_order_line_price_history/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,10 @@ Usage

To use this module, you need to:

#. Go to *Sales -> Quotations* and select a Quotation.
#. Go to System Parameters and configure the
``sale_order_line_price_history.order_line_limit`` parameter to limit the
number of Sale Order Lines to show on the Wizard.
#. Go to *Sales -> Quotations* and select a Quotation. Default is 20 lines.
#. Click on the new clock button in one of the sale order lines.
#. A pop-up will open and you will see the *price history* for the product of
the sale order line and for the customer of the sale order.
Expand All @@ -55,15 +58,7 @@ To use this module, you need to:
Known issues / Roadmap
======================

* The number of entries of prices history in the wizard should be configurable,
currently it is limited to 20.
* A backend tour would be nice to have.
* It is not possible to set a price from the tree view of the wizard lines,
currently it can only be done from the form view of those lines
(by clicking on one of them). This is not solved by simply putting a
'Set price' button in the wizard lines because that button will be
disabled since when the wizard is launched there is still no wizard
record in the database (this is an Odoo limitation).

Bug Tracker
===========
Expand Down Expand Up @@ -91,10 +86,12 @@ Contributors
* Pedro M. Baeza
* Ernesto Tejeda
* David Vidal
* Carlos Roca

* Serpent Consulting Services Pvt. Ltd. <[email protected]>
* Dhara Solanki <[email protected]>
* Ruchir Shukla <[email protected]>
* Eduardo de Miguel (`Moduon <https://www.moduon.team/>`__)

Maintainers
~~~~~~~~~~~
Expand All @@ -109,6 +106,20 @@ 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-ernestotejeda| image:: https://github.com/ernestotejeda.png?size=40px
:target: https://github.com/ernestotejeda
:alt: ernestotejeda
.. |maintainer-CarlosRoca13| image:: https://github.com/CarlosRoca13.png?size=40px
:target: https://github.com/CarlosRoca13
:alt: CarlosRoca13
.. |maintainer-Shide| image:: https://github.com/Shide.png?size=40px
:target: https://github.com/Shide
:alt: Shide

Current `maintainers <https://odoo-community.org/page/maintainer-role>`__:

|maintainer-ernestotejeda| |maintainer-CarlosRoca13| |maintainer-Shide|

This module is part of the `OCA/sale-workflow <https://github.com/OCA/sale-workflow/tree/16.0/sale_order_line_price_history>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
1 change: 1 addition & 0 deletions sale_order_line_price_history/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,6 @@
"sale_order_line_price_history/static/src/xml/*.xml",
],
},
"maintainers": ["ernestotejeda", "CarlosRoca13", "Shide"],
"installable": True,
}
50 changes: 24 additions & 26 deletions sale_order_line_price_history/i18n/es.po
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,18 @@
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 11.0\n"
"Project-Id-Version: Odoo Server 16.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2019-03-25 16:55+0000\n"
"PO-Revision-Date: 2023-07-25 12:10+0000\n"
"Last-Translator: Ivorra78 <[email protected]>\n"
"POT-Creation-Date: 2024-01-18 12:02+0000\n"
"PO-Revision-Date: 2024-01-18 13:02+0100\n"
"Last-Translator: \n"
"Language-Team: \n"
"Language: es\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.17\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
"X-Generator: Poedit 3.4\n"

#. module: sale_order_line_price_history
#: model_terms:ir.ui.view,arch_db:sale_order_line_price_history.sale_order_line_price_history_view_form
Expand Down Expand Up @@ -75,7 +75,7 @@ msgstr "Líneas de historial de precios"
#: model:ir.model.fields,field_description:sale_order_line_price_history.field_sale_order_line_price_history__id
#: model:ir.model.fields,field_description:sale_order_line_price_history.field_sale_order_line_price_history_line__id
msgid "ID"
msgstr "ID"
msgstr ""

#. module: sale_order_line_price_history
#: model:ir.model.fields,field_description:sale_order_line_price_history.field_sale_order_line_price_history__include_quotations
Expand Down Expand Up @@ -136,7 +136,11 @@ msgid "Order Reference"
msgstr "Referencia del pedido"

#. module: sale_order_line_price_history
#. odoo-javascript
#: code:addons/sale_order_line_price_history/static/src/xml/sale_line_price_history_widget.xml:0
#: model_terms:ir.ui.view,arch_db:sale_order_line_price_history.sale_order_line_price_history_view_form
#: model_terms:ir.ui.view,arch_db:sale_order_line_price_history.view_order_form
#, python-format
msgid "Price History"
msgstr "Historial de precios"

Expand All @@ -163,6 +167,7 @@ msgstr "Historial de ventas"
#. module: sale_order_line_price_history
#: model:ir.model.fields,field_description:sale_order_line_price_history.field_sale_order_line_price_history__sale_order_line_id
#: model:ir.model.fields,field_description:sale_order_line_price_history.field_sale_order_line_price_history_line__sale_order_line_id
#: model:ir.model.fields,field_description:sale_order_line_price_history.field_sale_order_line_price_history_line__target_sale_order_line_id
msgid "Sale order line"
msgstr "Línea de pedido de venta"

Expand All @@ -182,30 +187,23 @@ msgid "Sales Order Line"
msgstr "Línea de pedido de ventas"

#. module: sale_order_line_price_history
#: model_terms:ir.ui.view,arch_db:sale_order_line_price_history.sale_order_line_price_history_view_form
msgid "Set price"
msgstr "Establecer precio"
#. odoo-javascript
#: code:addons/sale_order_line_price_history/static/src/xml/set_price_to_line_widget.xml:0
#, python-format
msgid "Set Historic Price"
msgstr "Establecer Precio Histórico"

#. module: sale_order_line_price_history
#: model:ir.model.fields,field_description:sale_order_line_price_history.field_sale_order_line_price_history_line__order_state
msgid "Status"
msgstr "Estado"

#. module: sale_order_line_price_history
#: model:ir.model.fields,field_description:sale_order_line_price_history.field_sale_order_line_price_history_line__price_unit
msgid "Unit Price"
msgstr "Precio de Unidad"
msgstr "Precio Unitario"

#. module: sale_order_line_price_history
#: model:ir.model.fields,field_description:sale_order_line_price_history.field_sale_order_line_price_history_line__history_sale_order_line_id
msgid "history sale order line"
msgstr "Línea de orden de venta del historial"

#~ msgid "Include quotations"
#~ msgstr "Incluir presupuestos"

#~ msgid "Ordered Quantity"
#~ msgstr "Cantidad pedida"

#~ msgid "Price history"
#~ msgstr "Historial de precios"

#~ msgid ""
#~ "You can find a customer by its Name, TIN, Email or Internal Reference."
#~ msgstr ""
#~ "Puede encontrar un campo por su Nombre, TIN, Email o Referencia Interna."
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 16.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2024-01-18 12:01+0000\n"
"PO-Revision-Date: 2024-01-18 12:01+0000\n"
"Last-Translator: \n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
Expand Down Expand Up @@ -127,7 +129,11 @@ msgid "Order Reference"
msgstr ""

#. module: sale_order_line_price_history
#. odoo-javascript
#: code:addons/sale_order_line_price_history/static/src/xml/sale_line_price_history_widget.xml:0
#: model_terms:ir.ui.view,arch_db:sale_order_line_price_history.sale_order_line_price_history_view_form
#: model_terms:ir.ui.view,arch_db:sale_order_line_price_history.view_order_form
#, python-format
msgid "Price History"
msgstr ""

Expand All @@ -154,6 +160,7 @@ msgstr ""
#. module: sale_order_line_price_history
#: model:ir.model.fields,field_description:sale_order_line_price_history.field_sale_order_line_price_history__sale_order_line_id
#: model:ir.model.fields,field_description:sale_order_line_price_history.field_sale_order_line_price_history_line__sale_order_line_id
#: model:ir.model.fields,field_description:sale_order_line_price_history.field_sale_order_line_price_history_line__target_sale_order_line_id
msgid "Sale order line"
msgstr ""

Expand All @@ -173,8 +180,15 @@ msgid "Sales Order Line"
msgstr ""

#. module: sale_order_line_price_history
#: model_terms:ir.ui.view,arch_db:sale_order_line_price_history.sale_order_line_price_history_view_form
msgid "Set price"
#. odoo-javascript
#: code:addons/sale_order_line_price_history/static/src/xml/set_price_to_line_widget.xml:0
#, python-format
msgid "Set Historic Price"
msgstr ""

#. module: sale_order_line_price_history
#: model:ir.model.fields,field_description:sale_order_line_price_history.field_sale_order_line_price_history_line__order_state
msgid "Status"
msgstr ""

#. module: sale_order_line_price_history
Expand Down
2 changes: 2 additions & 0 deletions sale_order_line_price_history/readme/CONTRIBUTORS.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@
* Pedro M. Baeza
* Ernesto Tejeda
* David Vidal
* Carlos Roca

* Serpent Consulting Services Pvt. Ltd. <[email protected]>
* Dhara Solanki <[email protected]>
* Ruchir Shukla <[email protected]>
* Eduardo de Miguel (`Moduon <https://www.moduon.team/>`__)
8 changes: 0 additions & 8 deletions sale_order_line_price_history/readme/ROADMAP.rst
Original file line number Diff line number Diff line change
@@ -1,9 +1 @@
* The number of entries of prices history in the wizard should be configurable,
currently it is limited to 20.
* A backend tour would be nice to have.
* It is not possible to set a price from the tree view of the wizard lines,
currently it can only be done from the form view of those lines
(by clicking on one of them). This is not solved by simply putting a
'Set price' button in the wizard lines because that button will be
disabled since when the wizard is launched there is still no wizard
record in the database (this is an Odoo limitation).
5 changes: 4 additions & 1 deletion sale_order_line_price_history/readme/USAGE.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
To use this module, you need to:

#. Go to *Sales -> Quotations* and select a Quotation.
#. Go to System Parameters and configure the
``sale_order_line_price_history.order_line_limit`` parameter to limit the
number of Sale Order Lines to show on the Wizard.
#. Go to *Sales -> Quotations* and select a Quotation. Default is 20 lines.
#. Click on the new clock button in one of the sale order lines.
#. A pop-up will open and you will see the *price history* for the product of
the sale order line and for the customer of the sale order.
Expand Down
18 changes: 8 additions & 10 deletions sale_order_line_price_history/static/description/index.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
Expand Down Expand Up @@ -391,7 +390,10 @@ <h1 class="title">Sale order line price history</h1>
<h1><a class="toc-backref" href="#toc-entry-1">Usage</a></h1>
<p>To use this module, you need to:</p>
<ol class="arabic simple">
<li>Go to <em>Sales -&gt; Quotations</em> and select a Quotation.</li>
<li>Go to System Parameters and configure the
<tt class="docutils literal">sale_order_line_price_history.order_line_limit</tt> parameter to limit the
number of Sale Order Lines to show on the Wizard.</li>
<li>Go to <em>Sales -&gt; Quotations</em> and select a Quotation. Default is 20 lines.</li>
<li>Click on the new clock button in one of the sale order lines.</li>
<li>A pop-up will open and you will see the <em>price history</em> for the product of
the sale order line and for the customer of the sale order.</li>
Expand All @@ -405,15 +407,7 @@ <h1><a class="toc-backref" href="#toc-entry-1">Usage</a></h1>
<div class="section" id="known-issues-roadmap">
<h1><a class="toc-backref" href="#toc-entry-2">Known issues / Roadmap</a></h1>
<ul class="simple">
<li>The number of entries of prices history in the wizard should be configurable,
currently it is limited to 20.</li>
<li>A backend tour would be nice to have.</li>
<li>It is not possible to set a price from the tree view of the wizard lines,
currently it can only be done from the form view of those lines
(by clicking on one of them). This is not solved by simply putting a
‘Set price’ button in the wizard lines because that button will be
disabled since when the wizard is launched there is still no wizard
record in the database (this is an Odoo limitation).</li>
</ul>
</div>
<div class="section" id="bug-tracker">
Expand All @@ -439,11 +433,13 @@ <h2><a class="toc-backref" href="#toc-entry-6">Contributors</a></h2>
<li>Pedro M. Baeza</li>
<li>Ernesto Tejeda</li>
<li>David Vidal</li>
<li>Carlos Roca</li>
</ul>
</li>
<li>Serpent Consulting Services Pvt. Ltd. &lt;<a class="reference external" href="mailto:support&#64;serpentcs.com">support&#64;serpentcs.com</a>&gt;</li>
<li>Dhara Solanki &lt;<a class="reference external" href="mailto:dhara.solanki&#64;initos.com">dhara.solanki&#64;initos.com</a>&gt;</li>
<li>Ruchir Shukla &lt;<a class="reference external" href="mailto:ruchir&#64;bizzappdev.com">ruchir&#64;bizzappdev.com</a>&gt;</li>
<li>Eduardo de Miguel (<a class="reference external" href="https://www.moduon.team/">Moduon</a>)</li>
</ul>
</div>
<div class="section" id="maintainers">
Expand All @@ -453,6 +449,8 @@ <h2><a class="toc-backref" href="#toc-entry-7">Maintainers</a></h2>
<p>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.</p>
<p>Current <a class="reference external" href="https://odoo-community.org/page/maintainer-role">maintainers</a>:</p>
<p><a class="reference external image-reference" href="https://github.com/ernestotejeda"><img alt="ernestotejeda" src="https://github.com/ernestotejeda.png?size=40px" /></a> <a class="reference external image-reference" href="https://github.com/CarlosRoca13"><img alt="CarlosRoca13" src="https://github.com/CarlosRoca13.png?size=40px" /></a> <a class="reference external image-reference" href="https://github.com/Shide"><img alt="Shide" src="https://github.com/Shide.png?size=40px" /></a></p>
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/sale-workflow/tree/16.0/sale_order_line_price_history">OCA/sale-workflow</a> project on GitHub.</p>
<p>You are welcome to contribute. To learn how please visit <a class="reference external" href="https://odoo-community.org/page/Contribute">https://odoo-community.org/page/Contribute</a>.</p>
</div>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
/** @odoo-module **/
const {Component} = owl;
// Import the registry
import {registry} from "@web/core/registry";
import {standardFieldProps} from "@web/views/fields/standard_field_props";
import {useService} from "@web/core/utils/hooks";
Expand All @@ -21,6 +20,11 @@ export class PriceHistoryWidget extends Component {
default_active_id: this.props.value,
default_sale_order_line_id: this.props.value,
},
onClose: (value) => {
if (value && "price_unit" in value) {
this.props.record.update(value);
}
},
}
);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
/** @odoo-module **/
const {Component} = owl;
import {registry} from "@web/core/registry";
import {standardFieldProps} from "@web/views/fields/standard_field_props";
import {useService} from "@web/core/utils/hooks";

export class SetPriceToLineWidget extends Component {
setup() {
super.setup();
this.actionService = useService("action");
}

setPriceHistory() {
this.actionService.doAction({
type: "ir.actions.act_window_close",
infos: {
price_unit: this.props.record.data.price_unit,
discount: this.props.record.data.discount,
},
});
}
}

SetPriceToLineWidget.template =
"sale_order_line_price_history.price_to_line_history_widget";
SetPriceToLineWidget.props = standardFieldProps;

// Add the field to the correct category
registry.category("fields").add("set_price_to_line_widget", SetPriceToLineWidget);
Original file line number Diff line number Diff line change
@@ -1,10 +1,16 @@
<?xml version="1.0" encoding="utf-8" ?>
<!-- Copyright 2021 Tecnativa - David Vidal
License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html). -->
Copyright 2024 Moduon Team S.L. <[email protected]>
License AGLP-3.0 or later (https://www.gnu.org/licenses/agpl.html). -->
<templates>
<t t-name="sale_order_line_price_history.price_history_widget" owl="1">
<div>
<a tabindex="0" t-on-click="viewPriceHistory" class="fa fa-history" />
<a
tabindex="0"
t-on-click="viewPriceHistory"
class="fa fa-history"
title="Price History"
/>
</div>
</t>
</templates>
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?xml version="1.0" encoding="utf-8" ?>
<!-- Copyright 2023 Tecnativa - Carlos Roca
Copyright 2024 Moduon Team S.L. <[email protected]>
License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). -->
<templates>
<div t-name="sale_order_line_price_history.price_to_line_history_widget" owl="1">
<div>
<a
tabindex="0"
t-on-click="setPriceHistory"
class="fa fa-check p-1"
title="Set Historic Price"
/>
</div>
</div>
</templates>
Loading

0 comments on commit b73b110

Please sign in to comment.