新增
This commit is contained in:
15
mrp_plm/models/product.py
Normal file
15
mrp_plm/models/product.py
Normal file
@@ -0,0 +1,15 @@
|
||||
# -*- 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)
|
||||
Reference in New Issue
Block a user