采购申请按钮按照产品以及bom产品过滤

This commit is contained in:
胡尧
2025-06-18 10:34:34 +08:00
parent 1dfa22900d
commit 376eb9e56f
3 changed files with 29 additions and 5 deletions

View File

@@ -0,0 +1,17 @@
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