[IMP] point_of_sale: pricelist discount on ticket
cleanup of prices printed on tickets
<std-pricelist-price> -> <active-pricelist-price>
<extra discount>
<quantity> x <price-incl-discounts>
This commit is contained in:
committed by
Gert Pellin - GPE
parent
3e77a95e5c
commit
03a20ff6cc
@@ -1557,6 +1557,9 @@ exports.Orderline = Backbone.Model.extend({
|
||||
discount: this.get_discount(),
|
||||
product_name: this.get_product().display_name,
|
||||
product_name_wrapped: this.generate_wrapped_product_name(),
|
||||
price_lst: this.get_lst_price(),
|
||||
display_discount_policy: this.display_discount_policy(),
|
||||
price_display_one: this.get_display_price_one(),
|
||||
price_display : this.get_display_price(),
|
||||
price_with_tax : this.get_price_with_tax(),
|
||||
price_without_tax: this.get_price_without_tax(),
|
||||
@@ -1621,6 +1624,28 @@ exports.Orderline = Backbone.Model.extend({
|
||||
var rounding = this.pos.currency.rounding;
|
||||
return round_pr(this.get_unit_price() * this.get_quantity() * (1 - this.get_discount()/100), rounding);
|
||||
},
|
||||
get_display_price_one: function(){
|
||||
var rounding = this.pos.currency.rounding;
|
||||
var price_unit = this.get_unit_price() * (1.0 - (this.get_discount() / 100.0));
|
||||
if (this.pos.config.iface_tax_included !== 'total') {
|
||||
return round_pr(price_unit, rounding);
|
||||
} else {
|
||||
var product = this.get_product();
|
||||
var taxes_ids = product.taxes_id;
|
||||
var taxes = this.pos.taxes;
|
||||
var product_taxes = [];
|
||||
|
||||
_(taxes_ids).each(function(el){
|
||||
product_taxes.push(_.detect(taxes, function(t){
|
||||
return t.id === el;
|
||||
}));
|
||||
});
|
||||
|
||||
var all_taxes = this.compute_all(product_taxes, price_unit, 1, this.pos.currency.rounding);
|
||||
|
||||
return round_pr(all_taxes.total_included * (1 - this.get_discount()/100), rounding);
|
||||
}
|
||||
},
|
||||
get_display_price: function(){
|
||||
if (this.pos.config.iface_tax_included === 'total') {
|
||||
return this.get_price_with_tax();
|
||||
|
||||
@@ -775,19 +775,44 @@
|
||||
|
||||
<div class='orderlines' line-ratio='0.6'>
|
||||
<t t-foreach='receipt.orderlines' t-as='line'>
|
||||
<t t-set='simple' t-value='line.discount === 0 and line.unit_name === "Unit(s)" and line.quantity === 1' />
|
||||
<t t-set='simple' t-value='(line.discount === 0 and line.unit_name === "Unit(s)" and line.quantity === 1 and !discount_to_show and !(line.display_discount_policy == "without_discount" && line.price != line.price_lst))' />
|
||||
<t t-if='simple'>
|
||||
<line>
|
||||
<left><t t-esc='line.product_name_wrapped[0]' /></left>
|
||||
<right><value t-att-value-decimals='pos.currency.decimals'><t t-esc='line.price_display' /></value></right>
|
||||
</line>
|
||||
<t t-call="XmlReceiptWrappedProductNameLines"/>
|
||||
</t>
|
||||
<t t-call="XmlReceiptWrappedProductNameLines"/>
|
||||
<t t-if='!simple'>
|
||||
<line><left><t t-esc='line.product_name_wrapped[0]' /></left></line>
|
||||
<t t-call="XmlReceiptWrappedProductNameLines"/>
|
||||
<t t-if="line.display_discount_policy == 'without_discount' && line.price != line.price_lst">
|
||||
<line indent='1'>
|
||||
<left>
|
||||
<value t-att-value-decimals='pos.dp["Product Price"]'>
|
||||
<t t-esc="line.price_lst" />
|
||||
</value> ->
|
||||
<value t-att-value-decimals='pos.dp["Product Price"]'>
|
||||
<t t-esc="line.price" />
|
||||
</value>
|
||||
</left>
|
||||
</line>
|
||||
</t>
|
||||
<t t-else='line.discount !== 0'>
|
||||
<line indent='1'>
|
||||
<left>
|
||||
<value t-att-value-decimals='pos.dp["Product Price"]'>
|
||||
<t t-esc="line.price_lst" />
|
||||
</value>
|
||||
</left>
|
||||
</line>
|
||||
</t>
|
||||
<t t-if='line.discount !== 0'>
|
||||
<line indent='1'><left>Discount: <t t-esc='line.discount' />%</left></line>
|
||||
<line indent='1'>
|
||||
<left>
|
||||
Discount: <t t-esc='line.discount' />%
|
||||
</left>
|
||||
</line>
|
||||
</t>
|
||||
<line indent='1'>
|
||||
<left>
|
||||
@@ -799,7 +824,7 @@
|
||||
</t>
|
||||
x
|
||||
<value t-att-value-decimals='pos.dp["Product Price"]'>
|
||||
<t t-esc='line.price' />
|
||||
<t t-esc='line.price_display_one' />
|
||||
</value>
|
||||
</left>
|
||||
<right>
|
||||
@@ -1486,8 +1511,7 @@
|
||||
<div class="pos-disc-font">
|
||||
<s>
|
||||
<t t-esc="widget.format_currency(orderline.get_lst_price(),'Product Price')"/>
|
||||
</s>
|
||||
->
|
||||
</s> ->
|
||||
<t t-esc="widget.format_currency(orderline.get_unit_display_price(),'Product Price')"/>
|
||||
</div>
|
||||
</t>
|
||||
|
||||
Reference in New Issue
Block a user