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

[MIG][BACKPORT][12.0] ddmrp #63

Closed
wants to merge 191 commits into from
Closed

[MIG][BACKPORT][12.0] ddmrp #63

wants to merge 191 commits into from

Conversation

mileo
Copy link
Member

@mileo mileo commented Aug 20, 2020

No description provided.

JordiBForgeFlow and others added 30 commits August 19, 2020 18:22
Sometimes procurements are over-fulfilled so the subtract qty becomes negative, we don't want to apply it in that case, since we will be taking into account some stock moves twice.
OCA-git-bot and others added 16 commits August 19, 2020 18:22
Updated by "Update PO files to match POT (msgmerge)" hook in Weblate.

Translation: ddmrp-13.0/ddmrp-13.0-ddmrp
Translate-URL: https://translation.odoo-community.org/projects/ddmrp-13-0/ddmrp-13-0-ddmrp/
Updated by "Update PO files to match POT (msgmerge)" hook in Weblate.

Translation: ddmrp-13.0/ddmrp-13.0-ddmrp
Translate-URL: https://translation.odoo-community.org/projects/ddmrp-13-0/ddmrp-13-0-ddmrp/
Updated by "Update PO files to match POT (msgmerge)" hook in Weblate.

Translation: ddmrp-13.0/ddmrp-13.0-ddmrp
Translate-URL: https://translation.odoo-community.org/projects/ddmrp-13-0/ddmrp-13-0-ddmrp/
Currently translated at 6.1% (15 of 247 strings)

Translation: ddmrp-13.0/ddmrp-13.0-ddmrp
Translate-URL: https://translation.odoo-community.org/projects/ddmrp-13-0/ddmrp-13-0-ddmrp/fr/
Currently translated at 15.0% (37 of 247 strings)

Translation: ddmrp-13.0/ddmrp-13.0-ddmrp
Translate-URL: https://translation.odoo-community.org/projects/ddmrp-13-0/ddmrp-13-0-ddmrp/fr/
Signed-off-by: Luis Felipe Mileo <mileo@kmee.com.br>
Signed-off-by: Luis Felipe Mileo <mileo@kmee.com.br>
Signed-off-by: Luis Felipe Mileo <mileo@kmee.com.br>
Signed-off-by: Luis Felipe Mileo <mileo@kmee.com.br>
@OCA-git-bot
Copy link
Contributor

Hi @JordiBForgeFlow, @LoisRForgeFlow,
some modules you are maintaining are being modified, check this out!

@max3903 max3903 added this to the 12.0 milestone Aug 26, 2021
@max3903 max3903 mentioned this pull request Sep 9, 2021
23 tasks
@max3903
Copy link
Sponsor Member

max3903 commented Sep 9, 2021

@mileo I get the following error message when confirming a purchase order created from the buffer:

Error:
Odoo Server Error

