Skip to content

Commit

Permalink
[MIG] product_print_category: Migration to 18.0
Browse files Browse the repository at this point in the history
  • Loading branch information
HeliconiaSolutions committed Nov 29, 2024
1 parent 1bd09cf commit 072b02a
Show file tree
Hide file tree
Showing 8 changed files with 77 additions and 63 deletions.
60 changes: 31 additions & 29 deletions product_print_category/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,13 @@ Product - Print Categories
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
:alt: License: AGPL-3
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fproduct--attribute-lightgray.png?logo=github
:target: https://github.com/OCA/product-attribute/tree/17.0/product_print_category
:target: https://github.com/OCA/product-attribute/tree/18.0/product_print_category
:alt: OCA/product-attribute
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/product-attribute-17-0/product-attribute-17-0-product_print_category
:target: https://translation.odoo-community.org/projects/product-attribute-18-0/product-attribute-18-0-product_print_category
:alt: Translate me on Weblate
.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png
:target: https://runboat.odoo-community.org/builds?repo=OCA/product-attribute&target_branch=17.0
:target: https://runboat.odoo-community.org/builds?repo=OCA/product-attribute&target_branch=18.0
:alt: Try me on Runboat

|badge1| |badge2| |badge3| |badge4| |badge5|
Expand All @@ -48,18 +48,18 @@ Configuration

**Group setting**

- Add yourself to the 'Print Category Manager' group in the 'Pricetags'
category.
- Add yourself to the 'Print Category Manager' group in the 'Pricetags'
category.

**Create Print Categories**

- Go to 'Sales' > 'Products' > 'Print Categories'
- Go to 'Sales' > 'Products' > 'Print Categories'

- Find or create new print categories of products
- Find or create new print categories of products

- Set the fields that will trigger to print again the product label
(e.g : name, sale price etc.)
- Set the qweb view that will be used for this category
- Set the fields that will trigger to print again the product label
(e.g : name, sale price etc.)
- Set the qweb view that will be used for this category

|image1|

Expand All @@ -68,16 +68,16 @@ custom module.

**Affect products to the categories**

- Go to "Sales" > "Products" > "Product variants" (or "Products" if
variants are not activated).
- Go to your product in General Information tab
- Set a print category
- Go to "Sales" > "Products" > "Product variants" (or "Products" if
variants are not activated).
- Go to your product in General Information tab
- Set a print category

|image2|

**Create Print Category Rules**

- Go to 'Sales' > 'Products' > 'Print Category Rules'
- Go to 'Sales' > 'Products' > 'Print Category Rules'

Create various ordered rules depending on product category and company.

Expand All @@ -86,30 +86,30 @@ product, when changing its company or its category.

|image3|

.. |image1| image:: https://raw.githubusercontent.com/OCA/product-attribute/17.0/product_print_category/static/description/product_print_category_form.png
.. |image2| image:: https://raw.githubusercontent.com/OCA/product-attribute/17.0/product_print_category/static/description/product_product_form.png
.. |image3| image:: https://raw.githubusercontent.com/OCA/product-attribute/17.0/product_print_category/static/description/product_print_category_rule_tree.png
.. |image1| image:: https://raw.githubusercontent.com/OCA/product-attribute/18.0/product_print_category/static/description/product_print_category_form.png
.. |image2| image:: https://raw.githubusercontent.com/OCA/product-attribute/18.0/product_print_category/static/description/product_product_form.png
.. |image3| image:: https://raw.githubusercontent.com/OCA/product-attribute/18.0/product_print_category/static/description/product_print_category_rule_tree.png

Usage
=====

- Go to "Sales" > "Products" > "Print Categories"
- Choose between "Print Obsolete Products" or "Print All Products"
- Go to "Sales" > "Products" > "Print Categories"
- Choose between "Print Obsolete Products" or "Print All Products"

|image4|

- Alternatively you can select product in product or variants list view
and click on "Action" > "Print Products"
- Alternatively you can select product in product or variants list view
and click on "Action" > "Print Products"

.. |image4| image:: https://raw.githubusercontent.com/OCA/product-attribute/17.0/product_print_category/static/description/product_print_wizard_form.png
.. |image4| image:: https://raw.githubusercontent.com/OCA/product-attribute/18.0/product_print_category/static/description/product_print_wizard_form.png

