Skip to Content
Menu
This question has been flagged
1 Reply
754 Views

Hi,


we have an external application which creates partners in odoo using json-rpc calls.  Initially I tried setting the property_payment_term_id and property_account_position_id but this did not work.

I then found that it could be done by writing to ir.properties.

We have now updated from Odoo 17 to Odoo 18 and the ir.properties model is gone.

How can I create new partners and also specify payment_term and account_position?


If I read the data, the value is something like [ id, "name" ]


An example json value needed to update those fields would be appreciated ;)


Regards,

Tim

Avatar
Discard
Best Answer

The values of company-dependent fields are now stored in a JSON column on the record instead of separately via the ir.property model.

The JSON value is a dict {company_id: value} mapping company ids to the field's value.


Consider we have these companies:


These Payment Terms:


These Fiscal Positions:

(you will notice we use the same approach for translations, so we can store the name in multiple languages in the same field)


This is what is stored for a single Customer with 30 Days and Automatic Tax Mapping (Avatax) assigned in Company 1 and nothing assigned in Company 2:


When we assign 45 Days and no Fiscal Position in Company 2, we get this:

Avatar
Discard
Author

Hi Ray,

thx for the quick response.

I tried but maybe I don't completely understand.

So, what I sent to the JSON RPC endpoint is the following:

{

"id" : 525153903,

"jsonrpc" : "2.0",

"method" : "call",

"params" : {

"service" : "object",

"method" : "execute_kw",

"args" : [ "db", 11, "pw", "res.partner", "write", [ [ 56383 ], {

"active" : true,

"name" : "name",

"company_id" : 3,

"street" : "street",

"street2" : "",

"zip" : "zip",

"city" : "city",

"country_id" : 20,

"vat" : "vat",

"email" : "test",

"phone" : "",

"property_payment_term_id" : {

"3" : 4

},

"lang" : "nl_NL",

"is_company" : true,

"company_type" : "company"

} ] ]

}

}

For "property_payment_term_id", the "3" is the company id from res.company and 4 is the Payment Term Id from account.payment.term

The error I receive is this:

Invalid field '3' on model 'account.payment.term'