Advertisement
rht_odoo

https://pastebin.com/izXe9mp0

Apr 12th, 2024 (edited)
108
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.68 KB | None | 0 0
  1. # Done by RHT on the 01/02/2024
  2. # Reviewed by KHBA on the 05/02/2024
  3. # Review: https://pastebin.com/m3hYYVxu
  4. # need: create project from opportunity (and link the two records)
  5. # 911 task: https://www.odoo.com/web#id=3710401&cids=1&model=project.task&view_type=form
  6. for opp in records:
  7.   values = {'name': opp.name, 'x_studio_opportunity_id': opp.id,'is_fsm': True,'use_documents': True, 'allow_subtasks': True}
  8.   if opp.partner_id: # KHBA - Added this part if the opportunity has a partner associated with, otherwise previous code will create an error
  9.     values['partner_id'] = opp.partner_id.id
  10.   project = env['project.project'].create(values)
  11.   opp['x_studio_project_id'] = project.id
  12.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement