diff options
| author | Azka Nathan <darizkyfaz@gmail.com> | 2024-02-07 10:45:51 +0700 |
|---|---|---|
| committer | Azka Nathan <darizkyfaz@gmail.com> | 2024-02-07 10:45:51 +0700 |
| commit | f6be42d37a363b86f4a9ec71ccb38c78cbe2d887 (patch) | |
| tree | 9c297e776f67e35671012e94d3c64007bd5090d7 /indoteknik_custom/models/stock_picking.py | |
| parent | edb3c1c80931078d40a8f56149aeca9efdcdc07d (diff) | |
| parent | 29a9ec94f1ad131f398cf119a03a7b927a4c6cba (diff) | |
Merge branch 'production' into purchasing-job
# Conflicts:
# indoteknik_custom/__manifest__.py
# indoteknik_custom/models/__init__.py
# indoteknik_custom/models/automatic_purchase.py
# indoteknik_custom/models/purchase_order_line.py
# indoteknik_custom/security/ir.model.access.csv
# indoteknik_custom/views/automatic_purchase.xml
# indoteknik_custom/views/purchase_order.xml
Diffstat (limited to 'indoteknik_custom/models/stock_picking.py')
| -rw-r--r-- | indoteknik_custom/models/stock_picking.py | 37 |
1 files changed, 36 insertions, 1 deletions
diff --git a/indoteknik_custom/models/stock_picking.py b/indoteknik_custom/models/stock_picking.py index a5e533b1..33946f86 100644 --- a/indoteknik_custom/models/stock_picking.py +++ b/indoteknik_custom/models/stock_picking.py @@ -69,13 +69,27 @@ class StockPicking(models.Model): note_logistic = fields.Selection([ ('hold', 'Hold by Sales'), ('not_paid', 'Customer belum bayar'), - ('partial', 'Kirim Parsial') + ('partial', 'Kirim Parsial'), + ('not_complete', 'Belum Lengkap'), + ('indent', 'Indent') ], string='Note Logistic', help='jika field ini diisi maka tidak akan dihitung ke lead time') waybill_id = fields.One2many(comodel_name='airway.bill', inverse_name='do_id', string='Airway Bill') purchase_representative_id = fields.Many2one('res.users', related='move_lines.purchase_line_id.order_id.user_id', string="Purchase Representative", readonly=True) carrier_id = fields.Many2one('delivery.carrier', string='Shipping Method') shipping_status = fields.Char(string='Shipping Status', compute="_compute_shipping_status") date_reserved = fields.Datetime(string="Date Reserved", help='Tanggal ter-reserved semua barang nya') + status_printed = fields.Selection([ + ('not_printed', 'Belum Print'), + ('printed', 'Printed') + ], string='Printed?', copy=False) + date_unreserve = fields.Datetime(string="Date Unreserved", copy=False, tracking=True) + date_availability = fields.Datetime(string="Date Availability", copy=False, tracking=True) + + def do_unreserve(self): + res = super(StockPicking, self).do_unreserve() + current_time = datetime.datetime.utcnow() + self.date_unreserve = current_time + return res def _compute_shipping_status(self): for rec in self: @@ -200,7 +214,9 @@ class StockPicking(models.Model): def action_assign(self): res = super(StockPicking, self).action_assign() + current_time = datetime.datetime.utcnow() self.real_shipping_id = self.sale_id.real_shipping_id + self.date_availability = current_time return res def ask_approval(self): @@ -281,6 +297,23 @@ class StockPicking(models.Model): self.is_internal_use = self.picking_type_id.is_internal_use return + def validation_minus_onhand_quantity(self): + bu_location_id = 49 + for line in self.move_line_ids_without_package: + quant = self.env['stock.quant'].search([ + ('product_id', '=', line.product_id.id), + ('location_id', '=', bu_location_id), + ]) + + if ( + self.picking_type_id.id == 29 + and quant + and line.location_id.id == bu_location_id + and quant.inventory_quantity < line.product_uom_qty + ): + raise UserError('Quantity reserved lebih besar dari quantity onhand di product') + + def button_validate(self): if self._name != 'stock.picking': return super(StockPicking, self).button_validate() @@ -314,6 +347,8 @@ class StockPicking(models.Model): if not self.date_reserved: current_time = datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S') self.date_reserved = current_time + + self.validation_minus_onhand_quantity() res = super(StockPicking, self).button_validate() self.calculate_line_no() |
