delete invoice paid
parent
4d73bffaff
commit
38fad33d43
|
@ -18,7 +18,17 @@ class Migration(migration.Migration):
|
|||
for hdcase in get_model('clinic.hd.case').search_browse(dom):
|
||||
reset=False
|
||||
for inv in hdcase.invoices:
|
||||
if inv.state=='waiting_payment':
|
||||
if inv.state=='paid':
|
||||
inv.write({
|
||||
'state': 'waiting_payment',
|
||||
})
|
||||
for pm_line in get_model("account.payment.line").search_browse([['invoice_id','=',inv.id]]):
|
||||
pm=pm_line.payment_id
|
||||
pm.to_draft()
|
||||
pm.delete()
|
||||
inv.to_draft()
|
||||
inv.delete()
|
||||
elif inv.state=='waiting_payment':
|
||||
inv.to_draft()
|
||||
inv.delete()
|
||||
reset=True
|
||||
|
@ -29,10 +39,10 @@ class Migration(migration.Migration):
|
|||
'state': 'draft',
|
||||
})
|
||||
ids=list(hdcase_ids)
|
||||
|
||||
for seq in get_model("sequence").search_browse([['type','in',['cust_invoice','clinic_invoice_noclaim']]]):
|
||||
seq.write({
|
||||
'running': [('delete_all'),],
|
||||
})
|
||||
for run in seq.running:
|
||||
run.delete()
|
||||
for hdcase in get_model('clinic.hd.case').browse(ids):
|
||||
print('remake_invoice ---> ', hdcase.number)
|
||||
ctx={
|
||||
|
|
Loading…
Reference in New Issue