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
    • 275
    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:

     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.

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: