diff options
| author | IT Fixcomart <it@fixcomart.co.id> | 2022-11-18 11:14:53 +0700 |
|---|---|---|
| committer | IT Fixcomart <it@fixcomart.co.id> | 2022-11-18 11:14:53 +0700 |
| commit | 3636010794b53f97ee50fdcd24f4059f717a6624 (patch) | |
| tree | 3d602ede3a5ec6930b3511a4285227f9d20812d1 | |
| parent | 5d1d53268d836c0b650654e8fc6934fbebd2f6e5 (diff) | |
| parent | 96af7230bdd79234fadeca8110b65dafa5b70a53 (diff) | |
Merge branch 'master' of bitbucket.org:altafixco/indoteknik-addons
| -rw-r--r-- | indoteknik_custom/models/stock_picking.py | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/indoteknik_custom/models/stock_picking.py b/indoteknik_custom/models/stock_picking.py index 2bdfbd9e..dc30570e 100644 --- a/indoteknik_custom/models/stock_picking.py +++ b/indoteknik_custom/models/stock_picking.py @@ -118,6 +118,19 @@ class StockPicking(models.Model): if self.is_internal_use and not self.env.user.is_accounting: raise UserError("Harus di Approve oleh Accounting") + if self.is_internal_use: + stock_move_lines = self.env['stock.move.line'].search([ + ('picking_id', '!=', False), + ('product_id', '=', 236805), + ('picking_id.partner_id', '=', self.partner_id.id), + ('qty_done', '>', 0), + ]) + list_state = ['confirmed', 'done'] + for stock_move_line in stock_move_lines: + if stock_move_line.picking_id.state not in list_state: + continue + raise UserError('Sudah pernah dikirim kalender') + 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: |
