Skip to Content
Menu
This question has been flagged
4 Replies
7641 Views

Hi

After migration from Odoo 11 to 12, my existing sales orders can no more be invoiced. When validating the invoice, I get this error:

File "/var/opt/odoo/odoo/fields.py", line 1038, in _compute_value
getattr(records, self.compute)()
File "/var/opt/odoo/addons/sale/models/sale.py", line 1308, in _compute_untaxed_amount_invoiced
amount_invoiced += invoice_line.currency_id._convert(invoice_line.price_subtotal, line.currency_id, line.company_id, invoice_date)
File "/var/opt/odoo/odoo/addons/base/models/res_currency.py", line 200, in _convert
assert company, "convert amount from unknown company"
AssertionError: convert amount from unknown company

Creating a new invoice or a new sales order and from there an invoice works with validation. Has anybody an idea what could be missing? Is this a migration problem?

Thanks for help.

Avatar
Discard
Author

Another hint

When opening Odoo Studio on an invoice, selecting any Domain expression on fields having "company_id" inside gives an error: The domain you entered is not properly formed

For instance on Invoice, Other Info, account_id, where Domain is [('company_id', '=', company_id ...

Seems like company_id is the problem.

I've taken a migrated production database from April 5th and updated all modules.

Author

I've checked the database.

There is a valid company, all fine.

The account_invoice has a company_id and currency_id set. So does the account_invoice_line

id | 2460

name | BLABLA

origin |

sequence | 2

invoice_id | 612

uom_id | 1

product_id | 189

account_id | 274

price_unit | 100.00

price_subtotal | 100.00

price_total | 107.70

price_subtotal_signed | 100.00

quantity | 1.000

discount | 0.00

account_analytic_id |

company_id | 1

partner_id | 906

currency_id | 6

is_rounding_line | f

create_uid | 2

create_date | 2019-04-07 08:12:25.450818

write_uid | 2

write_date | 2019-04-07 12:54:42.409277

subscription_id |

asset_category_id |

asset_start_date |

asset_end_date |

asset_mrr | 0.00

purchase_line_id |

display_type |

Strange that newly created invoices work. Also invoices from existing subscriptions work fine. The invoice has been generated from a timesheet. I've only installed from OCA/account-invoicing

- account-invoicing/sale_timesheet_invoice_description

- account-invoicing/account_invoice_refund_link

Removed those modules, still same result.

Why don't you revert to Odoo support?

Author

Thanks for your help. I've submitted a ticket to Odoo support. Was just hoping somebody online on Sundays could help me understanding the problem. Obviously, it is more difficult.

Author Best Answer

Yes, company information is set up and also a currency is set.

I'm using Odoo Enterprise and the database has been successfully migrated and tested by Odoo SA.


Got the solution from Odoo SA


To solve this problem you should make and run a server action with the following Python code:
#sbb opw 1965437
env.cr.execute("UPDATE sale_order_line SET currency_id = 1 WHERE currency_id IS NULL;")
env.cr.execute("UPDATE sale_order_line SET company_id = 1 WHERE company_id IS NULL;")

This made it.

Avatar
Discard
Best Answer

Hi,

Not sure in invoice lines there is a field named currency_id, please check if there is a field names currency id in the invoice lines and whether it has got value in it.


Thanks

Avatar
Discard
Best Answer

Seems like that. How did you migrate though? Have you setup your company information in odoo?

Avatar
Discard
Related Posts Replies Views Activity
1
Sep 24
234
2
Aug 24
358
3
Jul 24
2393
1
Jul 24
363
2
Jun 24
457