Skip to content
Snippets Groups Projects
Commit 898f3bde authored by Marco Folco's avatar Marco Folco
Browse files

[MOD] account invoice

Inherited write of account invoice to change state of benefits to charged when the invoice gets fully paid
parent eedf6622
No related branches found
No related tags found
1 merge request!46Resolve SOF-90 "Quitar cantidad prestaciones"
......@@ -10,6 +10,14 @@ class AccountInvoice(models.Model):
medical_invoice_id = fields.Many2one('medical.invoice', string='Medical invoice')
@api.multi
def write(self, vals):
super(AccountInvoice, self).write(vals)
for invoice in self:
if invoice.state == 'paid':
i_lines = invoice.invoice_line_ids.filtered(lambda x:x.benefit_id.invoice_id == self and x.benefit_id.state == 'invoiced').mapped('benefit_id')
i_lines.write({'state': 'charged'})
@api.multi
def button_reconcile_refund(self):
aml_ids = self.move_id.line_ids.filtered(lambda r: not r.reconciled and r.account_id.internal_type in ('payable','receivable'))
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment