You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We're running into some issues with splitting up the partner_identification attributes in medical.
I am in the process of implementing the below code to circumvent the issue in the base medical entity, but am wondering if there is use case outside of medical. Any thoughts?
@api.modeldef_compute_identification(self, field_name, category_code, many=False):
""" It computes a field that indicates a certain ID type. Use this on a field that represents a certain ID type. It will compute the desired field as that ID(s). Set many to ``True`` to allow many results. This can only be used on m2m fields. Example: .. code-block:: python social_security_id = fields.Many2one( string='Social Security', comodel_name='res.partner.id_number', compute=lambda s: s._compute_identification( 'social_security_id', 'SSN', ) ) npi_ids = fields.Many2many( string='NPI Numbers', comodel_name='res.partner.id_number', compute=lambda s: s._compute_identification( 'npi_ids', 'NPI', True, ) ) Args: field_name: Name of field to set. category_code: Category code of the Identification type. many: Allow many results. """forrecordinself:
ids=record.id_numbers.filtered(
lambdar: r.category_id.code==category_code
)
ifnotids:
continuevalue= [(6, 0, ids.ids)] ifmanyelseids[0].idsetattr(record, field_name, value)
I'll probably also need to make an inverse - at least for the o2o
The text was updated successfully, but these errors were encountered:
lasley
changed the title
[RFC] partner_contact_identification: Pass-Through Fields
[RFC] partner_identification: Pass-Through Fields
Jan 4, 2017
We're running into some issues with splitting up the
partner_identification
attributes in medical.I am in the process of implementing the below code to circumvent the issue in the base medical entity, but am wondering if there is use case outside of medical. Any thoughts?
I'll probably also need to make an inverse - at least for the o2o
The text was updated successfully, but these errors were encountered: