Skip to content

Linking historical invoices via the api #125

Answered by theangryangel
ghost asked this question in Q&A
Discussion options

You must be logged in to vote

I have tried, like other posts have suggested, writing my invoice id to the sale.order 'invoice_ids' list and setting my order's invoice_status to 'invoiced' upon creation.

I would encourage you to read the source of Odoo to understand how things work. It can and does differ massively between versions.

invoice_ids on 16.0 is computed without an inverse. This means that writing to invoice_ids has no effect (see https://github.com/odoo/odoo/blob/16.0/addons/sale/models/sale_order.py#L220).

If you really want to do this, you’ll need to link the sale.order.line to specific account.move.line (read: invoice line) records. The reason being is that this is how the computed method determines how…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant