Skip to content

Commit

Permalink
IMP: fix write attachment permission on workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
mboscolo committed Oct 2, 2023
1 parent 8b228bd commit 8516758
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 4 deletions.
2 changes: 1 addition & 1 deletion plm/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)",
Expand Down
2 changes: 1 addition & 1 deletion plm/models/plm_mixin.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
30 changes: 28 additions & 2 deletions plm/models/product_product.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 <product_product>
:bom_type ['normal','kit','engineering']
:return: [<product_product>,]
"""
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:
Expand Down Expand Up @@ -1803,7 +1828,8 @@ def populate(product_id):
#
populate(self)
return out



class PlmTemporayMessage(models.TransientModel):
_name = "plm.temporary.message"
_description = "Temporary Class"
Expand Down
12 changes: 12 additions & 0 deletions plm/security/base_plm_security.xml
Original file line number Diff line number Diff line change
Expand Up @@ -266,6 +266,18 @@
<field name="groups" eval="[(4, ref('group_plm_view_user'))]"/>
</record>

<record id="group_plm_admin_plm_document" model="ir.rule">
<field name="name">Admin rule PLM documnet</field>
<field name="model_id" ref="model_ir_attachment"/>
<field name="active" eval="1"/>
<field name="perm_read" eval="1"/>
<field name="perm_create" eval="1"/>
<field name="perm_write" eval="1"/>
<field name="perm_unlink" eval="1"/>
<field name="domain_force" eval="[('is_plm','=',True)]"/>
<field name="groups" eval="[(4, ref('group_plm_integration_user'))]"/>
</record>

<record id="group_non_plm_view_plm_document" model="ir.rule">
<field name="name">Manage Non PLM Documnet</field>
<field name="model_id" ref="model_ir_attachment"/>
Expand Down

0 comments on commit 8516758

Please sign in to comment.