API Reference#
Company Multi-Values#
- class trytond.modules.company.model.CompanyMultiValueMixin#
A
MultiValueMixin
that makes it simpler to createMultiValue
fields 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
ValueMixin
used to store the values of aCompanyMultiValueMixin
.
Employee Fields#
- trytond.modules.company.model.employee_field(string[, states][, company])#
A function that returns a
Many2One
field. This field is intended to be used to store the Employee that performed some action on theModel
that contains theField
.- 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
field
is updated with the User’s current Employee, but only if the employee works for thecompany
.- 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’.