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] mrp_bom_attribute_match #933

Open
wants to merge 19 commits into
base: 16.0
Choose a base branch
from

Conversation

mymage
Copy link
Member

@mymage mymage commented Jan 3, 2023

No description provided.

@mymage mymage mentioned this pull request Jan 3, 2023
27 tasks
@mymage mymage force-pushed the 16.0-mig-mrp_bom_attribute_match branch 13 times, most recently from 523d47b to c1e4c92 Compare January 3, 2023 19:55
@github-actions
Copy link

github-actions bot commented May 7, 2023

There hasn't been any activity on this pull request in the past 4 months, so it has been marked as stale and it will be closed automatically if no further activity occurs in the next 30 days.
If you want this PR to never become stale, please ask a PSC member to apply the "no stale" label.

@github-actions github-actions bot added the stale PR/Issue without recent activity, it'll be soon closed automatically. label May 7, 2023
@github-actions github-actions bot closed this Jun 11, 2023
@giarve
Copy link

giarve commented Jan 9, 2024

@mymage If you are willing to reopen the PR I can make sure it gets merged this time (+2 reviewers)

(although some PRs with fixes have been merged in between)

@mymage
Copy link
Member Author

mymage commented Jan 10, 2024

@giarve Thanks for your help.
I think that only a PSC can reopen this PR so I ask @OCA/manufacturing-maintainers to do that, thanks.

@grindtildeath grindtildeath reopened this Jan 10, 2024
@grindtildeath
Copy link
Contributor

/ocabot migration mrp_bom_attribute_match

@OCA-git-bot OCA-git-bot added this to the 16.0 milestone Jan 10, 2024
@mymage
Copy link
Member Author

mymage commented Jan 10, 2024

Thanks @grindtildeath.
@giarve Ops... there are some test to fix. I'll look on the WE if I'm able to solve it, if not I'll ask for your help ;-)

@giarve
Copy link

giarve commented Jan 10, 2024

Thanks @grindtildeath. @giarve Ops... there are some test to fix. I'll look on the WE if I'm able to solve it, if not I'll ask for your help ;-)

Great!

There are also these fixes available now

#958

#1090

#1100

#1172

@grindtildeath grindtildeath added no stale Use this label to prevent the automated stale action from closing this PR/Issue. and removed stale PR/Issue without recent activity, it'll be soon closed automatically. labels Jan 10, 2024
@giarve
Copy link

giarve commented Jan 11, 2024

We also found another small problem. If you do not set this flag for the user

Untitled

it raises an error:

Untitled

The failing test may be unrelated (did not check yet)

@mymage mymage force-pushed the 16.0-mig-mrp_bom_attribute_match branch 3 times, most recently from 843a591 to f3fe92b Compare January 14, 2024 19:06
@mymage mymage force-pushed the 16.0-mig-mrp_bom_attribute_match branch 4 times, most recently from a32e85c to 33ae3a0 Compare February 9, 2024 21:04
ilyasProgrammer and others added 19 commits February 9, 2024 22:45
Currently translated at 83.3% (15 of 18 strings)

Translation: manufacture-14.0/manufacture-14.0-mrp_bom_attribute_match
Translate-URL: https://translation.odoo-community.org/projects/manufacture-14-0/manufacture-14-0-mrp_bom_attribute_match/hr/
Currently translated at 100.0% (16 of 16 strings)

Translation: manufacture-14.0/manufacture-14.0-mrp_bom_attribute_match
Translate-URL: https://translation.odoo-community.org/projects/manufacture-14-0/manufacture-14-0-mrp_bom_attribute_match/it/
Notes:

* `_get_product2bom` renamed to `_bom_find`
* Test case `test_manufacturing_order_2`:
  * No longer check for "Add some materials to consume before marking this MO as to do.",
    as it's already supported in core since odoo/odoo@bf5e1debf
The check expects a single record, so it should be processed accordingly.
These methods shouldn't be exposed to xmlrpc.
The same result can be achieved with a computed field.
Moreover, we have one already in odoo core. Originally it was a related
field, but we can change it to a computed and add our extra logic there.
Instead of updates triggered by onchanges or writes, use constraints
to execute all checks, and a computed field for `match_on_attribute_ids`
Currently translated at 100.0% (19 of 19 strings)

Translation: manufacture-15.0/manufacture-15.0-mrp_bom_attribute_match
Translate-URL: https://translation.odoo-community.org/projects/manufacture-15-0/manufacture-15-0-mrp_bom_attribute_match/it/
Currently translated at 100.0% (19 of 19 strings)

Translation: manufacture-15.0/manufacture-15.0-mrp_bom_attribute_match
Translate-URL: https://translation.odoo-community.org/projects/manufacture-15-0/manufacture-15-0-mrp_bom_attribute_match/it/
@mymage mymage force-pushed the 16.0-mig-mrp_bom_attribute_match branch from 33ae3a0 to 5ee00e3 Compare February 9, 2024 21:45
@mymage
Copy link
Member Author

