summaryrefslogtreecommitdiff
path: root/indoteknik_custom
diff options
context:
space:
mode:
authorstephanchrst <stephanchrst@gmail.com>2025-05-23 11:16:30 +0700
committerstephanchrst <stephanchrst@gmail.com>2025-05-23 11:16:30 +0700
commit019bba2a3ff2ed08f53200df02c0638ddabbbe22 (patch)
tree7da620a897a3329b5d52160205a65df91db9ce25 /indoteknik_custom
parent1ce12e1b817079a1fd74c892a880bd8efff72e41 (diff)
bf outgoing with hold qty and change formula of reordering rule
Diffstat (limited to 'indoteknik_custom')
-rw-r--r--indoteknik_custom/models/automatic_purchase.py2
-rwxr-xr-xindoteknik_custom/models/product_template.py9
2 files changed, 8 insertions, 3 deletions
diff --git a/indoteknik_custom/models/automatic_purchase.py b/indoteknik_custom/models/automatic_purchase.py
index 4feec307..1d7c5e31 100644
--- a/indoteknik_custom/models/automatic_purchase.py
+++ b/indoteknik_custom/models/automatic_purchase.py
@@ -486,7 +486,7 @@ class AutomaticPurchase(models.Model):
# _logger.info('test %s' % point.product_id.name)
if point.product_id.qty_available_bandengan > point.product_min_qty:
continue
- qty_purchase = point.product_max_qty - point.product_id.qty_available_bandengan
+ qty_purchase = point.product_max_qty - point.product_id.qty_incoming_bandengan - point.product_id.qty_onhand_bandengan
po_line = self.env['purchase.order.line'].search([('product_id', '=', point.product_id.id), ('order_id.state', '=', 'done')], order='id desc', limit=1)
if self.vendor_id:
diff --git a/indoteknik_custom/models/product_template.py b/indoteknik_custom/models/product_template.py
index 34b8fd2c..c62ca63e 100755
--- a/indoteknik_custom/models/product_template.py
+++ b/indoteknik_custom/models/product_template.py
@@ -1116,7 +1116,8 @@ class ProductProduct(models.Model):
domain=[
('product_id', '=', product.id),
('location_id', 'in', [57, 83]),
- ('mo_id', '=', False)
+ ('mo_id', '=', False),
+ ('hold_outgoing', '=', False)
],
fields=['qty_need'],
groupby=[]
@@ -1359,6 +1360,7 @@ class OutstandingMove(models.Model):
location_id = fields.Many2one('stock.location', string='Location', help='Lokasi asal')
location_dest_id = fields.Many2one('stock.location', string='Location To', help='Lokasi tujuan')
mo_id = fields.Many2one('mrp.production', string='Manufacturing Order')
+ hold_outgoing = fields.Boolean(string='Hold Outgoing')
def init(self):
# where clause 'state in' follow the origin of outgoing and incoming odoo
@@ -1368,8 +1370,11 @@ class OutstandingMove(models.Model):
select sm.id, sm.reference, sm.product_id,
sm.product_uom_qty as qty_need,
sm.location_id, sm.location_dest_id,
- sm.raw_material_production_id as mo_id
+ sm.raw_material_production_id as mo_id,
+ so.hold_outgoing
from stock_move sm
+ left join procurement_group pg on pg.id = sm.group_id
+ left join sale_order so on so.id = pg.sale_id
where 1=1
and sm.state in(
'waiting',