From 99626f917b032110fe12b9a0ee86c218c0367be1 Mon Sep 17 00:00:00 2001 From: Azka Nathan Date: Mon, 24 Mar 2025 15:34:56 +0700 Subject: push --- indoteknik_custom/models/stock_move.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'indoteknik_custom/models/stock_move.py') diff --git a/indoteknik_custom/models/stock_move.py b/indoteknik_custom/models/stock_move.py index 6b631713..b5fc782e 100644 --- a/indoteknik_custom/models/stock_move.py +++ b/indoteknik_custom/models/stock_move.py @@ -13,6 +13,20 @@ class StockMove(models.Model): ) qr_code_variant = fields.Binary("QR Code Variant", compute='_compute_qr_code_variant') barcode = fields.Char(string='Barcode', related='product_id.barcode') + vendor_id = fields.Many2one('res.partner' ,string='Vendor') + + @api.onchange('product_id') + def onchange_product_to_fill_vendor(self): + if self.product_id: + if self.product_id.x_manufacture.override_vendor_id: + self.vendor_id = self.product_id.x_manufacture.override_vendor_id.id + else: + purchase_pricelist = self.env['purchase.pricelist'].search( + [('product_id', '=', product_id.id), + ('is_winner', '=', True)], + limit=1) + if purchase_pricelist: + self.vendor_id = purchase_pricelist.vendor_id.id def _compute_qr_code_variant(self): for rec in self: -- cgit v1.2.3 From e926482af5f2b95ff465445215c77161223ee671 Mon Sep 17 00:00:00 2001 From: Azka Nathan Date: Thu, 27 Mar 2025 14:38:57 +0700 Subject: push --- indoteknik_custom/models/stock_move.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'indoteknik_custom/models/stock_move.py') diff --git a/indoteknik_custom/models/stock_move.py b/indoteknik_custom/models/stock_move.py index b5fc782e..87b1c94e 100644 --- a/indoteknik_custom/models/stock_move.py +++ b/indoteknik_custom/models/stock_move.py @@ -15,8 +15,8 @@ class StockMove(models.Model): barcode = fields.Char(string='Barcode', related='product_id.barcode') vendor_id = fields.Many2one('res.partner' ,string='Vendor') - @api.onchange('product_id') - def onchange_product_to_fill_vendor(self): + @api.constrains('product_id') + def constrains_product_to_fill_vendor(self): if self.product_id: if self.product_id.x_manufacture.override_vendor_id: self.vendor_id = self.product_id.x_manufacture.override_vendor_id.id -- cgit v1.2.3 From b105f669873645f29314be55aac45d95d0556970 Mon Sep 17 00:00:00 2001 From: Azka Nathan Date: Thu, 27 Mar 2025 16:20:05 +0700 Subject: fix bug --- indoteknik_custom/models/stock_move.py | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) (limited to 'indoteknik_custom/models/stock_move.py') diff --git a/indoteknik_custom/models/stock_move.py b/indoteknik_custom/models/stock_move.py index 87b1c94e..514acad0 100644 --- a/indoteknik_custom/models/stock_move.py +++ b/indoteknik_custom/models/stock_move.py @@ -17,16 +17,17 @@ class StockMove(models.Model): @api.constrains('product_id') def constrains_product_to_fill_vendor(self): - if self.product_id: - if self.product_id.x_manufacture.override_vendor_id: - self.vendor_id = self.product_id.x_manufacture.override_vendor_id.id - else: - purchase_pricelist = self.env['purchase.pricelist'].search( - [('product_id', '=', product_id.id), - ('is_winner', '=', True)], - limit=1) - if purchase_pricelist: - self.vendor_id = purchase_pricelist.vendor_id.id + for rec in self: + if rec.product_id and rec.bom_line_id: + if rec.product_id.x_manufacture.override_vendor_id: + rec.vendor_id = rec.product_id.x_manufacture.override_vendor_id.id + else: + purchase_pricelist = self.env['purchase.pricelist'].search( + [('product_id', '=', rec.product_id.id), + ('is_winner', '=', True)], + limit=1) + if purchase_pricelist: + rec.vendor_id = purchase_pricelist.vendor_id.id def _compute_qr_code_variant(self): for rec in self: -- cgit v1.2.3 From 783b674e04dd123a5233fd01896925c73aa8143c Mon Sep 17 00:00:00 2001 From: Azka Nathan Date: Tue, 29 Apr 2025 10:00:15 +0700 Subject: check product on bom, view stock picking po and fix bug api flashsale header --- indoteknik_custom/models/stock_move.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'indoteknik_custom/models/stock_move.py') 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: -- cgit v1.2.3 From 4c4414b0a4b0a51acfe7324c4c556cd0aa57c3c6 Mon Sep 17 00:00:00 2001 From: Azka Nathan Date: Wed, 30 Apr 2025 15:35:02 +0700 Subject: push --- indoteknik_custom/models/stock_move.py | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) (limited to 'indoteknik_custom/models/stock_move.py') diff --git a/indoteknik_custom/models/stock_move.py b/indoteknik_custom/models/stock_move.py index e75c75f0..42a6307a 100644 --- a/indoteknik_custom/models/stock_move.py +++ b/indoteknik_custom/models/stock_move.py @@ -15,18 +15,18 @@ 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) + # @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}) + # 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 -- cgit v1.2.3 From f7dbba32f167b988cdbfbc0d89664e5595460a9c Mon Sep 17 00:00:00 2001 From: Azka Nathan Date: Wed, 30 Apr 2025 15:37:46 +0700 Subject: fix bug --- indoteknik_custom/models/stock_move.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indoteknik_custom/models/stock_move.py') diff --git a/indoteknik_custom/models/stock_move.py b/indoteknik_custom/models/stock_move.py index 42a6307a..3c765244 100644 --- a/indoteknik_custom/models/stock_move.py +++ b/indoteknik_custom/models/stock_move.py @@ -28,7 +28,7 @@ class StockMove(models.Model): # if po_line: # move.write({'purchase_line_id': po_line.id}) - return moves + # return moves @api.constrains('product_id') def constrains_product_to_fill_vendor(self): -- cgit v1.2.3 From 5b78ec72f001ad0d5ccde1269d1ec86418fb7339 Mon Sep 17 00:00:00 2001 From: Azka Nathan Date: Mon, 5 May 2025 17:02:16 +0700 Subject: push --- indoteknik_custom/models/stock_move.py | 1 + 1 file changed, 1 insertion(+) (limited to 'indoteknik_custom/models/stock_move.py') diff --git a/indoteknik_custom/models/stock_move.py b/indoteknik_custom/models/stock_move.py index 3c765244..90ab30a4 100644 --- a/indoteknik_custom/models/stock_move.py +++ b/indoteknik_custom/models/stock_move.py @@ -14,6 +14,7 @@ class StockMove(models.Model): qr_code_variant = fields.Binary("QR Code Variant", compute='_compute_qr_code_variant') barcode = fields.Char(string='Barcode', related='product_id.barcode') vendor_id = fields.Many2one('res.partner' ,string='Vendor') + hold_outgoingg = fields.Boolean('Hold Outgoing', default=False) # @api.model_create_multi # def create(self, vals_list): -- cgit v1.2.3