summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiqdad <ahmadmiqdad27@gmail.com>2025-10-16 08:50:57 +0700
committerMiqdad <ahmadmiqdad27@gmail.com>2025-10-16 08:50:57 +0700
commitefaeb9e53727f6ccfa0c42bbf8a7c7cc0f25da4b (patch)
treeb0126c0fd337e6286056a1d562b81b166631d5b8
parentb3eab8f1694e5fa1b8229784d247f437f68c2b4c (diff)
<Miqdad> fix api
-rw-r--r--indoteknik_api/controllers/api_v1/sale_order.py2
-rw-r--r--indoteknik_custom/models/stock_move.py26
2 files changed, 14 insertions, 14 deletions
diff --git a/indoteknik_api/controllers/api_v1/sale_order.py b/indoteknik_api/controllers/api_v1/sale_order.py
index 741dc0b1..cff1921d 100644
--- a/indoteknik_api/controllers/api_v1/sale_order.py
+++ b/indoteknik_api/controllers/api_v1/sale_order.py
@@ -789,7 +789,7 @@ class SaleOrder(controller.Controller):
order_line.product_id_change()
order_line.weight = order_line.product_id.weight
- order_line.onchange_vendor_id()
+ order_line._onchange_vendor_id_custom()
_logger.info(f"After onchanges - Price: {order_line.price_unit}, Disc: {order_line.discount}")
elif cart['cart_type'] == 'promotion':
diff --git a/indoteknik_custom/models/stock_move.py b/indoteknik_custom/models/stock_move.py
index 163c7505..1da2befe 100644
--- a/indoteknik_custom/models/stock_move.py
+++ b/indoteknik_custom/models/stock_move.py
@@ -22,12 +22,12 @@ class StockMove(models.Model):
partial = fields.Boolean('Partial?', default=False)
# Ambil product uom dari SO line
- # @api.model
- # def create(self, vals):
- # if vals.get('sale_line_id'):
- # sale_line = self.env['sale.order.line'].browse(vals['sale_line_id'])
- # vals['product_uom'] = sale_line.product_uom.id
- # return super().create(vals)
+ @api.model
+ def create(self, vals):
+ if vals.get('sale_line_id'):
+ sale_line = self.env['sale.order.line'].browse(vals['sale_line_id'])
+ vals['product_uom'] = sale_line.product_uom.id
+ return super().create(vals)
# @api.model_create_multi
# def create(self, vals_list):
@@ -188,10 +188,10 @@ class StockMoveLine(models.Model):
manufacture = fields.Many2one('x_manufactures', string="Brands", related="product_id.x_manufacture", store=True)
# Ambil uom dari stock move
- # @api.model
- # def create(self, vals):
- # if 'move_id' in vals and 'product_uom_id' not in vals:
- # move = self.env['stock.move'].browse(vals['move_id'])
- # if move.product_uom:
- # vals['product_uom_id'] = move.product_uom.id
- # return super().create(vals) \ No newline at end of file
+ @api.model
+ def create(self, vals):
+ if 'move_id' in vals and 'product_uom_id' not in vals:
+ move = self.env['stock.move'].browse(vals['move_id'])
+ if move.product_uom:
+ vals['product_uom_id'] = move.product_uom.id
+ return super().create(vals) \ No newline at end of file