API Reference#
Company Multi-Values#
- class trytond.modules.company.model.CompanyMultiValueMixin#
- A - MultiValueMixinthat makes it simpler to create- MultiValuefields based on the Company in the context. It does this by including the company from the context in the pattern by default.
- class trytond.modules.company.model.CompanyValueMixin#
- A - ValueMixinused to store the values of a- CompanyMultiValueMixin.
Employee Fields#
- trytond.modules.company.model.employee_field(string[, states][, company])#
- A function that returns a - Many2Onefield. This field is intended to be used to store the Employee that performed some action on the- Modelthat contains the- Field.- Parameters:
- string – The string that is used as the label for the field. 
- states – The states in which the field will be read-only. 
- company – The name of the field that contains the company. 
 
- Returns:
- The employee Many2One field. 
 
- @trytond.modules.company.model.set_employee(field[, company[, when]])#
- Used to decorate methods which need to record the employee that last ran them. The specified - fieldis updated with the User’s current Employee, but only if the employee works for the- company.- Parameters:
- field – The name of the field to set to the user’s current employee. 
- company – The name of the field that contains the company. Defaults to ‘company’. 
- when – Define if the field is set ‘after’ calling the decorated method or ‘before’. Default to ‘after’. 
 
 
- @trytond.modules.company.model.reset_employee(\*fields[, when])#
- Used to decorate methods which indicate that the document is now in a state where the action has not yet been performed, so the Employee should be cleared from the - fields.- Parameters:
- fields – The names of the fields that should have the employee removed. 
- when – Define if the field is set ‘after’ calling the decorated method or ‘before’. Default to ‘after’.