[FIX] membership: remove date_cancel for draft invoices
In `action_cancel` method below, the date_cancel is set when the linked invoice is canceled. When the canceled invoiced was reset to draft, the date_cancel was not removed. This change makes sense as the state of the membership line is changed from `cancel` to `waiting` when the invoice is reset to draft. Closes #14313
This commit is contained in:
parent
adb12f95ea
commit
aac0faafb8
|
@ -477,6 +477,15 @@ class Invoice(osv.osv):
|
|||
'''Invoice'''
|
||||
_inherit = 'account.invoice'
|
||||
|
||||
def action_cancel_draft(self, cr, uid, ids, context=None):
|
||||
member_line_obj = self.pool.get('membership.membership_line')
|
||||
for invoice in self.browse(cr, uid, ids, context=context):
|
||||
mlines = member_line_obj.search(cr, uid,
|
||||
[('account_invoice_line', 'in',
|
||||
[l.id for l in invoice.invoice_line])])
|
||||
member_line_obj.write(cr, uid, mlines, {'date_cancel': False}, context=context)
|
||||
return super(Invoice, self).action_cancel_draft(cr, uid, ids, context=context)
|
||||
|
||||
def action_cancel(self, cr, uid, ids, context=None):
|
||||
'''Create a 'date_cancel' on the membership_line object'''
|
||||
member_line_obj = self.pool.get('membership.membership_line')
|
||||
|
|
Loading…
Reference in New Issue