diff options
| author | Azka Nathan <darizkyfaz@gmail.com> | 2025-03-27 14:39:56 +0700 |
|---|---|---|
| committer | Azka Nathan <darizkyfaz@gmail.com> | 2025-03-27 14:39:56 +0700 |
| commit | 1e3da858c3d924a8fc61c83115ffce654198b10b (patch) | |
| tree | 626df0a75225be2a8095fa1a564f88c1e5b17e3f /indoteknik_custom/models/stock_move.py | |
| parent | a9eed02ec4f14c368fc98accd25ae8acdc67323b (diff) | |
| parent | e926482af5f2b95ff465445215c77161223ee671 (diff) | |
Merge branch 'dev/po-mo' into odoo-backup
# Conflicts:
# indoteknik_custom/models/mrp_production.py
Diffstat (limited to 'indoteknik_custom/models/stock_move.py')
| -rw-r--r-- | indoteknik_custom/models/stock_move.py | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/indoteknik_custom/models/stock_move.py b/indoteknik_custom/models/stock_move.py index 6b631713..87b1c94e 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.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 def _compute_qr_code_variant(self): for rec in self: |
