Add option to auto-archive spreads

This commit is contained in:
Andrea
2019-08-21 12:11:26 +02:00
committed by Andrea Stirpe
parent 117e80f381
commit 6bf9e855ed
10 changed files with 172 additions and 55 deletions

View File

@@ -166,3 +166,8 @@ class AccountInvoiceSpreadLine(models.Model):
'move_id').filtered(lambda m: m.state != 'posted')
unposted_moves.filtered(
lambda m: m.company_id.force_move_auto_post).post()
spreads_to_archive = self.env['account.spread'].search([
('all_posted', '=', True)
]).filtered(lambda s: s.company_id.auto_archive)
spreads_to_archive.write({'active': False})