Bug Tracker
===========

Bugs are tracked on `GitHub Issues <https://github.com/OCA/product-attribute/issues>`_.
In case of trouble, please check there if your issue has already been reported.
If you spotted it first, help us to smash it by providing a detailed and welcomed
`feedback <https://github.com/OCA/product-attribute/issues/new?body=module:%20product_print_category%0Aversion:%2017.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
`feedback <https://github.com/OCA/product-attribute/issues/new?body=module:%20product_print_category%0Aversion:%2018.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.

Do not contact contributors directly about support or help with technical issues.

Expand All @@ -126,11 +126,13 @@ Authors
Contributors
------------

- Sylvain LE GAL <https://twitter.com/legalsylvain>
- Quentin DUPONT <https://twitter.com/pondupont>
- `Binhex <https://binhex.cloud/>`__:
- Sylvain LE GAL <https://twitter.com/legalsylvain>
- Quentin DUPONT <https://twitter.com/pondupont>
- `Binhex <https://binhex.cloud/>`__:

- Mario Luis <[email protected]>
- Mario Luis <[email protected]>

- Heliconia Solutions Pvt. Ltd. <https://www.heliconia.io>

Maintainers
-----------
Expand All @@ -153,6 +155,6 @@ Current `maintainer <https://odoo-community.org/page/maintainer-role>`__:

|maintainer-legalsylvain|

