OCA / contract

GNU Affero General Public License v3.0
173 stars 528 forks source link

Incorrect journal for multi-company setup #1146

Open blueuc opened 1 day ago

blueuc commented 1 day ago

Module

subscription_oca/models/sale_subscription_line.py

Describe the bug

When dealing with a multi-company setup with no product-level income accounts assigned, the invoice line creation pivots to the "product category" assigned accounts. However, it does not correctly reference the company field in the subscription template when referencing the category data. This can result in incorrect income accounts being used upon invoice creation.

To Reproduce

Affected versions:

Steps to reproduce the behavior:

  1. Create multi-company instance
  2. Set up product category with different income accounts for each company
  3. Convert subscription to invoice for company B, it will use company A's product category income account.

Expected behavior The company should be taken into account when referencing the 'product category' account settings.

blueuc commented 1 day ago

Proposed solution: utilize company context: https://github.com/OCA/contract/pull/1141/commits/3d54ed75d06771f859955cd74c2af88317be4fb3

pedrobaeza commented 1 day ago

I think it should be with_company. Can you propose a PR?