Nans Lefebvre 66e1049d85 [FIX] sale: get correct journal to create corresponding invoice
Be in company C1. Create the invoice I for a SO in company C2.
The invoice is created on the default account.journal for C1.
This happens when e.g. C2 is a child company of C1.
Then I is accessible from C1, but not from C2
as reading the journal violates the multi-company record rules.

Note that if company_id == False, then
self.env['account.invoice'].with_context(company_id=company_id)
    .default_get(['journal_id'])['journal_id']
returns False, and in that case, it would raise below.
To keep with the existing behaviour, we put a fallback on
self.env.user.company_id.id
which means that the values we pass are:
'company_id': False, 'journal_id': J for some J in company C
which is flaky, but won't trigger any extra errors.

opw 2068291

closes odoo/odoo#37002

X-original-commit: 427280d9760a71e6ca2961bcf4a2f9f157e6dddd
Signed-off-by: Nans Lefebvre (len) <len@odoo.com>
2019-09-17 11:36:57 +00:00
…
…
…
…
…
…
…

Build Status Tech Doc Help Nightly Builds

Odoo

Odoo is a suite of web based open source business apps.

The main Odoo Apps include an Open Source CRM, Website Builder, eCommerce, Warehouse Management, Project Management, Billing & Accounting, Point of Sale, Human Resources, Marketing, Manufacturing, Purchase Management, ...

Odoo Apps can be used as stand-alone applications, but they also integrate seamlessly so you get a full-featured Open Source ERP when you install several Apps.

Getting started with Odoo

For a standard installation please follow the Setup instructions from the documentation.

Then follow the developer tutorials

S
Description
No description provided
Readme LGPL-3.0
3.4 GiB
Languages
Python 49.6%
JavaScript 47.8%
SCSS 2%
CSS 0.3%
HTML 0.2%