Skip to content

Commit

Permalink
[FIX] point_of_sale: fixup
Browse files Browse the repository at this point in the history
  • Loading branch information
mart-e committed Sep 14, 2018
1 parent 23bfa9e commit 6d386b9
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 17 deletions.
13 changes: 5 additions & 8 deletions addons/point_of_sale/static/src/js/models.js
Expand Up @@ -1297,9 +1297,6 @@ exports.Product = Backbone.Model.extend({
// pricelist that have base == 'pricelist'.
return price;
},
get_discount_policy: function(pricelist){
return pricelist.discount_policy;
},
});

var orderline_id = 1;
Expand Down Expand Up @@ -1774,10 +1771,10 @@ exports.Orderline = Backbone.Model.extend({
};
},
display_discount_policy: function(){
return this.product.get_discount_policy(this.order.pricelist);
return this.order.pricelist.discount_policy;
},
get_list_price: function(){
return this.product.list_price;
get_lst_price: function(){
return this.product.lst_price;
},
});

Expand Down Expand Up @@ -2450,8 +2447,8 @@ exports.Order = Backbone.Model.extend({
get_total_discount: function() {
return round_pr(this.orderlines.reduce((function(sum, orderLine) {
sum += (orderLine.get_unit_price() * (orderLine.get_discount()/100) * orderLine.get_quantity());
sum += ((orderLine.get_list_price() - orderLine.get_unit_price()) * orderLine.get_quantity());
return sum
sum += ((orderLine.get_lst_price() - orderLine.get_unit_price()) * orderLine.get_quantity());
return sum;
}), 0), this.pos.currency.rounding);
},
get_total_tax: function() {
Expand Down
18 changes: 9 additions & 9 deletions addons/point_of_sale/static/src/xml/pos.xml
Expand Up @@ -1269,7 +1269,7 @@
<t t-if="line.get_product().tracking!=='none'">
<i class="oe_link_icon fa fa-list oe_icon line-lot-icon oe_green" t-if="line.has_valid_product_lot()"
aria-label="Valid product lot" role="img" title="Valid product lot"/>
<i class="oe_link_icon fa fa-list oe_icon line-lot-icon oe_red" t-if="!(line.has_valid_product_lot())"
<i class="oe_link_icon fa fa-list oe_icon line-lot-icon oe_red" t-if="!line.has_valid_product_lot()"
aria-label="Invalid product lot" role="img" title="Invalid product lot"/>
</t>
</span>
Expand All @@ -1285,10 +1285,10 @@
<t t-esc="line.get_unit().name" />
at
<t t-if="line.display_discount_policy() == 'without_discount' &amp;&amp;
line.get_unit_display_price() != line.get_list_price()">
<strike>
<t t-esc="widget.format_currency(line.get_list_price(),'Product List Price')" />
</strike>
line.get_unit_display_price() != line.get_lst_price()">
<s>
<t t-esc="widget.format_currency(line.get_lst_price(),'Product Price')" />
</s>
<t t-esc="widget.format_currency(line.get_unit_display_price(),'Product Price')" />
</t>
<t t-else="">
Expand Down Expand Up @@ -1482,11 +1482,11 @@
<td>
<t t-esc="orderline.get_product().display_name"/>
<t t-if="orderline.display_discount_policy() == 'without_discount' &amp;&amp;
orderline.get_unit_display_price() != orderline.get_list_price()">
orderline.get_unit_display_price() != orderline.get_lst_price()">
<div class="pos-disc-font">
<strike>
<t t-esc="widget.format_currency(orderline.get_list_price(),'Product List Price')"/>
</strike>
<s>
<t t-esc="widget.format_currency(orderline.get_lst_price(),'Product Price')"/>
</s>
->
<t t-esc="widget.format_currency(orderline.get_unit_display_price(),'Product Price')"/>
</div>
Expand Down

0 comments on commit 6d386b9

Please sign in to comment.