Skip to content

Commit

Permalink
[MIG] product_brand: Migration to 18.0
Browse files Browse the repository at this point in the history
Co-authored-by: Do Anh Duy <[email protected]>
  • Loading branch information
Samir GUESMI authored and xaviedoanhduy committed Dec 4, 2024
1 parent 7661885 commit 32e4dd2
Show file tree
Hide file tree
Showing 8 changed files with 53 additions and 64 deletions.
15 changes: 9 additions & 6 deletions product_brand/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,13 @@ Product Brand Manager
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
:alt: License: AGPL-3
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fbrand-lightgray.png?logo=github
:target: https://github.com/OCA/brand/tree/17.0/product_brand
:target: https://github.com/OCA/brand/tree/18.0/product_brand
:alt: OCA/brand
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/brand-17-0/brand-17-0-product_brand
:target: https://translation.odoo-community.org/projects/brand-18-0/brand-18-0-product_brand
: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/brand&target_branch=17.0
:target: https://runboat.odoo-community.org/builds?repo=OCA/brand&target_branch=18.0
:alt: Try me on Runboat

|badge1| |badge2| |badge3| |badge4| |badge5|
Expand Down Expand Up @@ -76,7 +76,7 @@ Bug Tracker
Bugs are tracked on `GitHub Issues <https://github.com/OCA/brand/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/brand/issues/new?body=module:%20product_brand%0Aversion:%2017.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
`feedback <https://github.com/OCA/brand/issues/new?body=module:%20product_brand%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 Down Expand Up @@ -106,6 +106,7 @@ Contributors
- Marcelo Pickler <[email protected]>
- Andrius Laukavičius <[email protected]> (Boolit)
- Daniel Campos <[email protected]>
- Samir Guesmi <[email protected]>
- `Tecnativa <https://www.tecnativa.com>`__

- David Vidal
Expand All @@ -123,12 +124,14 @@ Contributors
- `Trobz <https://trobz.com>`__:

- Thao Le <[email protected]>
- Do Anh Duy <[email protected]>

Other credits
-------------

The migration of this module from 16.0 to 17.0 was financially supported
by Camptocamp.
by Camptocamp. The migration of this module from 17.0 to 18.0 was
financially supported by Camptocamp.

Maintainers
-----------
Expand All @@ -143,6 +146,6 @@ OCA, or the Odoo Community Association, is a nonprofit organization whose
mission is to support the collaborative development of Odoo features and
promote its widespread use.

This module is part of the `OCA/brand <https://github.com/OCA/brand/tree/17.0/product_brand>`_ project on GitHub.
This module is part of the `OCA/brand <https://github.com/OCA/brand/tree/18.0/product_brand>`_ 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_brand/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

