Files
test/mrp_plm/models/product.py
2025-07-07 11:59:14 +08:00

16 lines
572 B
Python

# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from odoo import api, fields, models, _
class ProductTemplate(models.Model):
_inherit = 'product.template'
version = fields.Integer('Version', default=1, readonly=True, copy=False, help="The current version of the product.")
eco_count = fields.Integer('# ECOs',compute='_compute_eco_count')
eco_ids = fields.One2many('mrp.eco', 'product_tmpl_id', 'ECOs')
def _compute_eco_count(self):
for p in self:
p.eco_count = len(p.eco_ids)