mymage commented Feb 9, 2024

@giarve sorry, I tried with the #958 but the problems come back so I went back to the original version.
Let me know if you can do the cherry-picking yourself or if you want me to reactivate the PR and then import the fixes with new PRs

@giarve
Copy link

giarve commented Feb 10, 2024

@giarve sorry, I tried with the #958 but the problems come back so I went back to the original version. Let me know if you can do the cherry-picking yourself or if you want me to reactivate the PR and then import the fixes with new PRs

No problem. I made a new branch migrating from 14.0 which has the latest changes. I still have to test everything but with WinMerge it looked really similar to 15.0

https://github.com/wvbs/manufacture/commits/16.0-mig-mrp_bom_attribute_match/

You can use this branch from now on. I added your changes, but it has all the fixes for 14.0. We will have to see if tests pass (EDIT: they don't, I messed up somewhere when merging). Something else to consider is that we must also migrate mrp_account_bom_attribute_match with a new PR (EDIT: #1200)

I didn't want to force push on this PR without permission

@mymage
Copy link
Member Author

mymage commented Feb 10, 2024

No problem. I made a new branch migrating from 14.0 ...

You are moving me to "new level" of cooperation: thank for your trust, I will do my best to complete this task.

@giarve
Copy link

giarve commented Feb 11, 2024

No problem. I made a new branch migrating from 14.0 ...

You are moving me to "new level" of cooperation: thank for your trust, I will do my best to complete this task.

More tests are passing now.

you can switch the branch in this PR to the new one if you wish.

mrp_report_bom_structure.py has to be rewritten entirely as the function names that were being overwritten are different in 16.0

@giarve
Copy link

giarve commented Feb 11, 2024

After a few fixes seems that only this button is still failing:
image

Traceback (most recent call last):
  File "/opt/odoo/custom/src/odoo/odoo/models.py", line 5165, in ensure_one
    _id, = self._ids
ValueError: not enough values to unpack (expected 1, got 0)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/opt/odoo/custom/src/odoo/odoo/http.py", line 1591, in _serve_db
    return service_model.retrying(self._serve_ir_http, self.env)
  File "/opt/odoo/custom/src/odoo/odoo/service/model.py", line 133, in retrying
    result = func()
  File "/opt/odoo/custom/src/odoo/odoo/http.py", line 1618, in _serve_ir_http
    response = self.dispatcher.dispatch(rule.endpoint, args)
  File "/opt/odoo/custom/src/odoo/odoo/http.py", line 1822, in dispatch
    result = self.request.registry['ir.http']._dispatch(endpoint)
  File "/opt/odoo/custom/src/odoo/odoo/addons/base/models/ir_http.py", line 154, in _dispatch
    result = endpoint(**request.params)
  File "/opt/odoo/custom/src/odoo/odoo/http.py", line 697, in route_wrapper
    result = endpoint(self, *args, **params_ok)
  File "/opt/odoo/auto/addons/web/controllers/dataset.py", line 46, in call_button
    action = self._call_kw(model, method, args, kwargs)
  File "/opt/odoo/auto/addons/web/controllers/dataset.py", line 33, in _call_kw
    return call_kw(request.env[model], method, args, kwargs)
  File "/opt/odoo/custom/src/odoo/odoo/api.py", line 466, in call_kw
    result = _call_kw_multi(method, model, args, kwargs)
  File "/opt/odoo/custom/src/odoo/odoo/api.py", line 453, in _call_kw_multi
    result = method(recs, *args, **kwargs)
  File "/opt/odoo/auto/addons/mrp_account/models/product.py", line 29, in button_bom_cost
    self._set_price_from_bom()
  File "/opt/odoo/auto/addons/mrp_account/models/product.py", line 40, in _set_price_from_bom
    self.standard_price = self._compute_bom_price(bom, boms_to_recompute=boms_to_recompute)
  File "/opt/odoo/auto/addons/mrp_subcontracting_account/models/product_product.py", line 12, in _compute_bom_price
    price = super()._compute_bom_price(bom, boms_to_recompute, byproduct_bom)
  File "/opt/odoo/auto/addons/mrp_account/models/product.py", line 93, 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 "/opt/odoo/auto/addons/uom/models/uom_uom.py", line 231, in _compute_price
    self.ensure_one()
  File "/opt/odoo/custom/src/odoo/odoo/models.py", line 5168, in ensure_one
    raise ValueError("Expected singleton: %s" % self)
ValueError: Expected singleton: uom.uom()

@mymage mymage marked this pull request as ready for review February 15, 2024 19:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
no stale Use this label to prevent the automated stale action from closing this PR/Issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants