summaryrefslogtreecommitdiff
path: root/indoteknik_custom/models/stock_move.py
diff options
context:
space:
mode:
Diffstat (limited to 'indoteknik_custom/models/stock_move.py')
-rw-r--r--indoteknik_custom/models/stock_move.py31
1 files changed, 31 insertions, 0 deletions
diff --git a/indoteknik_custom/models/stock_move.py b/indoteknik_custom/models/stock_move.py
index 6b631713..90ab30a4 100644
--- a/indoteknik_custom/models/stock_move.py
+++ b/indoteknik_custom/models/stock_move.py
@@ -13,6 +13,37 @@ 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):
+ # 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:
+ 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: