Browse Source

Remove unused methods, add timezone to the reference date and fix translation

pull/9/head
dufresnedavid 10 years ago
committed by Maxime Chambreuil
parent
commit
f02c5a23ad
  1. 54
      account_partner_aged_statement_webkit/i18n/fr.po
  2. 18
      account_partner_aged_statement_webkit/report/partner_aged_statement.mako
  3. 57
      account_partner_aged_statement_webkit/report/partner_aged_statement_report.py

54
account_partner_aged_statement_webkit/i18n/fr.po

@ -106,6 +106,59 @@ msgid "\n"
" <br/>\n"
"\n"
" <p style=\"border-left: 1px solid #8e0000; margin-left: 30px;\">\n"
" &nbsp;&nbsp;<strong>REFERENCES</strong><br />\n"
" &nbsp;&nbsp;Total overdue amount: ${object.credit} ${user.company_id.currency_id.name}<br/>\n"
" </p>\n"
"\n"
" <br/>\n"
" <br/>\n"
" <div style=\"width: 375px; margin: 0px; padding: 0px; background-color: #8E0000; border-top-left-radius: 5px 5px; border-top-right-radius: 5px 5px; background-repeat: repeat no-repeat;\">\n"
" <h3 style=\"margin: 0px; padding: 2px 14px; font-size: 12px; color: #DDD;\">\n"
" <strong style=\"text-transform:uppercase;\">${user.company_id.name}</strong></h3>\n"
" </div>\n"
" <div style=\"width: 347px; margin: 0px; padding: 5px 14px; line-height: 16px; background-color: #F2F2F2;\">\n"
" <span style=\"color: #222; margin-bottom: 5px; display: block; \">\n"
" % if user.company_id.street:\n"
" ${user.company_id.street}<br/>\n"
" % endif\n"
" % if user.company_id.street2:\n"
" ${user.company_id.street2}<br/>\n"
" % endif\n"
" % if user.company_id.city or user.company_id.zip:\n"
" ${user.company_id.zip} ${user.company_id.city}<br/>\n"
" % endif\n"
" % if user.company_id.country_id:\n"
" ${user.company_id.state_id and ('%s, ' % user.company_id.state_id.name) or ''} ${user.company_id.country_id.name or ''}<br/>\n"
" % endif\n"
" </span>\n"
" % if user.company_id.phone:\n"
" <div style=\"margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; \">\n"
" Phone:&nbsp; ${user.company_id.phone}\n"
" </div>\n"
" % endif\n"
" % if user.company_id.website:\n"
" <div>\n"
" Web :&nbsp;<a href=\"${user.company_id.website}\">${user.company_id.website}</a>\n"
" </div>\n"
" %endif\n"
" <p></p>\n"
" </div>\n"
"</div>\n"
" "
msgstr "\n"
"<div style=\"font-family: 'Lucica Grande', Ubuntu, Arial, Verdana, sans-serif; font-size: 12px; color: rgb(34, 34, 34); background-color: #FFF; \">\n"
"\n"
" <!--<p>${user.company_id.overdue_msg.replace('\\n', '&lt;br/&gt;')} </p>-->\n"
" % for line in user.company_id.overdue_msg.split('\\n'):\n"
" <p> ${line}<br/> </p>\n"
" % endfor\n"
"\n"
" <br/>\n"
" ${user.name}\n"
" <br/>\n"
" <br/>\n"
"\n"
" <p style=\"border-left: 1px solid #8e0000; margin-left: 30px;\">\n"
" &nbsp;&nbsp;<strong>RÉFÉRENCES</strong><br />\n"
" &nbsp;&nbsp;Total du montant en retard: ${object.credit} ${user.company_id.currency_id.name}<br/>\n"
" </p>\n"
@ -145,7 +198,6 @@ msgid "\n"
" </div>\n"
"</div>\n"
" "
msgstr ""
#. module: account_partner_aged_statement_webkit
#: report:addons/account_partner_aged_statement_webkit/report/partner_aged_statement.mako:63

18
account_partner_aged_statement_webkit/report/partner_aged_statement.mako

