From 4a7f4787b5d53e15c66e4ae072b8f59747b8de9b Mon Sep 17 00:00:00 2001 From: Harsh Vadodaria Date: Wed, 18 Jul 2018 12:48:49 +0530 Subject: [PATCH] [IMP]: Added Upstream Patch for account --- addons/account/models/account_move.py | 4 ++-- addons/account/tests/test_reconciliation.py | 5 ++--- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/addons/account/models/account_move.py b/addons/account/models/account_move.py index ba9c387e..c3a594d1 100644 --- a/addons/account/models/account_move.py +++ b/addons/account/models/account_move.py @@ -445,7 +445,7 @@ class AccountMoveLine(models.Model): tax_line_id = fields.Many2one('account.tax', string='Originator tax', ondelete='restrict') analytic_account_id = fields.Many2one('account.analytic.account', string='Analytic Account') analytic_tag_ids = fields.Many2many('account.analytic.tag', string='Analytic tags') - company_id = fields.Many2one('res.company', related='account_id.company_id', string='Company', store=True) + company_id = fields.Many2one('res.company', related='account_id.company_id', string='Company', store=True, readonly=True) branch_id = fields.Many2one(related='move_id.branch_id', string='Branch', store=True) counterpart = fields.Char("Counterpart", compute='_get_counterpart', help="Compute the counter part accounts of this journal item for this journal entry. This can be needed in reports.") @@ -1206,7 +1206,7 @@ class AccountMoveLine(models.Model): current_invoice = self.env['account.invoice'].browse(self.env.context['invoice_id']) aml_to_keep = current_invoice.move_id.line_ids | current_invoice.move_id.line_ids.mapped('full_reconcile_id.exchange_move_id.line_ids') rec_move_ids = rec_move_ids.filtered( - lambda r: (r.debit_move_id + r.credit_move_id) & current_invoice.move_id.line_ids + lambda r: (r.debit_move_id + r.credit_move_id) & aml_to_keep ) return rec_move_ids.unlink() diff --git a/addons/account/tests/test_reconciliation.py b/addons/account/tests/test_reconciliation.py index 8f7421d2..788267d2 100644 --- a/addons/account/tests/test_reconciliation.py +++ b/addons/account/tests/test_reconciliation.py @@ -790,8 +790,7 @@ class TestReconciliation(AccountingTestCase): statement = self.make_payment(invoice, journal, 50) # Case 1: The invoice and payment are reconciled: Nothing should appear - report_lines, total, amls = AgedReport._get_partner_move_lines(account_type, report_date_to, 'posted', 30) - + report_lines, total, amls = AgedReport._get_partner_move_lines(account_type, report_date_to, 'posted', 30, self.env.user.company_id.branch_id) partner_lines = [line for line in report_lines if line['partner_id'] == partner.id] self.assertEqual(partner_lines, [], 'The aged receivable shouldn\'t have lines at this point') self.assertFalse(partner.id in amls, 'The aged receivable should not have amls either') @@ -799,7 +798,7 @@ class TestReconciliation(AccountingTestCase): # Case 2: The invoice and payment are not reconciled: we should have one line on the report # and 2 amls invoice.move_id.line_ids.with_context(invoice_id=invoice.id).remove_move_reconcile() - report_lines, total, amls = AgedReport._get_partner_move_lines(account_type, report_date_to, 'posted', 30) + report_lines, total, amls = AgedReport._get_partner_move_lines(account_type, report_date_to, 'posted', 30, self.env.user.company_id.branch_id) partner_lines = [line for line in report_lines if line['partner_id'] == partner.id] self.assertEqual(partner_lines, [{'trust': 'normal', '1': 0.0, '0': 0.0, 'direction': 0.0, 'partner_id': partner.id, '3': 0.0, 'total': 0.0, 'name': 'AgedPartner', '4': 0.0, '2': 0.0}],