This module is part of the `OCA/product-attribute <https://github.com/OCA/product-attribute/tree/17.0/product_print_category>`_ project on GitHub.
This module is part of the `OCA/product-attribute <https://github.com/OCA/product-attribute/tree/18.0/product_print_category>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
2 changes: 1 addition & 1 deletion product_print_category/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"name": "Product - Print Categories",
"summary": "Define print categories for products"
" and automate products print, when data has changed",
"version": "17.0.1.0.1",
"version": "18.0.1.0.0",
"category": "Product",
"license": "AGPL-3",
"website": "https://github.com/OCA/product-attribute",
Expand Down
1 change: 1 addition & 0 deletions product_print_category/readme/CONTRIBUTORS.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@
- Quentin DUPONT \<<https://twitter.com/pondupont>\>
- [Binhex](https://binhex.cloud/):
- Mario Luis \<<[email protected]>\>
- Heliconia Solutions Pvt. Ltd. \<<https://www.heliconia.io>\>
15 changes: 8 additions & 7 deletions product_print_category/static/description/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -369,7 +369,7 @@ <h1 class="title">Product - Print Categories</h1>
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:d0ad3e5aaf7804028a0964c82950eec1aafb9ff1ae88b9a55b83072c8c3da23c
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<p><a class="reference external image-reference" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external image-reference" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external image-reference" href="https://github.com/OCA/product-attribute/tree/17.0/product_print_category"><img alt="OCA/product-attribute" src="https://img.shields.io/badge/github-OCA%2Fproduct--attribute-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/product-attribute-17-0/product-attribute-17-0-product_print_category"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external image-reference" href="https://runboat.odoo-community.org/builds?repo=OCA/product-attribute&amp;target_branch=17.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
<p><a class="reference external image-reference" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external image-reference" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external image-reference" href="https://github.com/OCA/product-attribute/tree/18.0/product_print_category"><img alt="OCA/product-attribute" src="https://img.shields.io/badge/github-OCA%2Fproduct--attribute-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/product-attribute-18-0/product-attribute-18-0-product_print_category"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external image-reference" href="https://runboat.odoo-community.org/builds?repo=OCA/product-attribute&amp;target_branch=18.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
<p>This module is designed to extend product printing features. It allows
user to create new print categories of products depending of the data
that are on the labels of the products variants.</p>
Expand Down Expand Up @@ -408,7 +408,7 @@ <h1><a class="toc-backref" href="#toc-entry-1">Configuration</a></h1>
</ul>
</li>
</ul>
<p><img alt="image1" src="https://raw.githubusercontent.com/OCA/product-attribute/17.0/product_print_category/static/description/product_print_category_form.png" /></p>
<p><img alt="image1" src="https://raw.githubusercontent.com/OCA/product-attribute/18.0/product_print_category/static/description/product_print_category_form.png" /></p>
<p>Alternatively, you can create product print categories and qweb in a
custom module.</p>
<p><strong>Affect products to the categories</strong></p>
Expand All @@ -418,23 +418,23 @@ <h1><a class="toc-backref" href="#toc-entry-1">Configuration</a></h1>
<li>Go to your product in General Information tab</li>
<li>Set a print category</li>
</ul>
<p><img alt="image2" src="https://raw.githubusercontent.com/OCA/product-attribute/17.0/product_print_category/static/description/product_product_form.png" /></p>
<p><img alt="image2" src="https://raw.githubusercontent.com/OCA/product-attribute/18.0/product_print_category/static/description/product_product_form.png" /></p>
<p><strong>Create Print Category Rules</strong></p>
<ul class="simple">
<li>Go to ‘Sales’ &gt; ‘Products’ &gt; ‘Print Category Rules’</li>
</ul>
<p>Create various ordered rules depending on product category and company.</p>
<p>This system allow to automatically set / remove print category to a
product, when changing its company or its category.</p>
<p><img alt="image3" src="https://raw.githubusercontent.com/OCA/product-attribute/17.0/product_print_category/static/description/product_print_category_rule_tree.png" /></p>
<p><img alt="image3" src="https://raw.githubusercontent.com/OCA/product-attribute/18.0/product_print_category/static/description/product_print_category_rule_tree.png" /></p>
</div>
<div class="section" id="usage">
<h1><a class="toc-backref" href="#toc-entry-2">Usage</a></h1>
<ul class="simple">
<li>Go to “Sales” &gt; “Products” &gt; “Print Categories”</li>
<li>Choose between “Print Obsolete Products” or “Print All Products”</li>
</ul>
<p><img alt="image4" src="https://raw.githubusercontent.com/OCA/product-attribute/17.0/product_print_category/static/description/product_print_wizard_form.png" /></p>
<p><img alt="image4" src="https://raw.githubusercontent.com/OCA/product-attribute/18.0/product_print_category/static/description/product_print_wizard_form.png" /></p>
<ul class="simple">
<li>Alternatively you can select product in product or variants list view
and click on “Action” &gt; “Print Products”</li>
Expand All @@ -445,7 +445,7 @@ <h1><a class="toc-backref" href="#toc-entry-3">Bug Tracker</a></h1>
<p>Bugs are tracked on <a class="reference external" href="https://github.com/OCA/product-attribute/issues">GitHub Issues</a>.
In case of trouble, please check there if your issue has already been reported.
If you spotted it first, help us to smash it by providing a detailed and welcomed
<a class="reference external" href="https://github.com/OCA/product-attribute/issues/new?body=module:%20product_print_category%0Aversion:%2017.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
<a class="reference external" href="https://github.com/OCA/product-attribute/issues/new?body=module:%20product_print_category%0Aversion:%2018.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
<p>Do not contact contributors directly about support or help with technical issues.</p>
</div>
<div class="section" id="credits">
Expand All @@ -467,6 +467,7 @@ <h2><a class="toc-backref" href="#toc-entry-6">Contributors</a></h2>
<li>Mario Luis &lt;<a class="reference external" href="mailto:m.luis&#64;binhex.cloud">m.luis&#64;binhex.cloud</a>&gt;</li>
</ul>
</li>
<li>Heliconia Solutions Pvt. Ltd. &lt;<a class="reference external" href="https://www.heliconia.io">https://www.heliconia.io</a>&gt;</li>
</ul>
</div>
<div class="section" id="maintainers">
Expand All @@ -480,7 +481,7 @@ <h2><a class="toc-backref" href="#toc-entry-7">Maintainers</a></h2>
promote its widespread use.</p>
<p>Current <a class="reference external" href="https://odoo-community.org/page/maintainer-role">maintainer</a>:</p>
<p><a class="reference external image-reference" href="https://github.com/legalsylvain"><img alt="legalsylvain" src="https://github.com/legalsylvain.png?size=40px" /></a></p>
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/product-attribute/tree/17.0/product_print_category">OCA/product-attribute</a> project on GitHub.</p>
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/product-attribute/tree/18.0/product_print_category">OCA/product-attribute</a> project on GitHub.</p>
<p>You are welcome to contribute. To learn how please visit <a class="reference external" href="https://odoo-community.org/page/Contribute">https://odoo-community.org/page/Contribute</a>.</p>
</div>
</div>
Expand Down
46 changes: 28 additions & 18 deletions product_print_category/tests/test_product_print_category.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,17 +21,21 @@ def setUpClass(cls):
# Test Section
def test_01_product_product_to_print_value(self):
product = self.ProductProduct.create(
{
"name": "Demo Product Product Name",
"print_category_id": self.print_category_1.id,
}
[
{
"name": "Demo Product Product Name",
"print_category_id": self.print_category_1.id,
}
]
)
self.assertEqual(product.to_print, True)

product = self.ProductProduct.create(
{
"name": "Demo Product Product Name",
}
[
{
"name": "Demo Product Product Name",
}
]
)
self.assertEqual(product.to_print, False)

Expand All @@ -44,17 +48,21 @@ def test_01_product_product_to_print_value(self):

def test_02_product_template_to_print_value(self):
template = self.ProductTemplate.create(
{
"name": "Demo Product Product Name",
"print_category_id": self.print_category_1.id,
}
[
{
"name": "Demo Product Product Name",
"print_category_id": self.print_category_1.id,
}
]
)
self.assertEqual(template.to_print, True)

template = self.ProductTemplate.create(
{
"name": "Demo Product Template Name",
}
[
{
"name": "Demo Product Template Name",
}
]
)
self.assertEqual(template.to_print, False)

Expand All @@ -76,7 +84,7 @@ def test_10_test_wizard_obsolete(self):
wizard = self.ProductPrintWizard.with_context(
active_model="product.print.category",
active_ids=[self.print_category_1.id],
).create({})
).create([{}])
self.assertEqual(
len(wizard.line_ids),
len(products),
Expand Down Expand Up @@ -117,9 +125,11 @@ def test_11_test_wizard_all(self):

def test_21_onchange(self):
product = self.ProductProduct.create(
{
"name": "Demo Product Product Name",
}
[
{
"name": "Demo Product Product Name",
}
]
)
self.assertEqual(product.print_category_id.id, False)

Expand Down
6 changes: 3 additions & 3 deletions product_print_category/views/view_product_print_category.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@ License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
<record model="ir.ui.view" id="view_product_print_category_tree">
<field name="model">product.print.category</field>
<field name="arch" type="xml">
<tree decoration-danger="product_to_print_qty != 0">
<list decoration-danger="product_to_print_qty != 0">
<field name="name" />
<field name="product_to_print_qty" />
<field name="product_qty" />
<field name="company_id" groups="base.group_multi_company" />
</tree>
</list>
</field>
</record>

Expand Down Expand Up @@ -111,7 +111,7 @@ License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
<record id="action_product_print_category" model="ir.actions.act_window">
<field name="name">Print Categories</field>
<field name="res_model">product.print.category</field>
<field name="view_mode">tree,form</field>
<field name="view_mode">list,form</field>
</record>

<menuitem
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,19 @@ License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
<record model="ir.ui.view" id="view_product_print_category_rule_tree">
<field name="model">product.print.category.rule</field>
<field name="arch" type="xml">
<tree editable="bottom">
<list editable="bottom">
<field name="sequence" widget="handle" />
<field name="main_category_id" />
<field name="company_id" groups="base.group_multi_company" />
<field name="print_category_id" />
</tree>
</list>
</field>
</record>

<record id="action_product_print_category_rule" model="ir.actions.act_window">
<field name="name">Print Category Rules</field>
<field name="res_model">product.print.category.rule</field>
<field name="view_mode">tree</field>
<field name="view_mode">list</field>
</record>

<menuitem
Expand Down
4 changes: 2 additions & 2 deletions product_print_category/wizard/view_product_print_wizard.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@ License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
⚠️ If you change Print Category here, it will be changed in the product.
</p>
<field name="line_ids" nolabel="1">
<tree editable="bottom">
<list editable="bottom">
<field name="product_id" />
<field name="quantity" />
<field name="print_category_id" attrs="{'required': True}" />
</tree>
</list>
</field>
<footer>
<button
Expand Down

0 comments on commit 072b02a

Please sign in to comment.