diff options
| author | Miqdad <ahmadmiqdad27@gmail.com> | 2025-08-21 16:19:50 +0700 |
|---|---|---|
| committer | Miqdad <ahmadmiqdad27@gmail.com> | 2025-08-21 16:19:50 +0700 |
| commit | 1043e2f2b9630b8b622a9bc5070bf167d17e08d7 (patch) | |
| tree | 8fe136db08053e3b05e187d820d1b4802fb19c31 /indoteknik_custom/models/stock_picking.py | |
| parent | 0e4e1eaf30f79afb2b9885c897b8a8a2044f8509 (diff) | |
| parent | fc6f0a00ab98a72ad3d08f1d5ad6f8120e21814a (diff) | |
Merge branch 'odoo-backup' of https://bitbucket.org/altafixco/indoteknik-addons into block_manual_input_stock_picking
Diffstat (limited to 'indoteknik_custom/models/stock_picking.py')
| -rw-r--r-- | indoteknik_custom/models/stock_picking.py | 37 |
1 files changed, 12 insertions, 25 deletions
diff --git a/indoteknik_custom/models/stock_picking.py b/indoteknik_custom/models/stock_picking.py index 534b1ff1..a48e0ed1 100644 --- a/indoteknik_custom/models/stock_picking.py +++ b/indoteknik_custom/models/stock_picking.py @@ -1330,18 +1330,20 @@ class StockPicking(models.Model): current_time = datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S') self.date_reserved = current_time + # Validate Qty Demand Can't higher than Qty Product - for move_line in self.move_line_ids_without_package: - purchase_line = move_line.move_id.purchase_line_id - if purchase_line: - if purchase_line.product_uom_qty < move_line.product_uom_qty: - raise UserError( - _("Quantity demand (%s) tidak bisa lebih besar dari qty product (%s) untuk produk %s") % ( - move_line.product_uom_qty, - purchase_line.product_uom_qty, - move_line.product_id.display_name + if self.location_dest_id.id == 58 and 'BU/INPUT/' in self.name: + for move in self.move_ids_without_package: + purchase_line = move.purchase_line_id + if purchase_line: + if purchase_line.product_qty < move.quantity_done: + raise UserError( + _("Quantity demand (%s) tidak bisa lebih besar dari qty product (%s) untuk produk %s") % ( + move.quantity_done, + purchase_line.product_qty, + move.product_id.display_name + ) ) - ) self.validation_minus_onhand_quantity() self.responsible = self.env.user.id @@ -2086,21 +2088,6 @@ class CheckProduct(models.Model): status = fields.Char(string='Status', compute='_compute_status') code_product = fields.Char(string='Code Product') - def write(self, vals): - if 'code_product' in vals and not self.env.context.get('from_barcode_scan'): - raise UserError("Field Code Product hanya bisa diisi melalui barcode scan.") - res = super().write(vals) - # konsolidasi dll milik Anda tetap jalan - if not self.env.context.get('skip_consolidate'): - self.with_context(skip_consolidate=True)._consolidate_duplicate_lines() - return res - - # Scanner handler - def on_barcode_scanned(self, barcode): - self.ensure_one() - self.with_context(from_barcode_scan=True).write({'code_product': barcode}) - self._onchange_code_product() - @api.onchange('code_product') def _onchange_code_product(self): if not self.code_product: |
