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

I want to make an update of all partners and set the payment_term to immediate payment.

This is what I tried:

UPDATE res_partner SET "property_payment_term_id"=1;


But I get an error saying that:

column "property_payment_term_id" does not exist


But thats the field for defining the payment term in the view and model:

https://github.com/odoo/odoo/blob/c0161736db4f2415e6a44674d872bf8aa2972287/addons/account/models/partner.py l.461


Thank you for any suggestions

Avatar
Discard
Best Answer

This field can be updated in ir_property table, to get all property_payment_term_id values for all partners use the below query:

select * from ir_property ip where name='property_payment_term_id';

You can update it for all partners as below:

update ir_property 
set value_reference ='account.payment.term,1'
where name='property_payment_term_id';

Also you can change it from Odoo, enable developer mode and go to settings -> Technical -> Company Parameters and then search for name  property_payment_term_id  and you can update it from there!

Avatar
Discard
Author

What if I wanted to update only the payment_terms that are not set? Like:
UPDATE res_partner SET "property_payment_term_id"=1 WHERE "property_payment_term_id"=''; ?

You can do it as below:

update ir_property
set value_reference ='account.payment.term,1'
where name='property_payment_term_id' and value_reference is null

Related Posts Replies Views Activity
1
Nov 24
1484
1
Nov 24
1192
2
Sep 24
1047
1
Aug 24
2454
3
Aug 24
2687