[FIX] pos_restaurant: wrap product names on OrderChangeReceipt

Reuse generate_wrapped_product_name() which was implemented for
regular POS receipts at 62a8def918.

Fixes #18688
This commit is contained in:
Joren Van Onder
2017-08-18 13:56:39 -07:00
parent 110bf158f6
commit 89cade3bff
2 changed files with 23 additions and 3 deletions
@@ -191,7 +191,12 @@ models.Order = models.Order.extend({
var product_id = line.get_product().id;
if (typeof resume[line_hash] === 'undefined') {
resume[line_hash] = { qty: qty, note: note, product_id: product_id };
resume[line_hash] = {
qty: qty,
note: note,
product_id: product_id,
product_name_wrapped: line.generate_wrapped_product_name(),
};
} else {
resume[line_hash].qty += qty;
}
@@ -222,6 +227,7 @@ models.Order = models.Order.extend({
add.push({
'id': curr.product_id,
'name': this.pos.db.get_product_by_id(curr.product_id).display_name,
'name_wrapped': curr.product_name_wrapped,
'note': curr.note,
'qty': curr.qty,
});
@@ -229,6 +235,7 @@ models.Order = models.Order.extend({
add.push({
'id': curr.product_id,
'name': this.pos.db.get_product_by_id(curr.product_id).display_name,
'name_wrapped': curr.product_name_wrapped,
'note': curr.note,
'qty': curr.qty - old.qty,
});
@@ -236,6 +243,7 @@ models.Order = models.Order.extend({
rem.push({
'id': curr.product_id,
'name': this.pos.db.get_product_by_id(curr.product_id).display_name,
'name_wrapped': curr.product_name_wrapped,
'note': curr.note,
'qty': old.qty - curr.qty,
});
@@ -248,6 +256,7 @@ models.Order = models.Order.extend({
rem.push({
'id': old.product_id,
'name': this.pos.db.get_product_by_id(old.product_id).display_name,
'name_wrapped': old.product_name_wrapped,
'note': old.note,
'qty': old.qty,
});
@@ -8,6 +8,15 @@
</span>
</t>
<t t-name="NameWrapped">
<t t-foreach="change.name_wrapped.slice(1)" t-as="wrapped_line">
<line>
<left></left>
<right><t t-esc="wrapped_line"/></right>
</line>
</t>
</t>
<t t-name="OrderChangeReceipt">
<receipt
align='center'
@@ -33,8 +42,9 @@
<t t-foreach="changes.cancelled" t-as="change">
<line>
<left><value><t t-esc="change.qty" /></value></left>
<right><t t-esc="change.name" /></right>
<right><t t-esc="change.name_wrapped[0]" /></right>
</line>
<t t-call="NameWrapped"/>
<t t-if="change.note">
<line>
<left>NOTE</left>
@@ -55,8 +65,9 @@
<t t-foreach="changes.new" t-as="change">
<line>
<left><value><t t-esc="change.qty" /></value></left>
<right><t t-esc="change.name" /></right>
<right><t t-esc="change.name_wrapped[0]" /></right>
</line>
<t t-call="NameWrapped"/>
<t t-if="change.note">
<line>
<left>NOTE</left>