Skip to content

Commit

Permalink
[4121][IMP] stock_picking_validate_jobcan: _compute_show_jobcan_wf_nu…
Browse files Browse the repository at this point in the history
…mber() (#94)

No need to consider the owner with regards to the visibility of jobcan fields.
  • Loading branch information
yostashiro authored Sep 6, 2024
1 parent eac994e commit c4dbecb
Showing 1 changed file with 5 additions and 17 deletions.
22 changes: 5 additions & 17 deletions stock_picking_validate_jobcan_wf/models/stock_picking.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ class StockPicking(models.Model):
_inherit = ["stock.picking", "api.call.mixin"]

skip_jobcan_wf = fields.Boolean("Skip Jobcan Workflow", copy=False)
show_skip_jobcan_wf = fields.Boolean(compute="_compute_show_skip_jobcan_wf")
jobcan_wf_number = fields.Char("Jobcan Workflow Number", copy=False)
show_skip_jobcan_wf = fields.Boolean(compute="_compute_show_jobcan_wf_number")
show_jobcan_wf_number = fields.Boolean(compute="_compute_show_jobcan_wf_number")

def _is_outgoing(self):
Expand All @@ -34,26 +34,14 @@ def _receipt_return_picking(self):
return True
return False

def _compute_show_skip_jobcan_wf(self):
for pick in self:
pick.show_skip_jobcan_wf = False
if (
pick._is_outgoing()
and not pick._receipt_return_picking()
and not pick.move_line_ids.mapped("owner_id")
):
pick.show_skip_jobcan_wf = True

@api.depends("skip_jobcan_wf")
def _compute_show_jobcan_wf_number(self):
for pick in self:
pick.show_skip_jobcan_wf = False
pick.show_jobcan_wf_number = False
if (
pick._is_outgoing()
and not pick._receipt_return_picking()
and not pick.skip_jobcan_wf
):
pick.show_jobcan_wf_number = True
if pick._is_outgoing() and not pick._receipt_return_picking():
pick.show_skip_jobcan_wf = True
pick.show_jobcan_wf_number = not pick.skip_jobcan_wf

def get_api_key(self, config):
api_key = super().get_api_key(config)
Expand Down

0 comments on commit c4dbecb

Please sign in to comment.