Skip to content

Commit

Permalink
[IMP] sale_order_line_price_history: isort, black, prettier.
Browse files Browse the repository at this point in the history
  • Loading branch information
dsolanki-initos authored and Yadier-Tecnativa committed Apr 27, 2023
1 parent 404f54f commit 960248d
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 16 deletions.
2 changes: 1 addition & 1 deletion sale_order_line_price_history/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"version": "13.0.1.1.0",
"category": "Sales Management",
"author": "Tecnativa," "Odoo Community Association (OCA)",
"website": "https://github.com/OCA/sale-workflow/",
"website": "https://github.com/OCA/sale-workflow",
"license": "AGPL-3",
"depends": ["sale"],
"data": [
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/* Copyright 2021 Tecnativa - David Vidal
* License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html).
*/
odoo.define("sale_order_line_price_history.price_history_widget", function(require) {
odoo.define("sale_order_line_price_history.price_history_widget", function (require) {
"use strict";

var Widget = require("web.Widget");
Expand All @@ -13,20 +13,20 @@ odoo.define("sale_order_line_price_history.price_history_widget", function(requi
"click .price_history": "_onClickButton",
}),

init: function(parent, params) {
init: function (parent, params) {
this.data = params.data;
this._super(parent);
},

updateState: function(state) {
updateState: function (state) {
var candidate = state.data[this.getParent().currentRow];
if (candidate) {
this.data = candidate.data;
this.renderElement();
}
},

_onClickButton: function() {
_onClickButton: function () {
// When it's a new line, we can't rely on a line id for the wizard, but
// we can provide the proper element to find the historic lines.
this.$el.find(".price_history").prop("special_click", true);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,14 @@ def _default_product_id(self):
default=lambda self: self.env.context.get("active_id"),
)
product_id = fields.Many2one(
comodel_name="product.product", string="Product", default=_default_product_id,
comodel_name="product.product",
string="Product",
default=_default_product_id,
)
partner_id = fields.Many2one(
comodel_name="res.partner", string="Customer", default=_default_partner_id,
comodel_name="res.partner",
string="Customer",
default=_default_partner_id,
)
line_ids = fields.One2many(
comodel_name="sale.order.line.price.history.line",
Expand Down Expand Up @@ -88,25 +92,38 @@ class SaleOrderLinePriceHistoryline(models.TransientModel):
_description = "Sale order line price history line"

history_id = fields.Many2one(
comodel_name="sale.order.line.price.history", string="History",
comodel_name="sale.order.line.price.history",
string="History",
)
history_sale_order_line_id = fields.Many2one(
comodel_name="sale.order.line", string="history sale order line",
comodel_name="sale.order.line",
string="history sale order line",
)
sale_order_line_id = fields.Many2one(
comodel_name="sale.order.line", string="Sale order line",
comodel_name="sale.order.line",
string="Sale order line",
)
order_id = fields.Many2one(
related="sale_order_line_id.order_id",
)
partner_id = fields.Many2one(
related="sale_order_line_id.order_partner_id",
)
order_id = fields.Many2one(related="sale_order_line_id.order_id",)
partner_id = fields.Many2one(related="sale_order_line_id.order_partner_id",)
sale_order_date_order = fields.Datetime(
related="sale_order_line_id.order_id.date_order",
)
product_uom_qty = fields.Float(related="sale_order_line_id.product_uom_qty",)
price_unit = fields.Float(related="sale_order_line_id.price_unit",)
discount = fields.Float(related="sale_order_line_id.discount",)
product_uom_qty = fields.Float(
related="sale_order_line_id.product_uom_qty",
)
price_unit = fields.Float(
related="sale_order_line_id.price_unit",
)
discount = fields.Float(
related="sale_order_line_id.discount",
)

def _prepare_set_price_history_vals(self):
""" Hook method to prepare the values to update the
"""Hook method to prepare the values to update the
sales order line in context.
This method is invoke by action_set_price method in this model.
Expand Down

0 comments on commit 960248d

Please sign in to comment.