Skip to content

Commit

Permalink
[MIG] pos_receipt_hide_price: Migration to 16.0
Browse files Browse the repository at this point in the history
  • Loading branch information
danielduqma committed Nov 28, 2022
1 parent fb8130e commit fb6caeb
Show file tree
Hide file tree
Showing 12 changed files with 47 additions and 43 deletions.
4 changes: 4 additions & 0 deletions pos_receipt_hide_price/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,10 @@ Contributors

* Florian Mounier

* `FactorLibre <https://factorlibre.com/>`_:

* Daniel Duque

Maintainers
~~~~~~~~~~~

Expand Down
20 changes: 11 additions & 9 deletions pos_receipt_hide_price/__manifest__.py
Original file line number Diff line number Diff line change
@@ -1,18 +1,20 @@
# Copyright 2021 Akretion - Florian Mounier
# Copyright 2022 FactorLibre - Daniel Duque
{
"name": "POS Receipt Hide Price",
"summary": "Add button to remove price from receipt.",
"author": "Akretion, Odoo Community Association (OCA)",
"author": "Akretion, FactorLibre, Odoo Community Association (OCA)",
"website": "https://github.com/OCA/pos",
"category": "Point of Sale",
"version": "14.0.1.0.1",
"version": "16.0.1.0.0",
"license": "LGPL-3",
"depends": ["point_of_sale"],
"data": ["views/assets.xml"],
"qweb": [
"static/src/xml/OrderReceipt.xml",
"static/src/xml/HidePrice.xml",
"static/src/xml/ReceiptScreen.xml",
"static/src/xml/ReprintReceiptScreen.xml",
],
"assets": {
"point_of_sale.assets": [
"pos_receipt_hide_price/static/src/js/ReceiptScreen.js",
"pos_receipt_hide_price/static/src/js/ReprintReceiptScreen.js",
"pos_receipt_hide_price/static/src/js/OrderReceipt.js",
"pos_receipt_hide_price/static/src/xml/**/*",
],
},
}
4 changes: 4 additions & 0 deletions pos_receipt_hide_price/readme/CONTRIBUTORS.rst
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
* `Akretion <https://www.akretion.com>`_:

* Florian Mounier

* `FactorLibre <https://factorlibre.com/>`_:

* Daniel Duque
6 changes: 3 additions & 3 deletions pos_receipt_hide_price/static/src/js/OrderReceipt.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ odoo.define("pos_receipt_hide_price.OrderReceipt", function (require) {
const OrderReceipt = require("point_of_sale.OrderReceipt");
const Registries = require("point_of_sale.Registries");

const HidePriceOrderReceipt = (OrderReceipt) =>
class extends OrderReceipt {
constructor(_, {hidePriceState}) {
const HidePriceOrderReceipt = (OriginalOrderReceipt) =>
class extends OriginalOrderReceipt {
constructor({hidePriceState}) {
super(...arguments);
this.hidePriceState = hidePriceState;
}
Expand Down
6 changes: 3 additions & 3 deletions pos_receipt_hide_price/static/src/js/ReceiptScreen.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
odoo.define("pos_receipt_hide_price.ReceiptScreen", function (require) {
"use strict";

const {useState} = owl.hooks;
const {useState} = owl;
const ReceiptScreen = require("point_of_sale.ReceiptScreen");
const Registries = require("point_of_sale.Registries");

const HidePriceReceiptScreen = (ReceiptScreen) =>
class extends ReceiptScreen {
const HidePriceReceiptScreen = (OriginalReceiptScreen) =>
class extends OriginalReceiptScreen {
constructor() {
super(...arguments);
this.hidePriceState = useState({priceHidden: false});
Expand Down
6 changes: 3 additions & 3 deletions pos_receipt_hide_price/static/src/js/ReprintReceiptScreen.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
odoo.define("pos_receipt_hide_price.ReprintReceiptScreen", function (require) {
"use strict";

const {useState} = owl.hooks;
const {useState} = owl;
const ReprintReceiptScreen = require("point_of_sale.ReprintReceiptScreen");
const Registries = require("point_of_sale.Registries");

const HidePriceReprintReceiptScreen = (ReprintReceiptScreen) =>
class extends ReprintReceiptScreen {
const HidePriceReprintReceiptScreen = (OriginalReprintReceiptScreen) =>
class extends OriginalReprintReceiptScreen {
constructor() {
super(...arguments);
this.hidePriceState = useState({priceHidden: false});
Expand Down
14 changes: 10 additions & 4 deletions pos_receipt_hide_price/static/src/xml/OrderReceipt.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
<templates id="template" xml:space="preserve">
<t t-inherit="point_of_sale.OrderReceipt" t-inherit-mode="extension">
<!-- Attributes position xpath only apply to first match for some reason: -->
<!-- https://github.com/odoo/odoo/issues/23862 -->
<t t-inherit="point_of_sale.OrderLinesReceipt" t-inherit-mode="extension" owl="1">
<!-- Simple price -->
<xpath expr="//t[@t-if='isSimple(line)']/div/span" position="attributes">
<attribute name="t-att-class">{'oe_hidden': priceHidden}</attribute>
Expand Down Expand Up @@ -31,7 +29,10 @@
</div>
</t>
</xpath>

</t>
<t t-inherit="point_of_sale.OrderReceipt" t-inherit-mode="extension" owl="1">
<!-- Attributes position xpath only apply to first match for some reason: -->
<!-- https://github.com/odoo/odoo/issues/23862 -->
<!-- Tax included -->
<xpath expr="//t[@t-if='!isTaxIncluded']/div[1]" position="attributes">
<attribute name="t-att-class">{'oe_hidden': priceHidden}</attribute>
Expand Down Expand Up @@ -85,6 +86,11 @@
<xpath expr="//t[@t-foreach='receipt.tax_details']/div" position="attributes">
<attribute name="t-att-class">{'oe_hidden': priceHidden}</attribute>
</xpath>

<xpath expr="//t[@t-if='isTaxIncluded']/t[@t-foreach]/div" position="attributes">
<attribute name="t-att-class">{'oe_hidden': priceHidden}</attribute>
</xpath>

<xpath expr="//t[@t-if='isTaxIncluded']/div" position="attributes">
<attribute name="t-att-class">{'oe_hidden': priceHidden}</attribute>
</xpath>
Expand Down
2 changes: 1 addition & 1 deletion pos_receipt_hide_price/static/src/xml/ReceiptScreen.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<templates id="template" xml:space="preserve">
<t t-inherit="point_of_sale.ReceiptScreen" t-inherit-mode="extension">
<t t-inherit="point_of_sale.ReceiptScreen" t-inherit-mode="extension" owl="1">
<xpath expr="//div[hasclass('button', 'print')]" position="before">
<t t-call="pos_receipt_hide_price.hide_price" />
</xpath>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<templates id="template" xml:space="preserve">
<t t-inherit="point_of_sale.ReprintReceiptScreen" t-inherit-mode="extension">
<t t-inherit="point_of_sale.ReprintReceiptScreen" t-inherit-mode="extension" owl="1">
<xpath expr="//div[hasclass('button', 'print')]" position="after">
<t t-call="pos_receipt_hide_price.hide_price" />
</xpath>
Expand Down
19 changes: 0 additions & 19 deletions pos_receipt_hide_price/views/assets.xml

This file was deleted.

6 changes: 6 additions & 0 deletions setup/pos_receipt_hide_price/setup.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import setuptools

setuptools.setup(
setup_requires=['setuptools-odoo'],
odoo_addon=True,
)

0 comments on commit fb6caeb

Please sign in to comment.