Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
bealdav committed Apr 2, 2024
1 parent 6a31aa5 commit 67fb6ef
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 11 deletions.
2 changes: 1 addition & 1 deletion purchase_update_proposal/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,5 @@
],
"installable": True,
"development_status": "Alpha",
"maintainers": ["bealdav"],
"maintainers": ["bealdav", "FranzPoize"],
}
16 changes: 6 additions & 10 deletions purchase_update_proposal/models/purchase_order.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ def _check_updatable_proposal(self):
else:
prevent_update = prevent_update or False
if prevent_update:
# TODO : in 16.0 or later we might rise this restriction
rec.proposal_updatable = "no"
else:
rec.proposal_updatable = "yes"
Expand Down Expand Up @@ -122,9 +123,9 @@ def approve_proposal(self):
self._check_updatable_proposal()
if self.proposal_updatable == "no":
# example: qty is in proposal and purchase is partially received
# TODO : in 16.0 or later we might rise this restriction
return
body = []
initial_state = False
# these proposals'll reset these lines
lines_to_0 = self.proposal_ids.filtered(lambda s: s.qty == 0.0).mapped(
"line_id"
Expand All @@ -137,15 +138,14 @@ def approve_proposal(self):
"approved",
]:
# We have to reset order because of changed qty in confirmed order
initial_state = self.state
self.action_cancel()
self.action_cancel_draft()
self._update_proposal_to_purchase_line(data, body)
self.message_post(body="\n".join(body))
if initial_state in ("approved", "confirmed"):
# altered quantity implied to reset order, then we approve them again
self.signal_workflow("purchase_confirm")
self.signal_workflow("purchase_approve")
# if initial_state in ("approved", "confirmed"):
# # altered quantity implied to reset order, then we approve them again
# self.signal_workflow("purchase_confirm")
# self.signal_workflow("purchase_approve")
# Cancellation cases
if lines_to_0:
lines_to_0.cancel_from_proposal()
Expand All @@ -165,10 +165,6 @@ def _product_qty_key_in_data(self, data):
qty2update = qty2update or False
return qty2update

def _hook_for_cancel_process(self):
"TODO remove: Kept for compatibility"
self._hook_pending_proposal_approval()

def _hook_pending_proposal_approval(self):
"""Cancellation here is a fake one, in fact it's a workaround
to cleanly update purchase when picking has been created.
Expand Down

0 comments on commit 67fb6ef

Please sign in to comment.