diff options
| author | Azka Nathan <darizkyfaz@gmail.com> | 2026-02-02 14:30:25 +0700 |
|---|---|---|
| committer | Azka Nathan <darizkyfaz@gmail.com> | 2026-02-02 14:30:25 +0700 |
| commit | 18f978648362e8d9d5ed447d89bf1e969894b237 (patch) | |
| tree | fb7b5fd158787e0ec8eb9655cba1f43df1366754 /fixco_custom/models/stock_picking.py | |
| parent | 2086d9f4540d3453cb2179560253769491aa0153 (diff) | |
push
Diffstat (limited to 'fixco_custom/models/stock_picking.py')
| -rwxr-xr-x | fixco_custom/models/stock_picking.py | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/fixco_custom/models/stock_picking.py b/fixco_custom/models/stock_picking.py index 222c344..0f34a05 100755 --- a/fixco_custom/models/stock_picking.py +++ b/fixco_custom/models/stock_picking.py @@ -16,6 +16,7 @@ import time import logging import re from hashlib import sha256 +from odoo.tools.float_utils import float_compare _logger = logging.getLogger(__name__) @@ -68,6 +69,28 @@ class StockPicking(models.Model): list_product = fields.Char(string='List Product') is_dispatched = fields.Boolean(string='Is Dispatched', default=False, compute='_compute_is_dispatched', readonly=True) date_canceled = fields.Datetime(string='Date Canceled', tracking=True) + full_reserved = fields.Boolean(string='Full Reserved', default=False) + + def check_qty_reserved(self): + pickings = self.env['stock.picking'].search([ + ('state', '=', 'assigned'), + ('picking_type_code', '=', 'outgoing'), + ('name', 'ilike', 'BU/OUT'), + ('origin', 'ilike', 'SO/'), + ]) + + for picking in pickings: + moves = picking.move_ids_without_package + + picking.full_reserved = bool(moves) and all( + float_compare( + line.product_uom_qty, + line.forecast_availability, + precision_rounding=line.product_uom.rounding + ) == 0 + for line in moves + ) + def action_cancel(self): for picking in self: |
