Bases: tuple
Child(level, link)
itemgetter(item, ...) –> itemgetter object
Return a callable object that fetches the given item(s) from its operand. After, f=itemgetter(2), the call f(r) returns r[2]. After, g=itemgetter(2,5,3), the call g(r) returns (r[2], r[5], r[3])
itemgetter(item, ...) –> itemgetter object
Return a callable object that fetches the given item(s) from its operand. After, f=itemgetter(2), the call f(r) returns r[2]. After, g=itemgetter(2,5,3), the call g(r) returns (r[2], r[5], r[3])
Bases: tuple
Parent(level, link)
itemgetter(item, ...) –> itemgetter object
Return a callable object that fetches the given item(s) from its operand. After, f=itemgetter(2), the call f(r) returns r[2]. After, g=itemgetter(2,5,3), the call g(r) returns (r[2], r[5], r[3])
itemgetter(item, ...) –> itemgetter object
Return a callable object that fetches the given item(s) from its operand. After, f=itemgetter(2), the call f(r) returns r[2]. After, g=itemgetter(2,5,3), the call g(r) returns (r[2], r[5], r[3])
List unique elements, preserving order. Remember only the element just seen.
Bases: openPLM.plmapp.controllers.plmobject.PLMObjectController
Controller for Part.
This controller adds methods to manage Parent-Child links between two Parts.
Checks if child can be added to self. If child can not be added, an exception is raised.
Parameters: | child (Part) – child to be added |
---|---|
Raises : | ValueError if child is already a child or a parent. |
Raises : | PermissionError if _user is not the owner of object. |
Adds child to self.
Parameters: |
|
---|
Extra arguments are used to create relevant ParentChildLinkExtension.
Raises : | ValueError if child is already a child or a parent. |
---|---|
Raises : | ValueError if quantity or order are negative. |
Raises : | PermissionError if _user is not the owner of object. |
Raises : | PermissionError if object is not editable. |
Deletes child from current children and records this action in the history.
Note
The link is not destroyed: its ParentChildLink.end_time is set to now.
Raises : | PermissionError if _user is not the owner of object. |
---|---|
Raises : | PermissionError if object is not editable. |
Modifies information about child.
Parameters: |
|
---|
Extra arguments are used to modify relevant ParentChildLinkExtension.
Raises : | PermissionError if _user is not the owner of object. |
---|---|
Raises : | PermissionError if object is not editable. |
Replaces a child by another one.
Parameters: |
|
---|---|
Raises : | ValueError if the link is invalid (already completed or its parent is not the current object) |
Raises : | all permission errors raised by check_add_child() |
Returns a list of all children at time date.
Parameters: |
|
---|---|
Return type: | list of Child |
Returns a list of all parents at time date.
Parameters: |
|
---|---|
Return type: | list of Parent |
Updates children informations with data from formset
Parameters: | formset (a modelfactory_formset of ModifyChildForm) – |
---|---|
Raises : | PermissionError if _user is not the owner of object. |
Raises : | PermissionError if object is not editable. |
New in version 1.2.
Returns some data about children that will be displayed in BOM view.
Parameters: |
|
---|
It returns a dictionary containing the following keys:
New in version 1.2.
Compares two BOMs at date date1 and date2.
dates, level, state and show_documents are described in get_bom().
It returns a dictionary containing the following keys:
Revises the part. Does the same thing as PLMObjectController.revise() and:
- copies all ParentChildLink of child_links, with the new revision as the new parent. If child_links is None (the default), all current children are copied. If an empty sequence is given, no links are copied.
- attaches all document of documents, by default, no documents are attached. The method get_suggested_documents() returns a list of documents that should be interesting.
- replaces all parent links in parents. This arguments must be a list of tuples (link (an instance of ParentChildLink), parent (an instance of PLMObject)) where parent is the parent whose the bom will be modified and link is the source of data (quantity, unit, order...). link will be ended if parent is a parent of the current part. The method get_suggested_parents() returns a list of tuples that may interest the user who revises this part.
Returns a QuerySet of documents that should be suggested when the user revises the part.
A document is suggested if:
it is attached to the current part and:
it is a draft and its superior revisions, if they exist, are not attached to the part
or
it is official and its superior revisions, if they exist, are not attached to the part
or
it is official and a superior revision is attached and another superior revision is not attached to the part
it is not attached to the current part, an inferior revision is attached to the part and:
it is a draft
or
it is official
Returns a list of suggested parents that should be suggested when the part is revised.
This method returns a list of tuple (link (an instance of ParentChildLink), parent (an instance of PLMObject)). It does not returns a list of links, since it may suggest a part that is not a parent but whose one of its previous revision is a parent. We need a link to copy its data (order, quantity, unit and extensions).
A part is suggested as a parent if:
it is already a parent and:
no superior revisions are a parent and its state is draft or official
or
no superior revisions exist and its state is proposed.
it is not a parent, a previous revision is a parent, its state is a draft or a parent. In that case, the link of the most superior parent revision is used.
Links document (a Document) with object.
Raises : | PermissionError if _user is not the owner of object. |
---|
Delete link between document (a Document) and object.
Raises : | PermissionError if _user is not the owner of object. |
---|
Returns True if document can be attached to the current part.
Updates doc_cad informations with data from formset
Parameters: | formset (a modelfactory_formset of ModifyChildForm) – |
---|---|
Raises : | ValueError if one of the document is not detachable. |
Cancels the object:
Clones the object :
calls PLMObjectController.clone()
Parameters: |
|
---|
Return true if the part :
Returns an iterable of all DocumentFile related to part that contain a CAD file. It retrieves all non deprecated files of all documents parts to part and its children and filters these files according to their extension (see is_cad_file()).