Traceback (most recent call last):
  File "/opt/odoo/env/lib/python3.6/site-packages/odoo-12.0-py3.6.egg/odoo/http.py", line 654, in _handle_exception
    return super(JsonRequest, self)._handle_exception(exception)
  File "/opt/odoo/env/lib/python3.6/site-packages/odoo-12.0-py3.6.egg/odoo/http.py", line 312, in _handle_exception
    raise pycompat.reraise(type(exception), exception, sys.exc_info()[2])
  File "/opt/odoo/env/lib/python3.6/site-packages/odoo-12.0-py3.6.egg/odoo/tools/pycompat.py", line 87, in reraise
    raise value
  File "/opt/odoo/env/lib/python3.6/site-packages/odoo-12.0-py3.6.egg/odoo/http.py", line 696, in dispatch
    result = self._call_function(**self.params)
  File "/opt/odoo/env/lib/python3.6/site-packages/odoo-12.0-py3.6.egg/odoo/http.py", line 344, in _call_function
    return checked_call(self.db, *args, **kwargs)
  File "/opt/odoo/env/lib/python3.6/site-packages/odoo-12.0-py3.6.egg/odoo/service/model.py", line 97, in wrapper
    return f(dbname, *args, **kwargs)
  File "/opt/odoo/env/lib/python3.6/site-packages/odoo-12.0-py3.6.egg/odoo/http.py", line 337, in checked_call
    result = self.endpoint(*a, **kw)
  File "/opt/odoo/env/lib/python3.6/site-packages/odoo-12.0-py3.6.egg/odoo/http.py", line 939, in __call__
    return self.method(*args, **kw)
  File "/opt/odoo/env/lib/python3.6/site-packages/odoo-12.0-py3.6.egg/odoo/http.py", line 517, in response_wrap
    response = f(*args, **kw)
  File "/opt/odoo/odoo/addons/web/controllers/main.py", line 967, in call_button
    action = self._call_kw(model, method, args, {})
  File "/opt/odoo/odoo/addons/web/controllers/main.py", line 955, in _call_kw
    return call_kw(request.env[model], method, args, kwargs)
  File "/opt/odoo/env/lib/python3.6/site-packages/odoo-12.0-py3.6.egg/odoo/api.py", line 749, in call_kw
    return _call_kw_multi(method, model, args, kwargs)
  File "/opt/odoo/env/lib/python3.6/site-packages/odoo-12.0-py3.6.egg/odoo/api.py", line 736, in _call_kw_multi
    result = method(recs, *args, **kwargs)
  File "/opt/odoo/odoo/addons/purchase/models/purchase.py", line 330, in button_confirm
    order.button_approve()
  File "/opt/odoo/odoo/addons/purchase_stock/models/purchase.py", line 87, in button_approve
    self._create_picking()
  File "/opt/odoo/odoo/addons/purchase_stock/models/purchase.py", line 209, in _create_picking
    moves = moves.filtered(lambda x: x.state not in ('done', 'cancel'))._action_confirm()
  File "/opt/odoo/odoo/addons/mrp/models/stock_move.py", line 152, in _action_confirm
    return super(StockMove, moves)._action_confirm(merge=merge, merge_into=merge_into)
  File "/opt/odoo/odoo/addons/stock/models/stock_move.py", line 767, in _action_confirm
    move_to_confirm.write({'state': 'confirmed'})
  File "/opt/odoo/src/oca-addons/ddmrp/models/stock_move.py", line 27, in write
    if "state" in vals and self.company_id.ddmrp_auto_update_nfp:
  File "/opt/odoo/env/lib/python3.6/site-packages/odoo-12.0-py3.6.egg/odoo/fields.py", line 969, in __get__
    record.ensure_one()
  File "/opt/odoo/env/lib/python3.6/site-packages/odoo-12.0-py3.6.egg/odoo/models.py", line 4662, in ensure_one
    raise ValueError("Expected singleton: %s" % self)
ValueError: Expected singleton: stock.move(435711, 435712, 435713, 435714, 435715, 435716, 435717, 435718, 435719, 435720, 435721, 435722, 435723, 435724, 435725, 435726, 435727, 435728, 435729, 435730, 435731, 435732, 435733, 435734, 435735, 435736, 435737, 435738, 435739, 435740, 435741, 435742, 435743, 435744, 435745, 435746, 435747, 435748, 435749)

Comment on lines 27 to 28
if "state" in vals and self.company_id.ddmrp_auto_update_nfp:
self._update_ddmrp_nfp()
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
if "state" in vals and self.company_id.ddmrp_auto_update_nfp:
self._update_ddmrp_nfp()
if "state" in vals:
for move in self.filtered(lambda m: m.company_id.ddmrp_auto_update_nfp):
move._update_ddmrp_nfp()

@max3903
Copy link
Sponsor Member

max3903 commented Sep 23, 2021

@mileo kmee#1

[FIX] ddmrp: ValueError: Expected singleton: stock.move(...)
def _calc_execution_priority(self):
# TODO: handle serveral buffers? worst scenario, average?
to_compute = self.filtered(
lambda r: r.buffer_ids and r.state not in ["done", "cancel"]
Copy link
Sponsor Member

@max3903 max3903 Sep 24, 2021

Choose a reason for hiding this comment

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

@mileo If you activate the purchase lock option in Purchase settings, when confirming the PO, the lines are already in state done when reaching this line and so the execution_priority_level and on_hand_percent are set to None.

CC: @LoisRForgeFlow

Copy link
Sponsor Member

Choose a reason for hiding this comment

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

@mileo @LoisRForgeFlow See kmee#2 for a possible solution. Feel free to implement a better one.

@github-actions
Copy link

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 Jan 30, 2022
@github-actions github-actions bot closed this Mar 6, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
migration needs fixing stale PR/Issue without recent activity, it'll be soon closed automatically.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet