Files
tryton/invoice.py
T
Cédric Krier d84540199b Fix flake8 errors and warnings
We add the flake8 configuration used so we ensure everyone uses the same.
We remove the usage of __all__ for non public API.
When possible, we rationalize the class name according to its __name__ and module.

issue9082
review297061002
2020-03-01 12:33:53 +01:00

27 lines
926 B
Python

# This file is part of Tryton. The COPYRIGHT file at the top level of
# this repository contains the full copyright notices and license terms.
from trytond.pool import PoolMeta, Pool
from trytond.transaction import Transaction
from trytond.tools import grouped_slice
class InvoiceLine(metaclass=PoolMeta):
__name__ = 'account.invoice.line'
@classmethod
def delete(cls, lines):
pool = Pool()
WorkInvoicedProgress = pool.get('project.work.invoiced_progress')
# Delete progress using root to skip access rule
progress = []
for sub_ids in grouped_slice([l.id for l in lines]):
progress += WorkInvoicedProgress.search([
('invoice_line', 'in', sub_ids),
])
if progress:
with Transaction().set_user(0):
WorkInvoicedProgress.delete(progress)
super(InvoiceLine, cls).delete(lines)