{
"name": "Product Brand Manager",
"version": "17.0.1.1.1",
"version": "18.0.1.0.0",
"development_status": "Mature",
"category": "Product",
"summary": "Product Brand Manager",
Expand Down
4 changes: 3 additions & 1 deletion product_brand/readme/CONTRIBUTORS.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
- Marcelo Pickler \<<[email protected]>\>
- Andrius Laukavičius \<<[email protected]>\> (Boolit)
- Daniel Campos \<<[email protected]>\>
- Samir Guesmi \<<[email protected]>\>
- [Tecnativa](https://www.tecnativa.com)
- David Vidal
- João Marques
Expand All @@ -15,5 +16,6 @@
- Alan Ramos
- [NuoBiT Solutions](https://www.nuobit.com)
- Eric Antones \<<[email protected]>\>
- [Trobz](https://trobz.com):
- [Trobz](https://trobz.com):
- Thao Le \<<[email protected]>\>
- Do Anh Duy \<<[email protected]>\>
1 change: 1 addition & 0 deletions product_brand/readme/CREDITS.md
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
The migration of this module from 16.0 to 17.0 was financially supported by Camptocamp.
The migration of this module from 17.0 to 18.0 was financially supported by Camptocamp.
17 changes: 7 additions & 10 deletions product_brand/reports/account_invoice_report.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html)

from odoo import api, fields, models
from odoo.tools import SQL


class AccountInvoiceReport(models.Model):
Expand All @@ -10,15 +11,11 @@ class AccountInvoiceReport(models.Model):
product_brand_id = fields.Many2one(comodel_name="product.brand", string="Brand")

@api.model
def _select(self):
select_str = super()._select()
select_str += """
, template.product_brand_id as product_brand_id
"""
return select_str
def _select(self) -> SQL:
return SQL(

Check warning on line 15 in product_brand/reports/account_invoice_report.py

View check run for this annotation

Codecov / codecov/patch

product_brand/reports/account_invoice_report.py#L15

Added line #L15 was not covered by tests
"%s, template.product_brand_id as product_brand_id", super()._select()
)

@api.model
def _group_by(self):
group_by_str = super()._group_by()
group_by_str += ", template.product_brand_id"
return group_by_str
def _group_by(self) -> SQL:
return SQL("%s, template.product_brand_id", super()._group_by())

Check warning on line 21 in product_brand/reports/account_invoice_report.py

View check run for this annotation

Codecov / codecov/patch

product_brand/reports/account_invoice_report.py#L21

Added line #L21 was not covered by tests
11 changes: 7 additions & 4 deletions product_brand/static/description/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -369,7 +369,7 @@ <h1 class="title">Product Brand Manager</h1>
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:a7a9c5429fcfddf3b8fb5b4a07cb7eb47f5ec2d96769b0f4e71129041ea91ea5
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<p><a class="reference external image-reference" href="https://odoo-community.org/page/development-status"><img alt="Mature" src="https://img.shields.io/badge/maturity-Mature-brightgreen.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/brand/tree/17.0/product_brand"><img alt="OCA/brand" src="https://img.shields.io/badge/github-OCA%2Fbrand-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/brand-17-0/brand-17-0-product_brand"><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/brand&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="Mature" src="https://img.shields.io/badge/maturity-Mature-brightgreen.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/brand/tree/18.0/product_brand"><img alt="OCA/brand" src="https://img.shields.io/badge/github-OCA%2Fbrand-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/brand-18-0/brand-18-0-product_brand"><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/brand&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 allows odoo users to easily manage product brands.</p>
<p><strong>Table of contents</strong></p>
<div class="contents local topic" id="contents">
Expand Down Expand Up @@ -426,7 +426,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/brand/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/brand/issues/new?body=module:%20product_brand%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/brand/issues/new?body=module:%20product_brand%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 Down Expand Up @@ -455,6 +455,7 @@ <h2><a class="toc-backref" href="#toc-entry-6">Contributors</a></h2>
<li>Marcelo Pickler &lt;<a class="reference external" href="mailto:loxamir&#64;gmail.com">loxamir&#64;gmail.com</a>&gt;</li>
<li>Andrius Laukavičius &lt;<a class="reference external" href="mailto:ala&#64;boolit.eu">ala&#64;boolit.eu</a>&gt; (Boolit)</li>
<li>Daniel Campos &lt;<a class="reference external" href="mailto:danielcampos&#64;avanzosc.es">danielcampos&#64;avanzosc.es</a>&gt;</li>
<li>Samir Guesmi &lt;<a class="reference external" href="mailto:samir.guesmi&#64;acsone.eu">samir.guesmi&#64;acsone.eu</a>&gt;</li>
<li><a class="reference external" href="https://www.tecnativa.com">Tecnativa</a><ul>
<li>David Vidal</li>
<li>João Marques</li>
Expand All @@ -471,14 +472,16 @@ <h2><a class="toc-backref" href="#toc-entry-6">Contributors</a></h2>
</li>
<li><a class="reference external" href="https://trobz.com">Trobz</a>:<ul>
<li>Thao Le &lt;<a class="reference external" href="mailto:thaolt&#64;trobz.com">thaolt&#64;trobz.com</a>&gt;</li>
<li>Do Anh Duy &lt;<a class="reference external" href="mailto:duyda&#64;trobz.com">duyda&#64;trobz.com</a>&gt;</li>
</ul>
</li>
</ul>
</div>
<div class="section" id="other-credits">
<h2><a class="toc-backref" href="#toc-entry-7">Other credits</a></h2>
<p>The migration of this module from 16.0 to 17.0 was financially supported
by Camptocamp.</p>
by Camptocamp. The migration of this module from 17.0 to 18.0 was
financially supported by Camptocamp.</p>
</div>
<div class="section" id="maintainers">
<h2><a class="toc-backref" href="#toc-entry-8">Maintainers</a></h2>
Expand All @@ -489,7 +492,7 @@ <h2><a class="toc-backref" href="#toc-entry-8">Maintainers</a></h2>
<p>OCA, or the Odoo Community Association, is a nonprofit organization whose
mission is to support the collaborative development of Odoo features and
promote its widespread use.</p>
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/brand/tree/17.0/product_brand">OCA/brand</a> project on GitHub.</p>
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/brand/tree/18.0/product_brand">OCA/brand</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
7 changes: 2 additions & 5 deletions product_brand/tests/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,13 @@
# @author: Simone Orsi <[email protected]>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).

from odoo.tests.common import TransactionCase
from odoo.addons.base.tests.common import BaseCommon

from odoo.addons.base.tests.common import DISABLED_MAIL_CONTEXT


class CommonCase(TransactionCase):
class CommonCase(BaseCommon):
@classmethod
def setUpClass(cls):
super().setUpClass()
cls.env = cls.env(context=dict(cls.env.context, **DISABLED_MAIL_CONTEXT))
cls.product = cls.env.ref("product.product_product_4")
cls.supplier = cls.env.ref("base.res_partner_2")
cls.product_brand_obj = cls.env["product.brand"]
Expand Down
60 changes: 23 additions & 37 deletions product_brand/views/product_brand_view.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@
<record id="action_open_brand_products" model="ir.actions.act_window">
<field name="name">Brand Products</field>
<field name="res_model">product.template</field>
<field name="view_mode">kanban,form,tree</field>
<field name="view_mode">kanban,form,list</field>
<field name="domain">[('product_brand_id', '=', active_id)]</field>
</record>
<record id="action_open_single_product_brand" model="ir.actions.act_window">
<field name="name">Product Brand</field>
<field name="res_model">product.brand</field>
<field name="view_mode">kanban,form,tree</field>
<field name="view_mode">kanban,form,list</field>
<field name="target">current</field>
<field name="domain">[('product_ids', 'in', active_id)]</field>
</record>
Expand Down Expand Up @@ -69,46 +69,35 @@
<field name="name">product.brand.tree</field>
<field name="model">product.brand</field>
<field name="arch" type="xml">
<tree>
<list>
<field name="name" />
<field name="description" />
<field name="partner_id" />
</tree>
</list>
</field>
</record>
<record id="view_product_brand_kanban" model="ir.ui.view">
<field name="name">product.brand.kanban</field>
<field name="model">product.brand</field>
<field name="arch" type="xml">
<kanban>
<field name="id" />
<field name="logo" />
<field name="products_count" />
<field name="description" />
<templates>
<t t-name="kanban-box">
<div class="oe_kanban_global_click">
<div class="o_kanban_image">
<img
t-att-src="kanban_image('product.brand', 'logo', record.id.raw_value)"
alt="Logo"
/>
</div>
<div class="oe_kanban_details">
<h4>
<field name="name" />
</h4>
<div>
<a
name="%(product_brand.action_open_brand_products)d"
type="action"
>
<t t-esc="record.products_count.value" />
Products
</a>
</div>
</div>
</div>
<t t-name="card" class="flex-row">
<aside class="w-25 p-1">
<field name="logo" widget="image" alt="Avatar" />
</aside>
<main class="w-100 ps-2 pt-1">
<field name="name" class="fw-bolder" />
<a
name="%(product_brand.action_open_brand_products)d"
type="action"
>
<t t-esc="record.products_count.value" />
Products
</a>
</main>
</t>
</templates>
</kanban>
Expand Down Expand Up @@ -138,7 +127,7 @@
<field name="arch" type="xml">
<field name="sale_ok" position="before">
<field name="product_brand_id" placeholder="Brand" />
<div />
<span />
</field>
</field>
</record>
Expand All @@ -147,7 +136,7 @@
<field name="model">product.template</field>
<field name="inherit_id" ref="product.product_template_kanban_view" />
<field name="arch" type="xml">
<xpath expr="//strong[hasclass('o_kanban_record_title')]" position="after">
<xpath expr="//field[@name='name']/.." position="after">
<div>
<a
t-if="record.product_brand_id"
Expand All @@ -165,13 +154,10 @@
<field name="model">product.product</field>
<field name="inherit_id" ref="product.product_kanban_view" />
<field name="arch" type="xml">
<xpath
expr="//div[hasclass('oe_kanban_details')]//strong[1]"
position="after"
>
<xpath expr="//field[@name='name']/.." position="after">
<div>
<a t-if="record.product_brand_id" type="open">
<field name="product_brand_id" />
<field name="product_brand_id" widget="many2one" />
</a>
</div>
</xpath>
Expand Down Expand Up @@ -200,7 +186,7 @@
<record model="ir.actions.act_window" id="action_product_brand">
<field name="name">Brand</field>
<field name="res_model">product.brand</field>
<field name="view_mode">kanban,form,tree</field>
<field name="view_mode">kanban,form,list</field>
</record>
<menuitem
name="Product Brands"
Expand Down

0 comments on commit 32e4dd2

Please sign in to comment.