Skip to content

Commit

Permalink
Merge commit 'refs/pull/1181/head' of github.com:OCA/pos into merge-b…
Browse files Browse the repository at this point in the history
…ranch-3306-BSALLO-1307-4a8321f0
  • Loading branch information
trisdoan committed Apr 26, 2024
2 parents 11eb48e + f3bb52a commit a11b891
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 13 deletions.
4 changes: 4 additions & 0 deletions pos_product_label/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,10 @@ Contributors

* Iván Todorovich <[email protected]>

* [Trobz](https://www.trobz.com):

* Tri Doan <[email protected]>

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

Expand Down
25 changes: 13 additions & 12 deletions pos_product_label/models/pos_session.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,17 @@
class PosSession(models.Model):
_inherit = "pos.session"

def _prepare_product_label_layout_data(self, data):
vals = {
"product_ids": [Command.set(data["product_ids"])],
"custom_quantity": data["custom_quantity"],
"print_format": data["print_format"],
"extra_html": (
plaintext2html(data["extra_html"]) if data.get("extra_html") else False
),
}
return vals

def print_product_labels(self, data):
"""Print product labels from the POS.
Expand All @@ -19,18 +30,8 @@ def print_product_labels(self, data):
- print_format: str
- extra_html: str
"""
wizard = self.env["product.label.layout"].create(
{
"product_ids": [Command.set(data["product_ids"])],
"custom_quantity": data["custom_quantity"],
"print_format": data["print_format"],
"extra_html": (
plaintext2html(data["extra_html"])
if data.get("extra_html")
else False
),
}
)
vals = self._prepare_product_label_layout_data(data)
wizard = self.env["product.label.layout"].create(vals)
if data.get("pos_quantity") == "order":
wizard = wizard.with_context(
force_label_qty_by_product=data.get("order_quantity_by_product", {})
Expand Down
4 changes: 4 additions & 0 deletions pos_product_label/readme/CONTRIBUTORS.rst
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
* `Camptocamp <https://www.camptocamp.com>`_

* Iván Todorovich <[email protected]>

* [Trobz](https://www.trobz.com):

* Tri Doan <[email protected]>
5 changes: 4 additions & 1 deletion pos_product_label/static/description/index.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
Expand Down Expand Up @@ -418,6 +417,10 @@ <h2><a class="toc-backref" href="#toc-entry-5">Contributors</a></h2>
<li>Iván Todorovich &lt;<a class="reference external" href="mailto:ivan.todorovich&#64;camptocamp.com">ivan.todorovich&#64;camptocamp.com</a>&gt;</li>
</ul>
</li>
<li>[Trobz](<a class="reference external" href="https://www.trobz.com">https://www.trobz.com</a>):<ul>
<li>Tri Doan &lt;<a class="reference external" href="mailto:tridm&#64;trobz.com">tridm&#64;trobz.com</a>&gt;</li>
</ul>
</li>
</ul>
</div>
<div class="section" id="maintainers">
Expand Down

0 comments on commit a11b891

Please sign in to comment.