If the user selects a branch and deactivates the parent company, he will not be able to create any LC. Explanations: Since the company field is a related one that targets the company of the journal, and since the journal belongs to the parent company, the LC created in the branch actually belongs to the parent company, which triggers an access error. Asking users to create branch-specific journals would just cancel all the benefits of the company branch feature. OPW-3651022 closes odoo/odoo#150972 X-original-commit: 915b2e2b8401db937db4162e32e84cf968728072 Signed-off-by: Arnold Moyaux (arm) <arm@odoo.com> Signed-off-by: Adrien Widart (awt) <awt@odoo.com>
13 lines
372 B
Python
13 lines
372 B
Python
# -*- coding: utf-8 -*-
|
|
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
|
|
|
from . import models
|
|
|
|
def _stock_landed_costs_company_post_init(env):
|
|
env.cr.execute("""
|
|
UPDATE stock_landed_cost cost
|
|
SET company_id = journal.company_id
|
|
FROM account_journal journal
|
|
WHERE cost.account_journal_id = journal.id
|
|
""")
|