[MERGE] merged the report server branch

bzr revid: qdp-launchpad@tinyerp.com-20101125181426-dk8asryszl0mqytu
This commit is contained in:
qdp-launchpad@tinyerp.com 2010-11-25 19:14:26 +01:00
commit 5e35a7d806
7 changed files with 29 additions and 25 deletions

View File

@ -1044,7 +1044,7 @@
</record>
<assert id="main_company" model="res.company">
<test expr="currency_id.code == 'eur'.upper()"/>
<test expr="currency_id.name == 'eur'.upper()"/>
<test expr="name">OpenERP S.A.</test>
</assert>
@ -1170,7 +1170,7 @@
<field name="currency_id" ref="COP"/>
<field eval="time.strftime('%Y-01-01')" name="name"/>
</record>
<record id="CZK" model="res.currency">
<field name="name"></field>
<field name="code">CZK</field>
@ -1213,7 +1213,7 @@
<field name="currency_id" ref="HUF"/>
<field eval="time.strftime('%Y-01-01')" name="name"/>
</record>
<record id="IDR" model="res.currency">
<field name="name">Rs</field>
<field name="code">IDR</field>
@ -1290,7 +1290,7 @@
<field name="currency_id" ref="PLN"/>
<field eval="time.strftime('%Y-01-01')" name="name"/>
</record>
<record id="SEK" model="res.currency">
<field name="name">kr</field>
<field name="code">SEK</field>
@ -1304,7 +1304,7 @@
<field name="currency_id" ref="SEK"/>
<field eval="time.strftime('%Y-01-01')" name="name"/>
</record>
<record id="GBP" model="res.currency">
<field name="name">GBP</field>
<field name="code">GBP</field>
@ -1326,7 +1326,7 @@
<field name="rounding">0.01</field>
<field name="accuracy">4</field>
<field name="company_id" ref="main_company"/>
</record>
</record>
<record id="rateARS" model="res.currency.rate">
<field name="rate">5.0881</field>
<field name="currency_id" ref="ARS"/>

View File

@ -203,16 +203,16 @@ class res_company(osv.osv):
return """
<header>
<pageTemplate>
<frame id="first" x1="22.0" y1="22.0" width="1080" height="700"/>
<frame id="first" x1="28.0" y1="28.0" width="786" height="525"/>
<pageGraphics>
<fill color="black"/>
<stroke color="black"/>
<setFont name="DejaVu Sans" size="8"/>
<drawString x="25" y="725"> [[ formatLang(time.strftime("%Y-%m-%d"), date=True) ]] [[ time.strftime("%H:%M") ]]</drawString>
<drawString x="25" y="555"> [[ formatLang(time.strftime("%Y-%m-%d"), date=True) ]] [[ time.strftime("%H:%M") ]]</drawString>
<setFont name="DejaVu Sans Bold" size="10"/>
<drawString x="490" y="725">[[ company.partner_id.name ]]</drawString>
<drawString x="382" y="555">[[ company.partner_id.name ]]</drawString>
<stroke color="#000000"/>
<lines>25 720 1085 720</lines>
<lines>25 550 818 550</lines>
</pageGraphics>
</pageTemplate>
</header>"""
@ -220,16 +220,16 @@ class res_company(osv.osv):
return """
<header>
<pageTemplate>
<frame id="first" x1="1.3cm" y1="1.5cm" width="18.4cm" height="26.5cm"/>
<frame id="first" x1="28.0" y1="28.0" width="539" height="772"/>
<pageGraphics>
<fill color="black"/>
<stroke color="black"/>
<setFont name="DejaVu Sans" size="8"/>
<drawString x="1.3cm" y="28.3cm"> [[ formatLang(time.strftime("%Y-%m-%d"), date=True) ]] [[ time.strftime("%H:%M") ]]</drawString>
<drawString x="1.0cm" y="28.3cm"> [[ formatLang(time.strftime("%Y-%m-%d"), date=True) ]] [[ time.strftime("%H:%M") ]]</drawString>
<setFont name="DejaVu Sans Bold" size="10"/>
<drawString x="9.8cm" y="28.3cm">[[ company.partner_id.name ]]</drawString>
<drawString x="9.3cm" y="28.3cm">[[ company.partner_id.name ]]</drawString>
<stroke color="#000000"/>
<lines>1.3cm 28.1cm 20cm 28.1cm</lines>
<lines>1.0cm 28.1cm 20.1cm 28.1cm</lines>
</pageGraphics>
</pageTemplate>
</header>"""

