17 lines
497 B
Python
17 lines
497 B
Python
from odoo import models
|
||
|
||
|
||
class ProductProduct(models.Model):
|
||
_inherit = 'product.product'
|
||
|
||
|
||
def _get_product_include_bom(self):
|
||
"""获取产品列表(包括所有bom)"""
|
||
self.ensure_one()
|
||
product_list = [self]
|
||
bom_ids = self.bom_ids
|
||
while (bom_ids):
|
||
bom_product_ids = bom_ids.bom_line_ids.mapped('product_id')
|
||
product_list.append(bom_product_ids)
|
||
bom_ids = bom_product_ids.bom_ids
|
||
return product_list |