@ -33,9 +33,9 @@
<br/>
<%from datetime import date %>
${_('Date')}: ${formatLang(str(date.today()), date=True)}
<br>
<br/>
${_('Partner')}: ${partner.name}
<br>
<br/>
${_('Subject')}: <b>${_('Overdue Statement')}</b>
<br/>
<br/>
@ -46,15 +46,15 @@
</p>
%endfor
%endif
<br>
<br/>
${user.name}
<br>
<br>
<br/>
<br/>
%if (partner.credit + partner.debit == 0) :
<div class="title">${_('Nothing due for this partner')}</div>
%else:
<div class="title">${_('Aged Balance')}</div>
<br>
<br/>
%if get_balance(partner, company):
<table class="basic_table" style="width: 100%;">
<tr>
@ -81,11 +81,11 @@
%endfor
</table>
%endif
<br>
<br>
<br/>
<br/>
<div class="title">${_('List of Due Invoices')}</div>
%if getLines30(partner, company):
<br>
<br/>
<div class="total">${_('0-30')}</div>
<table class="basic_table" style="width: 100%;">
<tr>

57
account_partner_aged_statement_webkit/report/partner_aged_statement_report.py

@ -21,7 +21,7 @@
###############################################################################
import time
import pytz
from datetime import datetime
from dateutil.relativedelta import relativedelta
@ -56,12 +56,15 @@ class PartnerAgedTrialReport(aged_trial_report):
})
self.partner_invoices_dict = {}
self.ttype = 'receipt'
tz = self.localcontext.get('tz', False)
tz = tz and pytz.timezone(tz) or pytz.utc
self.today = datetime.now(tz)
def _get_balance(self, partner, company):
"""
Get the lines of balance to display in the report
"""
today = datetime.now()
today = self.today
date_30 = today - relativedelta(days=30)
date_60 = today - relativedelta(days=60)
date_90 = today - relativedelta(days=90)
@ -257,7 +260,7 @@ class PartnerAgedTrialReport(aged_trial_report):
return self.partner_invoices_dict[partner.id]
def _lines_get_30(self, partner, company):
today = datetime.now()
today = self.today
stop = today - relativedelta(days=30)
today = today.strftime(DEFAULT_SERVER_DATE_FORMAT)
@ -271,7 +274,7 @@ class PartnerAgedTrialReport(aged_trial_report):
return movelines
def _lines_get_30_60(self, partner, company):
today = datetime.now()
today = self.today
start = today - relativedelta(days=30)
stop = start - relativedelta(days=30)
@ -282,12 +285,12 @@ class PartnerAgedTrialReport(aged_trial_report):
movelines = self._get_current_invoice_lines(partner, company, today)
movelines = [
line for line in movelines
if stop < line['date_due'] <= start
if line['date_due'] and stop < line['date_due'] <= start
]
return movelines
def _lines_get60(self, partner, company):
today = datetime.now()
today = self.today
start = today - relativedelta(days=60)
today = today.strftime(DEFAULT_SERVER_DATE_FORMAT)
@ -304,51 +307,11 @@ class PartnerAgedTrialReport(aged_trial_report):
company_pool = pooler.get_pool(self.cr.dbname)['res.company']
message = company_pool.browse(
self.cr, self.uid, company.id, {'lang': obj.lang}).overdue_msg
return message.split('\n')
def _get_fiscalyear(self, data):
now = data['fInvoicesorm']['date_from']
domain = [
('company_id', '=', self._company.id),
('date_start', '<', now),
('date_stop', '>', now),
]
fiscalyears_obj = pooler.get_pool(self.cr.dbname)['account.fiscalyear']
fiscalyears = fiscalyears_obj.search(
self.cr, self.uid, domain, limit=1, context=self.localcontext)
if fiscalyears:
return fiscalyears_obj.browse(
self.cr, self.uid, fiscalyears[0], context=self.localcontext
).name
else:
return ''
def _get_account(self, data):
account_obj = pooler.get_pool(self.cr.dbname).get('account.account')
accounts = account_obj.search(
self.cr, self.uid,
[('parent_id', '=', False), ('company_id', '=', self._company.id)],
limit=1, context=self.localcontext)
if accounts:
return account_obj.browse(
self.cr, self.uid, accounts[0],
context=self.localcontext).name
else:
return ''
return message and message.split('\n') or ''
def _get_company(self, data):
return self._company.name
def _get_journal(self, data):
codes = []
if data.get('form', False) and data['form'].get('journal_ids', False):
self.cr.execute(
'select code from account_journal where id IN %s',
(tuple(data['form']['journal_ids']),)
)
codes = [x for x, in self.cr.fetchall()]
return codes
def _get_currency(self, data):
return self._company.currency_id.symbol

Loading…
Cancel
Save