diff options
| author | trisusilo48 <tri.susilo@altama.co.id> | 2025-04-14 16:50:07 +0700 |
|---|---|---|
| committer | trisusilo48 <tri.susilo@altama.co.id> | 2025-04-14 16:50:07 +0700 |
| commit | b3e915fa8d2f280d76ca1afb19e729804aeed6e6 (patch) | |
| tree | 3f728dfafc5ebbc597d42714faa5fcfaff8781d7 /indoteknik_custom/models/stock_move.py | |
| parent | 6eb0b48ad5c418f565efdf1a60d221a10465b0b8 (diff) | |
| parent | 3e22bea62b4c57268ce777d34ec6d19aede8b0c1 (diff) | |
Merge branch 'odoo-backup' into feature/feedback_bitehisp
# Conflicts:
# indoteknik_custom/security/ir.model.access.csv
Diffstat (limited to 'indoteknik_custom/models/stock_move.py')
| -rw-r--r-- | indoteknik_custom/models/stock_move.py | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/indoteknik_custom/models/stock_move.py b/indoteknik_custom/models/stock_move.py index 6b631713..514acad0 100644 --- a/indoteknik_custom/models/stock_move.py +++ b/indoteknik_custom/models/stock_move.py @@ -13,6 +13,21 @@ 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): + 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: |
