diff options
| author | stephanchrst <stephanchrst@gmail.com> | 2022-11-14 16:20:43 +0700 |
|---|---|---|
| committer | stephanchrst <stephanchrst@gmail.com> | 2022-11-14 16:20:43 +0700 |
| commit | 61ada75c5d0e065d62c2aea0c59c153446bbf56c (patch) | |
| tree | 0392b2cb93b26aa9b914721c9e3bd3e790d8cdd7 | |
| parent | 20b2bd76be6052a1a3b2e3b61c027fe91f5046a9 (diff) | |
qty delivered cant greater than qty so validation
| -rw-r--r-- | indoteknik_custom/models/stock_picking.py | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/indoteknik_custom/models/stock_picking.py b/indoteknik_custom/models/stock_picking.py index 2f82c6f6..2bdfbd9e 100644 --- a/indoteknik_custom/models/stock_picking.py +++ b/indoteknik_custom/models/stock_picking.py @@ -111,12 +111,18 @@ class StockPicking(models.Model): def button_validate(self): if not self.picking_code: self.picking_code = self.env['ir.sequence'].next_by_code('stock.picking.code') or '0' - + if self.picking_type_id.code == 'incoming' and self.group_id.id == False and self.is_internal_use == False: raise UserError(_('Tidak bisa Validate jika tidak dari Document SO / PO')) if self.is_internal_use and not self.env.user.is_accounting: raise UserError("Harus di Approve oleh Accounting") + + for line in self.move_line_ids_without_package: + if line.move_id.sale_line_id and self.picking_type_id.code == 'outgoing': + if line.move_id.sale_line_id.qty_delivered + line.qty_done > line.move_id.sale_line_id.product_uom_qty: + raise UserError("Qty Delivered akan lebih dari Qty SO") + res = super(StockPicking, self).button_validate() return res |
