over 9 years ago
In followers linked to new partner fields first we have to go in .py file (Python file) After that we have to decide where we want followers linked to new partner fields and then write start to end python code to that field.Use below .py code in python file:
- for field in fields:
- direct_field = field.split('.')[0]
- field_to_recompute = direct_field in self.pool.pure_function_fields
- if not field_to_recompute:
- for expr in self._fields[direct_field].depends:
- if expr.split('.')[0] in vals:
- field_to_recompute = True
- if direct_field in vals or field_to_recompute:
- if hasattr(res, 'ids'):
- ids = res.ids
- if res and isinstance(res, (long, int)) and res is not True:
- ids = [res]
- _filter = lambda partner: self._name in [m.model for m in partner.notification_model_ids]
- for record in self.pool[self._name].browse(cr, SUPERUSER_ID, ids, context):
- contacts = record.mapped(field)._get_contacts_to_notify().filtered(_filter)
- record.message_subscribe(contacts.ids)
- return res
for field in fields: direct_field = field.split('.')[0] field_to_recompute = direct_field in self.pool.pure_function_fields if not field_to_recompute: for expr in self._fields[direct_field].depends: if expr.split('.')[0] in vals: field_to_recompute = True if direct_field in vals or field_to_recompute: if hasattr(res, 'ids'): ids = res.ids if res and isinstance(res, (long, int)) and res is not True: ids = [res] _filter = lambda partner: self._name in [m.model for m in partner.notification_model_ids] for record in self.pool[self._name].browse(cr, SUPERUSER_ID, ids, context): contacts = record.mapped(field)._get_contacts_to_notify().filtered(_filter) record.message_subscribe(contacts.ids) return res
Note- This code is used in customize module only.
Can you help out the community by solving one of the following Social Media problems?
Do activity (Answer, Blog) > Earn Rep Points > Improve Rank > Get more opportunities to work and get paid!
For more topics, questions and answers, please visit the Tech Q&A page.
0 Comment(s)