2
0

Add partner in move lines

This commit is contained in:
Andrea 2019-06-14 09:00:30 +02:00 committed by Andrea Stirpe
parent 0d9b82f4f9
commit 117e80f381
2 changed files with 6 additions and 8 deletions

View File

@ -94,6 +94,7 @@ class AccountInvoiceSpreadLine(models.Model):
'account_id': spread.debit_account_id.id,
'debit': amount if amount > 0.0 else 0.0,
'credit': -amount if amount < 0.0 else 0.0,
'partner_id': self.spread_id.invoice_id.partner_id.id,
'analytic_account_id': analytic.id,
'analytic_tag_ids': analytic_tags,
'currency_id': not_same_curr and current_currency.id or False,
@ -103,6 +104,7 @@ class AccountInvoiceSpreadLine(models.Model):
'account_id': spread.credit_account_id.id,
'credit': amount if amount > 0.0 else 0.0,
'debit': -amount if amount < 0.0 else 0.0,
'partner_id': self.spread_id.invoice_id.partner_id.id,
'analytic_account_id': analytic.id,
'analytic_tag_ids': analytic_tags,
'currency_id': not_same_curr and current_currency.id or False,

View File

@ -512,10 +512,8 @@ class TestAccountInvoiceSpread(common.TransactionCase):
invoice_mls = self.invoice.move_id.mapped('line_ids')
self.assertTrue(invoice_mls)
count_balance_sheet = 0
for invoice_ml in invoice_mls:
if invoice_ml.account_id == balance_sheet:
count_balance_sheet += 1
count_balance_sheet = len(invoice_mls.filtered(
lambda x: x.account_id == balance_sheet))
self.assertEqual(count_balance_sheet, 1)
self.spread.line_ids.create_and_reconcile_moves()
@ -572,10 +570,8 @@ class TestAccountInvoiceSpread(common.TransactionCase):
invoice_mls = self.invoice.move_id.mapped('line_ids')
self.assertTrue(invoice_mls)
count_balance_sheet = 0
for invoice_ml in invoice_mls:
if invoice_ml.account_id == balance_sheet:
count_balance_sheet += 1
count_balance_sheet = len(invoice_mls.filtered(
lambda x: x.account_id == balance_sheet))
self.assertEqual(count_balance_sheet, 1)
self.spread.company_id.force_move_auto_post = True