diff options
| author | trisusilo48 <tri.susilo@altama.co.id> | 2024-12-13 14:15:17 +0700 |
|---|---|---|
| committer | trisusilo48 <tri.susilo@altama.co.id> | 2024-12-13 14:15:17 +0700 |
| commit | 3ba967de0aa6c70b0d070a7ca723d49008aa0dd2 (patch) | |
| tree | 7f1a7ac4d517dfb988e4e5fc182b0a44108b5a2c /indoteknik_custom/models/product_sla.py | |
| parent | 01507fad2a05124137541dc187a06631732c606e (diff) | |
product sla
Diffstat (limited to 'indoteknik_custom/models/product_sla.py')
| -rw-r--r-- | indoteknik_custom/models/product_sla.py | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/indoteknik_custom/models/product_sla.py b/indoteknik_custom/models/product_sla.py index 2e663d30..05210cdc 100644 --- a/indoteknik_custom/models/product_sla.py +++ b/indoteknik_custom/models/product_sla.py @@ -12,6 +12,8 @@ class ProductSla(models.Model): _rec_name = 'product_variant_id' product_variant_id = fields.Many2one('product.product',string='Product') + vendor_id = fields.Many2one('res.partner',string='Vendor', readonly=True) + sla_vendor = fields.Char(string='SLA Vendor', readonly=True) avg_leadtime = fields.Char(string='AVG Leadtime', readonly=True) leadtime = fields.Char(string='Leadtime', readonly=True) sla = fields.Char(string='SLA', readonly=True) @@ -36,6 +38,7 @@ class ProductSla(models.Model): product.sla_version += 1 product_sla = self.search([('product_variant_id', '=', product.id)], limit=1) + print(product_sla.id, product.id) if not product_sla: product_sla = self.env['product.sla'].create({ 'product_variant_id': product.id, @@ -48,6 +51,18 @@ class ProductSla(models.Model): self.sla = '-' product = self.product_variant_id + + q_vendor = [ + ('product_id', '=', product.id), + ('is_winner', '=', True) + ] + + vendor = self.env['purchase.pricelist'].search(q_vendor) + print(vendor.vendor_id.id) + if vendor: + vendor_sla = self.env['vendor.sla'].search([('id_vendor', '=', vendor.vendor_id.id)], limit=1) + self.sla_vendor = "{} {}".format(vendor_sla.duration, vendor_sla.unit) + self.vendor_id = vendor.vendor_id.id qty_available = 0 qty_available = product.qty_onhand_bandengan |
