diff options
| author | Azka Nathan <darizkyfaz@gmail.com> | 2024-09-23 13:20:39 +0700 |
|---|---|---|
| committer | Azka Nathan <darizkyfaz@gmail.com> | 2024-09-23 13:20:39 +0700 |
| commit | 1f9d0136758531831ea6c7a90556c9a472ed8d40 (patch) | |
| tree | 92a4aba15bef6413d77da1568a1d3b814de0baeb | |
| parent | b2f9da06ff526a005f7e71c85a4c626971b5c06b (diff) | |
push
| -rw-r--r-- | indoteknik_custom/models/stock_move.py | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/indoteknik_custom/models/stock_move.py b/indoteknik_custom/models/stock_move.py index 32ef312f..ac2e3cc0 100644 --- a/indoteknik_custom/models/stock_move.py +++ b/indoteknik_custom/models/stock_move.py @@ -8,7 +8,7 @@ class StockMove(models.Model): line_no = fields.Integer('No', default=0) sale_id = fields.Many2one('sale.order', string='SO') - def _do_unreserve(self, product=None, quantity=None): + def _do_unreserve(self, product=None, quantity=False): moves_to_unreserve = OrderedSet() for move in self: if move.state == 'cancel' or (move.state == 'done' and move.scrapped): @@ -19,17 +19,17 @@ class StockMove(models.Model): if product and move.product_id != product: continue # Skip moves that don't match the specified product moves_to_unreserve.add(move.id) - + moves_to_unreserve = self.env['stock.move'].browse(moves_to_unreserve) ml_to_update, ml_to_unlink = OrderedSet(), OrderedSet() moves_not_to_recompute = OrderedSet() - + for ml in moves_to_unreserve.move_line_ids: if product and ml.product_id != product: continue # Only affect the specified product - if quantity is not None and quantity > 0: + if quantity and quantity > 0: # Only reduce by the specified quantity if it is greater than zero ml_to_update.add(ml.id) remaining_qty = ml.product_uom_qty - quantity @@ -40,7 +40,7 @@ class StockMove(models.Model): else: ml_to_unlink.add(ml.id) moves_not_to_recompute.add(ml.move_id.id) - + ml_to_update, ml_to_unlink = self.env['stock.move.line'].browse(ml_to_update), self.env['stock.move.line'].browse(ml_to_unlink) moves_not_to_recompute = self.env['stock.move'].browse(moves_not_to_recompute) @@ -49,7 +49,6 @@ class StockMove(models.Model): return True - def _prepare_account_move_line_from_mr(self, po_line, qty, move=False): po_line.ensure_one() aml_currency = move and move.currency_id or po_line.currency_id |
