|
@ -28,7 +28,7 @@ from .webkit_parser_header_fix import HeaderFooterTextWebKitParser |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def make_ranges(top, offset): |
|
|
def make_ranges(top, offset): |
|
|
"""Return sorted day ranges""" |
|
|
|
|
|
|
|
|
"""Return sorted days ranges""" |
|
|
ranges = [(n, min(n + offset, top)) for n in xrange(0, top, offset)] |
|
|
ranges = [(n, min(n + offset, top)) for n in xrange(0, top, offset)] |
|
|
ranges.insert(0, (-100000000000, 0)) |
|
|
ranges.insert(0, (-100000000000, 0)) |
|
|
ranges.append((top, 100000000000)) |
|
|
ranges.append((top, 100000000000)) |
|
@ -110,6 +110,7 @@ class AccountAgedTrialBalanceWebkit(PartnersOpenInvoicesWebkit): |
|
|
|
|
|
|
|
|
:returns: parent :class:`.open_invoices.PartnersOpenInvoicesWebkit` |
|
|
:returns: parent :class:`.open_invoices.PartnersOpenInvoicesWebkit` |
|
|
call to set_context |
|
|
call to set_context |
|
|
|
|
|
|
|
|
""" |
|
|
""" |
|
|
res = super(AccountAgedTrialBalanceWebkit, self).set_context( |
|
|
res = super(AccountAgedTrialBalanceWebkit, self).set_context( |
|
|
objects, |
|
|
objects, |
|
@ -142,7 +143,9 @@ class AccountAgedTrialBalanceWebkit(PartnersOpenInvoicesWebkit): |
|
|
:params: ledger_lines generated by parent |
|
|
:params: ledger_lines generated by parent |
|
|
:class:`.open_invoices.PartnersOpenInvoicesWebkit` |
|
|
:class:`.open_invoices.PartnersOpenInvoicesWebkit` |
|
|
|
|
|
|
|
|
:return computed ledger lines""" |
|
|
|
|
|
|
|
|
:return computed ledger lines |
|
|
|
|
|
|
|
|
|
|
|
""" |
|
|
lines_to_age = self.filter_lines(partner_id, ledger_lines) |
|
|
lines_to_age = self.filter_lines(partner_id, ledger_lines) |
|
|
res = {} |
|
|
res = {} |
|
|
end_date = self._get_end_date(data) |
|
|
end_date = self._get_end_date(data) |
|
@ -160,9 +163,16 @@ class AccountAgedTrialBalanceWebkit(PartnersOpenInvoicesWebkit): |
|
|
return res |
|
|
return res |
|
|
|
|
|
|
|
|
def _get_end_date(self, data): |
|
|
def _get_end_date(self, data): |
|
|
|
|
|
"""Retrieve end date to be used to compute delay. |
|
|
|
|
|
:param data: data dict send to report contains form dict |
|
|
|
|
|
|
|
|
|
|
|
:returns: end date to be used to compute overdur delay |
|
|
|
|
|
|
|
|
|
|
|
""" |
|
|
end_date = None |
|
|
end_date = None |
|
|
date_to = data['form']['date_to'] |
|
|
date_to = data['form']['date_to'] |
|
|
period_to_id = data['form']['period_to'] |
|
|
period_to_id = data['form']['period_to'] |
|
|
|
|
|
fiscal_to_id = data['form']['fiscalyear_id'] |
|
|
if date_to: |
|
|
if date_to: |
|
|
end_date = date_to |
|
|
end_date = date_to |
|
|
elif period_to_id: |
|
|
elif period_to_id: |
|
@ -170,6 +180,11 @@ class AccountAgedTrialBalanceWebkit(PartnersOpenInvoicesWebkit): |
|
|
self.uid, |
|
|
self.uid, |
|
|
period_to_id) |
|
|
period_to_id) |
|
|
end_date = period_to.date_stop |
|
|
end_date = period_to.date_stop |
|
|
|
|
|
elif fiscal_to_id: |
|
|
|
|
|
fiscal_to = self.pool['account.fiscalyear'].browse(self.cr, |
|
|
|
|
|
self.uid, |
|
|
|
|
|
fiscal_to_id) |
|
|
|
|
|
end_date = fiscal_to.date_stop |
|
|
else: |
|
|
else: |
|
|
raise ValueError('End date and end period not available') |
|
|
raise ValueError('End date and end period not available') |
|
|
return end_date |
|
|
return end_date |
|
@ -230,7 +245,9 @@ class AccountAgedTrialBalanceWebkit(PartnersOpenInvoicesWebkit): |
|
|
customer tend to have one or two month of delay |
|
|
customer tend to have one or two month of delay |
|
|
|
|
|
|
|
|
:param overdue_days: int representing the lenght in days of delay |
|
|
:param overdue_days: int representing the lenght in days of delay |
|
|
|
|
|
|
|
|
:returns: the index of the correct range in ´´RANGES´´ |
|
|
:returns: the index of the correct range in ´´RANGES´´ |
|
|
|
|
|
|
|
|
""" |
|
|
""" |
|
|
for drange in RANGES: |
|
|
for drange in RANGES: |
|
|
if overdue_days <= drange[1]: |
|
|
if overdue_days <= drange[1]: |
|
|