Last active
August 17, 2020 13:23
-
-
Save denihida1216/ea3379b40cafeaf8ac00e14a19758e85 to your computer and use it in GitHub Desktop.
Odoo Zero DB Table
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@api.multi | |
def remove_account(self): | |
to_removes = [ | |
['account.voucher.line', ], | |
['account.voucher', ], | |
['account.bank.statement.line', ], | |
['account.payment', ], | |
['account.analytic.line', ], | |
['account.analytic.account', ], | |
['account.invoice.line', ], | |
['account.invoice.refund', ], | |
['account.invoice', ], | |
['account.partial.reconcile', ], | |
['account.move.line', ], | |
['hr.expense.sheet', ], | |
['account.move', ], | |
] | |
try: | |
for line in to_removes: | |
obj_name = line[0] | |
obj = self.pool.get(obj_name) | |
if obj: | |
sql = "delete from %s" % obj._table | |
self._cr.execute(sql) | |
seqs = self.env['ir.sequence'].search([ | |
'|', ('code', '=', 'account.reconcile'), | |
'|', ('code', '=', 'account.payment.customer.invoice'), | |
'|', ('code', '=', 'account.payment.customer.refund'), | |
'|', ('code', '=', 'account.payment.supplier.invoice'), | |
'|', ('code', '=', 'account.payment.supplier.refund'), | |
'|', ('code', '=', 'account.payment.transfer'), | |
'|', ('prefix', 'like', 'BNK1/'), | |
'|', ('prefix', 'like', 'CSH1/'), | |
'|', ('prefix', 'like', 'INV/'), | |
'|', ('prefix', 'like', 'EXCH/'), | |
('prefix', 'like', 'MISC/') | |
]) | |
for seq in seqs: | |
seq.write({ | |
'number_next': 1, | |
}) | |
except Exception as e: | |
pass # raise Warning(e) | |
return True |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment