Skip to content

Conversation

ivantodorovich
Copy link
Contributor

@ivantodorovich ivantodorovich commented Jan 31, 2023

This PR fixes two issues with this module:

  1. An issue with mrp_account's button "Compute Price from Bom"
  2. An issue with the Structure and Cost smart button

In both cases, when called on a bom that has a component template and no product_id set, a very similar traceback was raised:

  File "/odoo/src/addons/mrp_account/models/product.py", line 95, in _compute_bom_price
    total += line.product_id.uom_id._compute_price(line.product_id.standard_price, line.product_uom_id) * line.product_qty
  File "/odoo/src/addons/uom/models/uom_uom.py", line 234, in _compute_price
    self.ensure_one()
  File "/odoo/src/odoo/models.py", line 5207, in ensure_one
    raise ValueError("Expected singleton: %s" % self)
ExceptionThe above exception was the direct cause of the following exception:Traceback (most recent call last):
  File "/odoo/src/odoo/http.py", line 643, in _handle_exception
    return super(JsonRequest, self)._handle_exception(exception)
  File "/odoo/src/odoo/http.py", line 301, in _handle_exception
    raise exception.with_traceback(None) from new_cause
ValueError: Expected singleton: uom.uom()

NOTE: It's easier to review commit by commit

@ivantodorovich ivantodorovich force-pushed the 15.0-add-mrp-account-bom-attribute-match branch from 29939e1 to d04c8d9 Compare January 31, 2023 14:50
@ivantodorovich ivantodorovich force-pushed the 15.0-add-mrp-account-bom-attribute-match branch from d04c8d9 to c39e5bb Compare January 31, 2023 15:06
Copy link

@yankinmax yankinmax left a comment

Choose a reason for hiding this comment

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

Not familiar with the module: code seems ok.

Copy link

@jcoux jcoux left a comment

Choose a reason for hiding this comment

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

Technically seems good 👍

Copy link
Member

@ilyasProgrammer ilyasProgrammer left a comment

Choose a reason for hiding this comment

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

LGTM

@francesco-ooops
Copy link
Contributor

@OCA/manufacturing-maintainers could this be merged? :)

@francesco-ooops
Copy link
Contributor

@pedrobaeza what do you think?

@pedrobaeza pedrobaeza added this to the 15.0 milestone Feb 14, 2023
@pedrobaeza
Copy link
Member

Please squash a bit the commit history.

@ivantodorovich
Copy link
Contributor Author

Hello @pedrobaeza !

As it is right now, each commit is atomic, taking care of a specific concern.
Squashing would make the history dificult to read.

@pedrobaeza
Copy link
Member

OK, as I haven't followed the thread, just do the administrative task given the reviews:

/ocabot merge minor

@OCA-git-bot
Copy link
Contributor

This PR looks fantastic, let's merge it!
Prepared branch 15.0-ocabot-merge-pr-958-by-pedrobaeza-bump-minor, awaiting test results.

@ivantodorovich
Copy link
Contributor Author

Thanks 🙏🏻 !!

@OCA-git-bot OCA-git-bot merged commit b5568dd into OCA:15.0 Feb 14, 2023
@OCA-git-bot
Copy link
Contributor

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

@francesco-ooops
Copy link
Contributor

@ivantodorovich seems mrp_account_bom_attribute_match has corrupt readme, could you fix?

@ivantodorovich ivantodorovich deleted the 15.0-add-mrp-account-bom-attribute-match branch February 22, 2023 12:13
@ivantodorovich
Copy link
Contributor Author

Oops,. thanks for noticing @francesco-ooops !
Fixed here: #983

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.

7 participants