[FIX] account: ensure properties are read with the correct company.
This commit is contained in:
@@ -69,7 +69,7 @@ class AccountAnalyticLine(models.Model):
|
||||
return {}
|
||||
|
||||
result = 0.0
|
||||
prod_accounts = self.product_id.product_tmpl_id._get_product_accounts()
|
||||
prod_accounts = self.product_id.product_tmpl_id.with_company(self.company_id)._get_product_accounts()
|
||||
unit = self.product_uom_id
|
||||
account = prod_accounts['expense']
|
||||
if not unit or self.product_id.uom_po_id.category_id.id != unit.category_id.id:
|
||||
|
||||
@@ -743,6 +743,7 @@ class AccountMove(models.Model):
|
||||
def _recompute_payment_terms_lines(self):
|
||||
''' Compute the dynamic payment term lines of the journal entry.'''
|
||||
self.ensure_one()
|
||||
self = self.with_company(self.company_id)
|
||||
in_draft_mode = self != self._origin
|
||||
today = fields.Date.context_today(self)
|
||||
|
||||
|
||||
@@ -348,6 +348,7 @@ class account_payment(models.Model):
|
||||
@api.depends('invoice_ids', 'payment_type', 'partner_type', 'partner_id')
|
||||
def _compute_destination_account_id(self):
|
||||
for payment in self:
|
||||
payment = payment.with_company(payment.company_id)
|
||||
if payment.invoice_ids:
|
||||
payment.destination_account_id = payment.invoice_ids[0].mapped(
|
||||
'line_ids.account_id').filtered(
|
||||
|
||||
@@ -336,7 +336,7 @@ class AccountReconcileModel(models.Model):
|
||||
open_balance_dict = False
|
||||
else:
|
||||
balance = total_residual - line_residual
|
||||
partner = partner or st_line.partner_id
|
||||
partner = (partner or st_line.partner_id).with_company(st_line.company_id)
|
||||
open_balance_dict = {
|
||||
'name': '%s : %s' % (st_line.name, _('Open Balance')),
|
||||
'account_id': balance < 0 and partner.property_account_payable_id.id or partner.property_account_receivable_id.id,
|
||||
|
||||
Reference in New Issue
Block a user