my code is
def init(self):
self.env.cr.execute("""update account_move
set sale_order_id = b.so_id, customer_name = b.partner_name, so_number = b.name
from (
SELECT am.id as move_id,so.id as so_id,so.name,so.partner_id
,rp.name as partner_name
FROM account_move am
JOIN purchase_order po ON po.name = am.invoice_origin
JOIN sale_order so ON so.name = po.origin
JOIN res_partner rp on rp.id = so.partner_id
where am.move_type = 'in_invoice' ) b
where account_move.id = record.id;""")
Give the context of what you're trying to do, then the code will be playful
I want every time I make a vendor bill, it will update the so_number,customer_name field, which I have added to the account_move table