[FIX] account: partial reconcile unreconcile with deleted credit/debit move

`debit_move_id` and `credit_move_id` of
`account.partial.reconcile` must be required.

Not having one of them set on this model
does not make sense, you cannot have a reconciliation
with a debit move but without a credit move, for instance.

Databases already having the trouble,
having partial reconciliations without
either a debit or a credit move,
had issues for the computation of the
`payment_move_line_ids` compute field,
which relied on the fact these fields
were supposed to be required. This revision
makes a retro-compatibility patch for these
databases already having the issue.

opw-677709
This commit is contained in:
Denis Ledoux
2016-05-17 17:57:08 +02:00
parent 68b127797e
commit 96e085355d
2 changed files with 4 additions and 4 deletions
+2 -2
View File
@@ -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,
+2 -2
View File
@@ -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')