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

[16.0] [MIG] product_brand #132

Merged
merged 51 commits into from
Oct 19, 2022
Merged

Conversation

marielejeune
Copy link
Contributor

No description provided.

bguillot and others added 30 commits October 10, 2022 10:35
* 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/
@marielejeune
Copy link
Contributor Author

TODO: fix the openupgradelib dependency to benefit from https://github.com/OCA/openupgradelib/blob/master/openupgradelib/openupgrade_160.py

@marielejeune marielejeune marked this pull request as ready for review October 10, 2022 10:00
Copy link

@lmignon lmignon left a comment

Choose a reason for hiding this comment

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

@marielejeune When I try to open the product form, an exception occurs:

Traceback (most recent call last):
  File "/opt/odoo/odoo/api.py", line 983, in get
    cache_value = field_cache[record._ids[0]]
KeyError: 12

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/opt/odoo/odoo/fields.py", line 1132, in __get__
    value = env.cache.get(record, self)
  File "/opt/odoo/odoo/api.py", line 990, in get
    raise CacheMiss(record, field)
odoo.exceptions.CacheMiss: 'product.product(12,).sales_count'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/opt/odoo/odoo/http.py", line 1534, in _serve_db
    return service_model.retrying(self._serve_ir_http, self.env)
  File "/opt/odoo/odoo/service/model.py", line 134, in retrying
    result = func()
  File "/opt/odoo/odoo/http.py", line 1563, in _serve_ir_http
    response = self.dispatcher.dispatch(rule.endpoint, args)
  File "/opt/odoo/odoo/http.py", line 1760, in dispatch
    result = self.request.registry['ir.http']._dispatch(endpoint)
  File "/opt/odoo/odoo/addons/base/models/ir_http.py", line 138, in _dispatch
    result = endpoint(**request.params)
  File "/opt/odoo/odoo/http.py", line 673, in route_wrapper
    result = endpoint(self, *args, **params_ok)
  File "/opt/odoo/addons/web/controllers/dataset.py", line 42, in call_kw
    return self._call_kw(model, method, args, kwargs)
  File "/opt/odoo/addons/web/controllers/dataset.py", line 33, in _call_kw
    return call_kw(request.env[model], method, args, kwargs)
  File "/opt/odoo/odoo/api.py", line 461, in call_kw
    result = _call_kw_multi(method, model, args, kwargs)
  File "/opt/odoo/odoo/api.py", line 448, in _call_kw_multi
    result = method(recs, *args, **kwargs)
  File "/opt/odoo/odoo/models.py", line 2991, in read
    return self._read_format(fnames=fields, load=load)
  File "/opt/odoo/odoo/models.py", line 3131, in _read_format
    vals[name] = convert(record[name], record, use_name_get)
  File "/opt/odoo/odoo/models.py", line 5841, in __getitem__
    return self._fields[key].__get__(self, type(self))
  File "/opt/odoo/odoo/fields.py", line 1181, in __get__
    self.compute_value(recs)
  File "/opt/odoo/odoo/fields.py", line 1340, in compute_value
    records._compute_field_value(self)
  File "/opt/odoo/addons/mail/models/mail_thread.py", line 403, in _compute_field_value
    return super()._compute_field_value(field)
  File "/opt/odoo/odoo/models.py", line 4186, in _compute_field_value
    getattr(self, field.compute)()
  File "/opt/odoo/addons/sale/models/product_product.py", line 28, in _compute_sales_count
    for group in self.env['sale.report']._read_group(domain, ['product_id', 'product_uom_qty'], ['product_id']):
  File "/opt/odoo/odoo/models.py", line 2176, in _read_group
    return self.read_group(domain, fields, groupby, offset, limit, orderby, lazy)
  File "/opt/odoo/odoo/models.py", line 2216, in read_group
    result = self._read_group_raw(domain, fields, groupby, offset=offset, limit=limit, orderby=orderby, lazy=lazy)
  File "/opt/odoo/odoo/models.py", line 2241, in _read_group_raw
    query = self._where_calc(domain)
  File "/opt/odoo/odoo/models.py", line 4386, in _where_calc
    return expression.expression(domain, self).query
  File "/opt/odoo/odoo/osv/expression.py", line 444, in __init__
    self.query = Query(model.env.cr, model._table, model._table_query) if query is None else query
  File "/opt/odoo/addons/sale/report/sale_report.py", line 202, in _table_query
    return self._query()
  File "/mnt/data/odoo-addons-dir/product_brand/reports/sale_report.py", line 17, in _query
    return super()._query(with_clause, fields, groupby, from_clause)
TypeError: SaleReport._query() takes 1 positional argument but 5 were given

@lmignon
Copy link

lmignon commented Oct 19, 2022

@marielejeune I took the liberty to fix the remaining error to move forward with this PR....

@lmignon
Copy link

lmignon commented Oct 19, 2022

/ocabot migration product_brand

@OCA-git-bot
Copy link
Contributor

Sorry @lmignon you are not allowed to mark the addon tobe migrated.

To do so you must either have push permissions on the repository, or be a declared maintainer of all modified addons.

If you wish to adopt an addon and become it's maintainer, open a pull request to add your GitHub login to the maintainers key of its manifest.

@pedrobaeza
Copy link
Member

/ocabot migration product_brand

Copy link

@lmignon lmignon left a comment

Choose a reason for hiding this comment

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

The remaining errors are now fixed.
LGTM (Code review + functional tests)

@pedrobaeza
Copy link
Member

/ocabot merge nobump

@OCA-git-bot
Copy link
Contributor

On my way to merge this fine PR!
Prepared branch 16.0-ocabot-merge-pr-132-by-pedrobaeza-bump-nobump, awaiting test results.

@OCA-git-bot OCA-git-bot merged commit f12b07b into OCA:16.0 Oct 19, 2022
@OCA-git-bot
Copy link
Contributor

Congratulations, your PR was merged at 33440f4. Thanks a lot for contributing to OCA. ❤️

@lmignon
Copy link

lmignon commented Oct 19, 2022

thank you @pedrobaeza for the merge!

@lmignon lmignon deleted the 16.0-mig-product_brand branch October 19, 2022 14:45
@pedrobaeza
Copy link
Member

You're welcome 😃

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

Successfully merging this pull request may close these issues.