Přejít na obsah
Menu
You need to be registered to interact with the community.
This question has been flagged
1 Odpovědět
2339 Zobrazení

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
Zrušit
Nejlepší odpověď

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
Zrušit
Autor

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 Odpovědi Zobrazení Aktivita
3
zář 25
2709
0
srp 25
313
1
srp 25
2322
2
čvc 25
8135
2
čvc 25
4574