diff options
| author | Indoteknik . <it@fixcomart.co.id> | 2025-08-21 20:03:48 +0700 |
|---|---|---|
| committer | Indoteknik . <it@fixcomart.co.id> | 2025-08-21 20:03:48 +0700 |
| commit | 0aa596341f2832ca17e713450f64d7f7f9b1ba4c (patch) | |
| tree | 57e19bbb32007fe355515fa56d22104a1185dc96 /indoteknik_custom/models/stock_picking.py | |
| parent | c8ca82a47aca049cddf6a741477b7b06d20f8dea (diff) | |
| parent | 4b549234856b810bd99f8b1e18e01da90ccdc1e1 (diff) | |
Merge branch 'odoo-backup' of https://bitbucket.org/altafixco/indoteknik-addons into reminder-tempo-v2
Diffstat (limited to 'indoteknik_custom/models/stock_picking.py')
| -rw-r--r-- | indoteknik_custom/models/stock_picking.py | 39 |
1 files changed, 13 insertions, 26 deletions
diff --git a/indoteknik_custom/models/stock_picking.py b/indoteknik_custom/models/stock_picking.py index 3d04a416..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 @@ -2070,7 +2072,7 @@ class CheckProduct(models.Model): _name = 'check.product' _description = 'Check Product' _order = 'picking_id, id' - _inherit = ['barcodes.barcode_events_mixin'] # ⬅️ aktifkan barcode handler + _inherit = ['barcodes.barcode_events_mixin'] picking_id = fields.Many2one( @@ -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: |
