ishanra

Untitled

May 28th, 2021
160
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.26 KB | None | 0 0
  1. //I need to store the current id that is self.beneficiary_id and id that is passed from ui that is retained_id
  2. //and the record of current id in the many2many field 'merged_beneficiaries_ids' and show the address of the current id in the
  3. //UI. I am asking about the synatax to store in this many2many field eg.self.write()?
  4.  
  5. @api.multi
  6.     def merge_beneficiaries(self):
  7.         idr = self.retained_id
  8.         print(idr)
  9.         beneficiary_data = self.env['openg2p.beneficiary'].browse(idr)
  10.         print(beneficiary_data)
  11.  
  12.         beneficiary_data.write(
  13.             {'first_name': str(self.firstname),
  14.              'last_name': str(self.firstname),
  15.              'email': str(self.firstname),
  16.              'phone': str(self.phone),
  17.              'street': str(self.street),
  18.              'street2': str(self.street),
  19.              'city': str(self.city),
  20.              'postal_code': str(self.zip),
  21.              'identity': str(self.identity_passport),
  22.              'emergency_contact_name': str(self.emergency_contact),
  23.              'emergency_contact_phone': str(self.emergency_phone)})
  24.  
  25.         delete_url = "http://localhost:8080/index/"+str(idr)
  26.         r = requests.post(delete_url)
  27.         print(r)
  28.         self.clear_beneficiaries()
  29.         self.retained_id = 0
Advertisement
Add Comment
Please, Sign In to add comment