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" " <br/>\n"
"\n" "\n"
" <p style=\"border-left: 1px solid #8e0000; margin-left: 30px;\">\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;<strong>RÉFÉRENCES</strong><br />\n"
" &nbsp;&nbsp;Total du montant en retard: ${object.credit} ${user.company_id.currency_id.name}<br/>\n" " &nbsp;&nbsp;Total du montant en retard: ${object.credit} ${user.company_id.currency_id.name}<br/>\n"
" </p>\n" " </p>\n"
@ -145,7 +198,6 @@ msgid "\n"
" </div>\n" " </div>\n"
"</div>\n" "</div>\n"
" " " "
msgstr ""
#. module: account_partner_aged_statement_webkit #. module: account_partner_aged_statement_webkit
#: report:addons/account_partner_aged_statement_webkit/report/partner_aged_statement.mako:63 #: 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/> <br/>
<%from datetime import date %> <%from datetime import date %>
${_('Date')}: ${formatLang(str(date.today()), date=True)} ${_('Date')}: ${formatLang(str(date.today()), date=True)}
<br>
<br/>
${_('Partner')}: ${partner.name} ${_('Partner')}: ${partner.name}
<br>
<br/>
${_('Subject')}: <b>${_('Overdue Statement')}</b> ${_('Subject')}: <b>${_('Overdue Statement')}</b>
<br/> <br/>
<br/> <br/>
@ -46,15 +46,15 @@
</p> </p>
%endfor %endfor
%endif %endif
<br>
<br/>
${user.name} ${user.name}
<br>
<br>
<br/>
<br/>
%if (partner.credit + partner.debit == 0) : %if (partner.credit + partner.debit == 0) :
<div class="title">${_('Nothing due for this partner')}</div> <div class="title">${_('Nothing due for this partner')}</div>
%else: %else:
<div class="title">${_('Aged Balance')}</div> <div class="title">${_('Aged Balance')}</div>
<br>
<br/>
%if get_balance(partner, company): %if get_balance(partner, company):
<table class="basic_table" style="width: 100%;"> <table class="basic_table" style="width: 100%;">
<tr> <tr>
@ -81,11 +81,11 @@
%endfor %endfor
</table> </table>
%endif %endif
<br>
<br>
<br/>
<br/>
<div class="title">${_('List of Due Invoices')}</div> <div class="title">${_('List of Due Invoices')}</div>
%if getLines30(partner, company): %if getLines30(partner, company):
<br>
<br/>
<div class="total">${_('0-30')}</div> <div class="total">${_('0-30')}</div>
<table class="basic_table" style="width: 100%;"> <table class="basic_table" style="width: 100%;">
<tr> <tr>

57
account_partner_aged_statement_webkit/report/partner_aged_statement_report.py

@ -21,7 +21,7 @@
############################################################################### ###############################################################################
import time import time
import pytz
from datetime import datetime from datetime import datetime
from dateutil.relativedelta import relativedelta from dateutil.relativedelta import relativedelta
@ -56,12 +56,15 @@ class PartnerAgedTrialReport(aged_trial_report):
}) })
self.partner_invoices_dict = {} self.partner_invoices_dict = {}
self.ttype = 'receipt' 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): def _get_balance(self, partner, company):
""" """
Get the lines of balance to display in the report Get the lines of balance to display in the report
""" """
today = datetime.now()
today = self.today
date_30 = today - relativedelta(days=30) date_30 = today - relativedelta(days=30)
date_60 = today - relativedelta(days=60) date_60 = today - relativedelta(days=60)
date_90 = today - relativedelta(days=90) date_90 = today - relativedelta(days=90)
@ -257,7 +260,7 @@ class PartnerAgedTrialReport(aged_trial_report):
return self.partner_invoices_dict[partner.id] return self.partner_invoices_dict[partner.id]
def _lines_get_30(self, partner, company): def _lines_get_30(self, partner, company):
today = datetime.now()
today = self.today
stop = today - relativedelta(days=30) stop = today - relativedelta(days=30)
today = today.strftime(DEFAULT_SERVER_DATE_FORMAT) today = today.strftime(DEFAULT_SERVER_DATE_FORMAT)
@ -271,7 +274,7 @@ class PartnerAgedTrialReport(aged_trial_report):
return movelines return movelines
def _lines_get_30_60(self, partner, company): def _lines_get_30_60(self, partner, company):
today = datetime.now()
today = self.today
start = today - relativedelta(days=30) start = today - relativedelta(days=30)
stop = start - 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 = self._get_current_invoice_lines(partner, company, today)
movelines = [ movelines = [
line for line in movelines line for line in movelines
if stop < line['date_due'] <= start
if line['date_due'] and stop < line['date_due'] <= start
] ]
return movelines return movelines
def _lines_get60(self, partner, company): def _lines_get60(self, partner, company):
today = datetime.now()
today = self.today
start = today - relativedelta(days=60) start = today - relativedelta(days=60)
today = today.strftime(DEFAULT_SERVER_DATE_FORMAT) 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'] company_pool = pooler.get_pool(self.cr.dbname)['res.company']
message = company_pool.browse( message = company_pool.browse(
self.cr, self.uid, company.id, {'lang': obj.lang}).overdue_msg 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): def _get_company(self, data):
return self._company.name 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): def _get_currency(self, data):
return self._company.currency_id.symbol return self._company.currency_id.symbol

Loading…
Cancel
Save