diff --git a/addons/account/models/account_invoice.py b/addons/account/models/account_invoice.py index 89a6dcd1cb0..4465d4ff7f0 100644 --- a/addons/account/models/account_invoice.py +++ b/addons/account/models/account_invoice.py @@ -180,8 +180,8 @@ class AccountInvoice(models.Model): def _compute_payments(self): payment_lines = [] for line in self.move_id.line_ids: - payment_lines.extend([rp.credit_move_id.id for rp in line.matched_credit_ids]) - payment_lines.extend([rp.debit_move_id.id for rp in line.matched_debit_ids]) + payment_lines.extend(filter(None, [rp.credit_move_id.id for rp in line.matched_credit_ids])) + payment_lines.extend(filter(None, [rp.debit_move_id.id for rp in line.matched_debit_ids])) self.payment_move_line_ids = self.env['account.move.line'].browse(list(set(payment_lines))) name = fields.Char(string='Reference/Description', index=True, diff --git a/addons/account/models/account_move.py b/addons/account/models/account_move.py index 0b8db4bf796..5cc899b9fad 100644 --- a/addons/account/models/account_move.py +++ b/addons/account/models/account_move.py @@ -1208,8 +1208,8 @@ class AccountPartialReconcile(models.Model): _name = "account.partial.reconcile" _description = "Partial Reconcile" - debit_move_id = fields.Many2one('account.move.line', index=True) - credit_move_id = fields.Many2one('account.move.line', index=True) + debit_move_id = fields.Many2one('account.move.line', index=True, required=True) + credit_move_id = fields.Many2one('account.move.line', index=True, required=True) amount = fields.Monetary(currency_field='company_currency_id', help="Amount concerned by this matching. Assumed to be always positive") amount_currency = fields.Monetary(string="Amount in Currency") currency_id = fields.Many2one('res.currency', string='Currency')