-1

When a user orders a subscription we want to update their price list.

The ID of the current price list of the user that ordered a subscription is this:

env['res.partner'].search([['id', '=', record.partner_id.id]]).property_product_pricelist.id

But I now want to change that pricelist, how do I change the ID value? Should I update any other values like the name or is it changed automatically?

Daan Seuntjens
  • 880
  • 1
  • 18
  • 37
  • 1
    `self.env[modol_name]` can link to db, and attach `.search([domain])`can find record you want. please give more info so that can give more specific answer. – Terrence Poe Jul 25 '19 at 15:32

1 Answers1

0

The code I needed was this line:

env['res.partner'].search([['id', '=', record.partner_id.id]]).write({'property_product_pricelist': my_pricelist_id})
Daan Seuntjens
  • 880
  • 1
  • 18
  • 37
  • If you just want see another user's data replace ` record.partner_id.id` with the id you want. If you want to update info of `property_product_pricelist`. you need to update `my_pricelist_id`. – Terrence Poe Jul 26 '19 at 00:58