Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[18.0] [MIG] product_brand #211

Open
wants to merge 81 commits into
base: 18.0
Choose a base branch
from

Conversation

samirGuesmi
Copy link
Member

Migarate product_brand to v18

bguillot and others added 30 commits October 10, 2024 17:49
* add smart button, move menu to a more visible position.
* show brand in product.template kanban and tree views.
* show brand in product variant kanban and tree views.
* add product_brand kanban view.
* update module's README and manifest file.
* Search and group by brand for both product.product and product.template.
* Convert model to new APIs.
* Refactor products_count computation using product_ids one2many field.
* Add public read access to product.brand (fixes 403 error on webshop for public user).
* Make brand name required.
Old form view was out of order: form blocks misaligned, because it was
not using Odoo 10 views styling and layout.
Lookup fails when the ID is formatted. The unformatted version of the
data is located under `raw_value`.
Currently translated at 100,0% (21 of 21 strings)

Translation: product-attribute-11.0/product-attribute-11.0-product_brand
Translate-URL: https://translation.odoo-community.org/projects/product-attribute-11-0/product-attribute-11-0-product_brand/de/
… with other odoo apps. (#364)

* Make the logo always the same width (64px).
* Remove the description (200 first caracters). Not relevant for a configuration model.
* Move the brand name and product count beside the image. This is the way it is displayed in partners and products kanban views.
Currently translated at 100.0% (24 of 24 strings)

Translation: product-attribute-12.0/product-attribute-12.0-product_brand
Translate-URL: https://translation.odoo-community.org/projects/product-attribute-12-0/product-attribute-12-0-product_brand/es/
Currently translated at 37.5% (9 of 24 strings)

Translation: product-attribute-12.0/product-attribute-12.0-product_brand
Translate-URL: https://translation.odoo-community.org/projects/product-attribute-12-0/product-attribute-12-0-product_brand/nb_NO/
Currently translated at 100.0% (24 of 24 strings)

Translation: product-attribute-12.0/product-attribute-12.0-product_brand
Translate-URL: https://translation.odoo-community.org/projects/product-attribute-12-0/product-attribute-12-0-product_brand/nb_NO/
Currently translated at 100.0% (24 of 24 strings)

Translation: product-attribute-12.0/product-attribute-12.0-product_brand
Translate-URL: https://translation.odoo-community.org/projects/product-attribute-12-0/product-attribute-12-0-product_brand/nl_NL/
Copy link
Member

@astirpe astirpe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@samirGuesmi Thank you for porting this module, please check my code review and the results from my testing.

@@ -9,7 +9,7 @@

{
"name": "Product Brand Manager",
"version": "17.0.1.1.1",
"version": "18.0.1.1.1",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should be 18.0.1.0.0

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

@@ -147,7 +147,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="//div[hasclass('d-flex')]" position="after">
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Avoid to do generic search on elements with class d-flex, like you are doing here:
expr="//div[hasclass('d-flex')]"

Try to use something more direct, like for example:
expr="//field[@name='name']/.." (putting /.. after the field will have the same effect as the expression above)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, Done

expr="//div[hasclass('oe_kanban_details')]//strong[1]"
position="after"
>
<xpath expr="//div[hasclass('d-flex')]" position="after">
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested in runboat: when I click on the brand in the kanban view of a variant (product.product), the link doesn't work because it opens directly the variant instead of the brand. Could you check? (but seems working fine on the product.template)

Also here, avoid to do generic search on class d-flex.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It doesn't work on v17 either. I fixed it by adding the widget widget="many2one" .

@samirGuesmi samirGuesmi force-pushed the 18.0-mig-product_brand-sgu branch from 27fc8f9 to 17d528f Compare October 16, 2024 10:15
@samirGuesmi
Copy link
Member Author

@astirpe Thank you Andrea for the review.
I just pushed the fixes.

Copy link
Member

@astirpe astirpe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you!

@samirGuesmi samirGuesmi changed the title 18.0 mig product_brand [18.0] [MIG] product_brand Oct 16, 2024
@OCA-git-bot
Copy link
Contributor

This PR has the approved label and has been created more than 5 days ago. It should therefore be ready to merge by a maintainer (or a PSC member if the concerned addon has no declared maintainer). 🤖

Copy link

@CasVissers-360ERP CasVissers-360ERP left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Functional review

Copy link

@luc-adhoc luc-adhoc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

func review

@luc-adhoc
Copy link

@pedrobaeza would you set this PR to merge ? tks!

@@ -11,14 +12,14 @@ class AccountInvoiceReport(models.Model):

@api.model
def _select(self):
select_str = super()._select()
select_str = super()._select().code
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't there a way of not having to unwrap/wrap this? I suppose there should be a method to add new content to the existing SQL object.

Copy link

@zaoral zaoral left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

HI @samirGuesmi !
Thank you for the PR
Only we suggest one small change related to a warning that is raise in runbot,
Please could you add it to this PR?

Best Rergards

cc @cav-adhoc @vib-adhoc

<field name="products_count" />
<field name="description" />
<templates>
<t t-name="kanban-box">
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To avoid warning in runbot please change to card. for more info go to
odoo/odoo@233f03d

Suggested change
<t t-name="kanban-box">
<t t-name="card">

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@samirGuesmi I've pushed this change because I needed our pipelines to be green :-)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@marielejeune thanks 😃

<field name="description" />
<templates>
<t t-name="card">
<div class="oe_kanban_global_click">

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

class oe_kanban_global_click is deprecated in this PR: odoo/odoo#167751

alt="Logo"
/>
</div>
<div class="oe_kanban_details">

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oe_kanban_details is the same above

<t t-name="card">
<div class="oe_kanban_global_click">
<div class="o_kanban_image">
<img
Copy link

@xaviedoanhduy xaviedoanhduy Dec 3, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please replace this img block to <field name="logo" widget="image" class="oe_avatar" /> to fix this error below when click link to product brand from product template:

image

<field name="model">product.brand</field>
<field name="arch" type="xml">
<kanban>
<field name="id" />

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
<field name="id" />

return SQL(select_str)

@api.model
def _group_by(self):

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
def _group_by(self):
def _group_by(self) -> SQL::
return SQL("%s, template.product_brand_id", super()._group_by())

product_brand_id = fields.Many2one(comodel_name="product.brand", string="Brand")

@api.model
def _select(self):

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
def _select(self):
def _select(self) -> SQL:
return SQL("%s, template.product_brand_id as product_brand_id", super()._select())

@xaviedoanhduy
Copy link

please name the pull request following this pattern: [18.0][MIG] <module>: Migration to 18.0

Copy link

@luc-adhoc luc-adhoc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

functional review

@xaviedoanhduy
Copy link

Hi, I created #215 to follow-up on your PR with the needed changes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.