View File

@ -393,7 +393,7 @@ class res_config_installer(osv.osv_memory):
cr, uid,
modules.search(cr, uid, [('name','in',to_install)]),
'to install', ['uninstalled'], context=context)
cr.commit() #TOFIX: after remove this statement, installation wizard is fail
cr.commit() #TOFIX: after remove this statement, installation wizard is fail
pooler.restart_pool(cr.dbname, update_module=True)
res_config_installer()

View File

@ -48,7 +48,6 @@ class res_currency(osv.osv):
_description = "Currency"
_columns = {
'name': fields.char('Currency', size=32, required=True),
'code': fields.char('Code', size=3),
'symbol': fields.char('Symbol', size=3),
'rate': fields.function(_current_rate, method=True, string='Current Rate', digits=(12,6),
help='The rate of the currency to the currency of rate 1'),
@ -65,7 +64,7 @@ class res_currency(osv.osv):
'active': lambda *a: 1,
'company_id': lambda self,cr,uid,c: self.pool.get('res.company')._company_default_get(cr, uid, 'res.currency', context=c)
}
_order = "code"
_order = "name"
def read(self, cr, user, ids, fields=None, context=None, load='_classic_read'):
res=super(osv.osv, self).read(cr, user, ids, fields, context, load)
@ -102,12 +101,12 @@ class res_currency(osv.osv):
if from_currency['rate'] == 0 or to_currency['rate'] == 0:
date = context.get('date', time.strftime('%Y-%m-%d'))
if from_currency['rate'] == 0:
code = from_currency.code
currency_symbol = from_currency.symbol
else:
code = to_currency.code
currency_symbol = to_currency.symbol
raise osv.except_osv(_('Error'), _('No rate found \n' \
'for the currency: %s \n' \
'at the date: %s') % (code, date))
'at the date: %s') % (currency_symbol, date))
rate = to_currency.rate/from_currency.rate
if account and (account.currency_mode=='average') and account.currency_id:
q = self.pool.get('account.move.line')._query_get(cr, uid, context=context)
@ -133,9 +132,7 @@ class res_currency(osv.osv):
args2 = args[:]
if name:
args += [('name', operator, name)]
args2 += [('code', operator, name)]
ids = self.search(cr, uid, args, limit=limit)
ids += self.search(cr, uid, args2, limit=limit)
res = self.name_get(cr, uid, ids, context)
return res
res_currency()

View File

@ -9,7 +9,6 @@
<field name="arch" type="xml">
<tree string="Currencies">
<field name="name"/>
<field name="code"/>
<field name="company_id" select="2" />
<field name="rate_ids" invisible="1"/>
<field name="date"/>
@ -28,7 +27,6 @@
<form string="Currency">
<group col="6" colspan="6">
<field name="name" select="1"/>
<field name="code" select="1"/>
<field name="rate"/>
<field name="company_id" select="2" groups="base.group_multi_company" />
<field name="symbol"/>

View File

@ -73,7 +73,7 @@ class NumberedCanvas(canvas.Canvas):
while not self.pages.get(key,False):
key = key + 1
self.setFont("Helvetica", 8)
self.drawRightString((self._pagesize[0]-35), (self._pagesize[1]-43),
self.drawRightString((self._pagesize[0]-30), (self._pagesize[1]-40),
"Page %(this)i of %(total)i" % {
'this': self._pageNumber+1,
'total': self.pages.get(key,False),

View File

@ -164,6 +164,7 @@ class rml_parse(object):
'lang' : user.company_id.partner_id.lang,
'translate' : self._translate,
'setHtmlImage' : self.set_html_image,
'strip_name' : self._strip_name,
'time' : time
}
self.localcontext.update(context)
@ -184,6 +185,14 @@ class rml_parse(object):
def setTag(self, oldtag, newtag, attrs=None):
return newtag, attrs
def _ellipsis(self, char, size=100, truncation_str='...'):
if len(char) <= size:
return char
return char[:size-len(truncation_str)] + truncation_str
def _strip_name(self, name, maxlen=50):
return self._ellipsis(name, maxlen)
def format(self, text, oldtag=None):
return text.strip()