19.0 vanilla

This commit is contained in:
Ernad Husremovic 2026-03-09 09:32:12 +01:00
parent 79f83631d5
commit 73afc09215
6267 changed files with 1534193 additions and 1130106 deletions

View file

@ -2,6 +2,7 @@
from odoo.addons.sale_stock.tests.test_anglo_saxon_valuation_reconciliation import TestValuationReconciliationCommon
from odoo.tests import tagged
@tagged('post_install', '-at_install')
class TestAngloSaxonAccounting(TestValuationReconciliationCommon):
@ -10,20 +11,23 @@ class TestAngloSaxonAccounting(TestValuationReconciliationCommon):
Reproduce the flow of creating an invoice from a sale order with company A
and posting the invoice with both companies selected and company B as the main.
"""
company_a_data = self.company_data
company_b_data = self.company_data_2
companies_with_b_first = company_b_data['company'] + company_a_data['company']
product = self.test_product_delivery
# Conflict between account common and stock common file. We should remove the depends on account common.
self.env.user.company_id = self.company
company_a_data = self.company
company_b_data = self._create_company()
companies_with_b_first = company_b_data + company_a_data
self.env.user.company_ids = companies_with_b_first
product = self.product_standard_auto
# set different cost price for the same product in the 2 companies
company_a_standard_price = 20.0
product.with_company(company_a_data['company']).standard_price = company_a_standard_price
product.with_company(company_a_data).standard_price = company_a_standard_price
company_b_standard_price = 10.0
product.with_company(company_b_data['company']).standard_price = company_b_standard_price
product.with_company(company_b_data).standard_price = company_b_standard_price
# create sale order with company A in draft (by default, self.env.user.company_id is company A)
company_a_order = self._create_sale(product, '2021-01-01')
company_a_invoice = self._create_invoice_for_so(company_a_order, product, '2021-01-10')
self._so_deliver(product, quantity=1, price=66.0, picking=False, partner=self.vendor, date_order='2021-01-01')
company_a_invoice = self._create_invoice(product, quantity=1, price_unit=66.0, invoice_date='2021-01-10', post=False)
# Post the invoice from company A with company B
company_a_invoice.with_context(allowed_company_ids=companies_with_b_first.ids).action_post()