diff --git a/plm/__manifest__.py b/plm/__manifest__.py index f3b18bf2..36237350 100644 --- a/plm/__manifest__.py +++ b/plm/__manifest__.py @@ -20,7 +20,7 @@ ############################################################################## { "name": "Product Lifecycle Management", - "version": "16.0.16", + "version": "16.0.17", "author": "OmniaSolutions", "website": "https://odooplm.omniasolutions.website", "category": "Manufacturing/Product Lifecycle Management (PLM)", diff --git a/plm/models/plm_mixin.py b/plm/models/plm_mixin.py index 8863e190..192652cf 100644 --- a/plm/models/plm_mixin.py +++ b/plm/models/plm_mixin.py @@ -382,7 +382,7 @@ def get_next_version(self): def get_released(self): self.ensure_one() return self.search([('engineering_code','=', self.engineering_code), - ('engineering_state','in',['undermodify', RELEASED_STATUS])]) + ('engineering_state','in',[UNDER_MODIFY_STATUS, RELEASED_STATUS])]) def get_all_revision(self): self.ensure_one() diff --git a/plm/models/product_product.py b/plm/models/product_product.py index 2c6fa196..196a34ce 100755 --- a/plm/models/product_product.py +++ b/plm/models/product_product.py @@ -441,7 +441,32 @@ def _getChildrenBom(self, bufferdata.append(bomline.product_id.id) result.extend(bufferdata) return list(set(result)) - + + def getLeafBom(self, bom_type='normal'): + """ + get only the leaf of the bom + :product_product_id + :bom_type ['normal','kit','engineering'] + :return: [,] + """ + out = [] + computed_bom = [] + def _getLeafBom(self, bom_type='normal'): + for product_product_id in self: + has_bom=False + for mrp_bom_id in product_product_id.product_tmpl_id.bom_ids.filtered(lambda x : x.bom_type==bom_type): + has_bom=True + if mrp_bom_id in computed_bom: + continue + else: + computed_bom.append(mrp_bom_id) + for product_id in mrp_bom_id.bom_line_ids.mapped("product_id"): + for sub_product_id in product_id._getLeafBom(bom_type=bom_type): + out.append(sub_product_id) + if not has_bom and product_product_id not in out: + out.append(product_product_id) + return out + def summarize_level(self, recursion=False, flat=False, level=1, summarize=False, parentQty=1, bom_type=False): out = {} for product_product_id in self: @@ -1803,7 +1828,8 @@ def populate(product_id): # populate(self) return out - + + class PlmTemporayMessage(models.TransientModel): _name = "plm.temporary.message" _description = "Temporary Class" diff --git a/plm/security/base_plm_security.xml b/plm/security/base_plm_security.xml index ea46d2ff..4a334c24 100755 --- a/plm/security/base_plm_security.xml +++ b/plm/security/base_plm_security.xml @@ -266,6 +266,18 @@ + + Admin rule PLM documnet + + + + + + + + + + Manage Non PLM Documnet