diff options
| author | Azka Nathan <darizkyfaz@gmail.com> | 2025-04-29 10:00:15 +0700 |
|---|---|---|
| committer | Azka Nathan <darizkyfaz@gmail.com> | 2025-04-29 10:00:15 +0700 |
| commit | 783b674e04dd123a5233fd01896925c73aa8143c (patch) | |
| tree | a0b5dea1b38eb0141180396d621a76381a337f38 /indoteknik_custom/models/stock_move.py | |
| parent | bac1744ce4e27d796fd2b52f5fbcd3d5cdabdc75 (diff) | |
check product on bom, view stock picking po and fix bug api flashsale header
Diffstat (limited to 'indoteknik_custom/models/stock_move.py')
| -rw-r--r-- | indoteknik_custom/models/stock_move.py | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/indoteknik_custom/models/stock_move.py b/indoteknik_custom/models/stock_move.py index 514acad0..e75c75f0 100644 --- a/indoteknik_custom/models/stock_move.py +++ b/indoteknik_custom/models/stock_move.py @@ -15,6 +15,21 @@ class StockMove(models.Model): barcode = fields.Char(string='Barcode', related='product_id.barcode') vendor_id = fields.Many2one('res.partner' ,string='Vendor') + @api.model_create_multi + def create(self, vals_list): + moves = super(StockMove, self).create(vals_list) + + for move in moves: + if move.product_id and move.location_id.id == 58 and move.location_dest_id.id == 57 and move.picking_type_id.id == 75: + po_line = self.env['purchase.order.line'].search([ + ('product_id', '=', move.product_id.id), + ('order_id.name', '=', move.origin) + ], limit=1) + if po_line: + move.write({'purchase_line_id': po_line.id}) + + return moves + @api.constrains('product_id') def constrains_product_to_fill_vendor(self): for rec in self: |
