Skip to content

Commit

Permalink
[FIX] stock_ux: cancel remaining error
Browse files Browse the repository at this point in the history
  • Loading branch information
jok-adhoc committed Nov 30, 2022
1 parent 73226ba commit a2ba07c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
8 changes: 8 additions & 0 deletions stock_ux/models/stock_move.py
Expand Up @@ -167,3 +167,11 @@ def default_get(self, fields_list):
defaults['product_uom_qty'] = 0.0
defaults['additional'] = True
return defaults

@api.constrains('state')
def check_cancel(self):
if self._context.get('cancel_from_order'):
return
if self.filtered(
lambda x: x.picking_id and x.state == 'cancel' and not self.user_has_groups('stock_ux.allow_picking_cancellation')):
raise ValidationError("Only User with 'Picking cancelation allow' rights can cancel pickings")
8 changes: 0 additions & 8 deletions stock_ux/models/stock_picking.py
Expand Up @@ -118,14 +118,6 @@ def new_force_availability(self):
for line in rec.move_line_ids:
line.qty_done = line.product_uom_qty

@api.constrains('state')
def check_cancel(self):
if self._context.get('cancel_from_order'):
return
if self.filtered(
lambda x: x.state == 'cancel' and not self.user_has_groups('stock_ux.allow_picking_cancellation')):
raise ValidationError("Only User with 'Picking cancelation allow' rights can cancel pickings")

def _put_in_pack(self, move_line_ids):
# we send to skip a process of check qty when is sending through the copy method.
return super()._put_in_pack(move_line_ids.with_context(put_in_pack=True))

0 comments on commit a2ba07c

Please sign in to comment.