diff options
| author | stephanchrst <stephanchrst@gmail.com> | 2022-05-10 17:14:58 +0700 |
|---|---|---|
| committer | stephanchrst <stephanchrst@gmail.com> | 2022-05-10 17:14:58 +0700 |
| commit | 1ca3b3df3421961caec3b747a364071c80f5c7da (patch) | |
| tree | 6778a1f0f3f9b4c6e26d6d87ccde16e24da6c9d6 /v14_indoteknik/models/export_product.py | |
| parent | b57188be371d36d96caac4b8d65a40745c0e972c (diff) | |
initial commit
Diffstat (limited to 'v14_indoteknik/models/export_product.py')
| -rw-r--r-- | v14_indoteknik/models/export_product.py | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/v14_indoteknik/models/export_product.py b/v14_indoteknik/models/export_product.py new file mode 100644 index 0000000..540891e --- /dev/null +++ b/v14_indoteknik/models/export_product.py @@ -0,0 +1,34 @@ +# -*- coding: utf-8 -*- + +from odoo import api, fields, models, _ +from odoo.exceptions import UserError, RedirectWarning, ValidationError, except_orm, Warning +from datetime import datetime + + +class ExportProductLine(models.Model): + _name = "export.product.line" + + reference = fields.Many2one('Reference') + value = fields.Char('Value') + +class ExportProduct(models.Model): + _name = "export.product" + + product_template_id = fields.Char('Product External ID') + product_template_name = fields.Char('Product Name') + attribute_id = fields.Char('Attribute') + value_text = fields.Char(compute="_get_value_text", string="Values in Text") + line_ids = fields.One2many('export.product.line', 'reference', 'Lines') + + @api.depends('line_ids.value') + def _get_value_text(self): + for res in self: + value_text = "" + if res.line_ids: + for line in res.line_ids: + if not value_text: + value_text += line.value + elif value_text: + value_text += "," + line.value + + res.value_text = value_text |
