Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • How to Add followers linked to new partner in Odoo9 ?

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 308
    Comment on it

    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:

    1. for field in fields:
    2. direct_field = field.split('.')[0]
    3. field_to_recompute = direct_field in self.pool.pure_function_fields
    4. if not field_to_recompute:
    5. for expr in self._fields[direct_field].depends:
    6. if expr.split('.')[0] in vals:
    7. field_to_recompute = True
    8. if direct_field in vals or field_to_recompute:
    9. if hasattr(res, 'ids'):
    10. ids = res.ids
    11. if res and isinstance(res, (long, int)) and res is not True:
    12. ids = [res]
    13. _filter = lambda partner: self._name in [m.model for m in partner.notification_model_ids]
    14. for record in self.pool[self._name].browse(cr, SUPERUSER_ID, ids, context):
    15. contacts = record.mapped(field)._get_contacts_to_notify().filtered(_filter)
    16. record.message_subscribe(contacts.ids)
    17. return res

    Note- This code is used in customize module only.

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Reset Password
Fill out the form below and reset your password: