[FIX] renamed ir.actions.report.paperformat model to report.paperformat, renamed html_skeleton to html_container in report layouts and renamed paperformat.py file to report_paperformat.py

bzr revid: sle@openerp.com-20140218155347-tfxlndg9wgaw0bv1
This commit is contained in:
Simon Lejeune 2014-02-18 16:53:47 +01:00
parent 47d1019ed0
commit fabc1cdd40
17 changed files with 75 additions and 80 deletions

View File

@ -2,7 +2,7 @@
<openerp> <openerp>
<data> <data>
<template id="report_vat"> <template id="report_vat">
<t t-call="report.html_skeleton"> <t t-call="report.html_container">
<t t-call="report.internal_layout"> <t t-call="report.internal_layout">
<div class="page"> <div class="page">
<h2>Tax Statement</h2> <h2>Tax Statement</h2>

View File

@ -2,7 +2,7 @@
<openerp> <openerp>
<data> <data>
<template id="report_lunchorder"> <template id="report_lunchorder">
<t t-call="report.html_skeleton"> <t t-call="report.html_container">
<t t-call="report.external_layout"> <t t-call="report.external_layout">
<div class="page"> <div class="page">
<div class="oe_structure"/> <div class="oe_structure"/>

View File

@ -2,7 +2,7 @@
<openerp> <openerp>
<data> <data>
<template id="report_mrporder"> <template id="report_mrporder">
<t t-call="report.html_skeleton"> <t t-call="report.html_container">
<t t-foreach="docs" t-as="o"> <t t-foreach="docs" t-as="o">
<t t-call="report.internal_layout"> <t t-call="report.internal_layout">
<div class="page"> <div class="page">

View File

@ -2,7 +2,7 @@
<openerp> <openerp>
<data> <data>
<template id="report_mrprepairorder"> <template id="report_mrprepairorder">
<t t-call="report.html_skeleton"> <t t-call="report.html_container">
<t t-foreach="docs" t-as="o"> <t t-foreach="docs" t-as="o">
<t t-call="report.external_layout"> <t t-call="report.external_layout">
<div class="page"> <div class="page">

View File

@ -2,7 +2,7 @@
<openerp> <openerp>
<data> <data>
<template id="report_purchaseorder"> <template id="report_purchaseorder">
<t t-call="report.html_skeleton"> <t t-call="report.html_container">
<t t-foreach="docs" t-as="o"> <t t-foreach="docs" t-as="o">
<t t-call="report.external_layout"> <t t-call="report.external_layout">
<div class="page"> <div class="page">

View File

@ -2,7 +2,7 @@
<openerp> <openerp>
<data> <data>
<template id="report_purchasequotation"> <template id="report_purchasequotation">
<t t-call="report.html_skeleton"> <t t-call="report.html_container">
<t t-foreach="docs" t-as="o"> <t t-foreach="docs" t-as="o">
<t t-call="report.external_layout"> <t t-call="report.external_layout">
<div class="page"> <div class="page">

View File

@ -2,7 +2,7 @@
<openerp> <openerp>
<data> <data>
<template id="report_purchaserequisitions"> <template id="report_purchaserequisitions">
<t t-call="report.html_skeleton"> <t t-call="report.html_container">
<t t-foreach="docs" t-as="o"> <t t-foreach="docs" t-as="o">
<t t-call="report.external_layout"> <t t-call="report.external_layout">
<div class="page"> <div class="page">

View File

@ -12,7 +12,7 @@ Report
'views/layouts.xml', 'views/layouts.xml',
'views/paperformat_view.xml', 'views/paperformat_view.xml',
'views/res_company_view.xml', 'views/res_company_view.xml',
'data/paperformat_defaults.xml', 'data/report_paperformat.xml',
'security/ir.model.access.csv', 'security/ir.model.access.csv',
], ],
'js': [ 'js': [

View File

@ -36,7 +36,6 @@ try:
except ImportError: except ImportError:
import StringIO import StringIO
from pyPdf import PdfFileWriter, PdfFileReader from pyPdf import PdfFileWriter, PdfFileReader
from werkzeug.test import Client from werkzeug.test import Client
from werkzeug.wrappers import BaseResponse from werkzeug.wrappers import BaseResponse

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<openerp> <openerp>
<data> <data>
<record id="paperformat_euro" model="ir.actions.report.paperformat"> <record id="paperformat_euro" model="report.paperformat">
<field name="name">European A4</field> <field name="name">European A4</field>
<field name="default" eval="True" /> <field name="default" eval="True" />
<field name="format">A4</field> <field name="format">A4</field>
@ -17,7 +17,7 @@
<field name="dpi">90</field> <field name="dpi">90</field>
</record> </record>
<record id="paperformat_us" model="ir.actions.report.paperformat"> <record id="paperformat_us" model="report.paperformat">
<field name="name">US Letter</field> <field name="name">US Letter</field>
<field name="default" eval="True" /> <field name="default" eval="True" />
<field name="format">Letter</field> <field name="format">Letter</field>

View File

@ -1,3 +1,3 @@
import report import report
import paperformat import report_paperformat

View File

@ -62,6 +62,20 @@ class report(osv.Model):
d = obj._field.digits[1] or DEFAULT_DIGITS d = obj._field.digits[1] or DEFAULT_DIGITS
return d return d
def _get_lang_dict(self):
pool_lang = self.pool['res.lang']
lang = self.localcontext.get('lang', 'en_US') or 'en_US'
lang_ids = pool_lang.search(request.cr, request.uid, [('code', '=', lang)])[0]
lang_obj = pool_lang.browse(request.cr, request.uid, lang_ids)
lang_dict = {
'lang_obj': lang_obj,
'date_format': lang_obj.date_format,
'time_format': lang_obj.time_format
}
self.lang_dict.update(lang_dict)
self.default_lang[lang] = self.lang_dict.copy()
return True
def formatLang(self, value, digits=None, date=False, date_time=False, grouping=True, monetary=False, dp=False, currency_obj=False): def formatLang(self, value, digits=None, date=False, date_time=False, grouping=True, monetary=False, dp=False, currency_obj=False):
""" """
Assuming 'Account' decimal.precision=3: Assuming 'Account' decimal.precision=3:
@ -116,20 +130,6 @@ class report(osv.Model):
res = '%s %s' % (currency_obj.symbol, res) res = '%s %s' % (currency_obj.symbol, res)
return res return res
def _get_lang_dict(self):
pool_lang = self.pool['res.lang']
lang = self.localcontext.get('lang', 'en_US') or 'en_US'
lang_ids = pool_lang.search(request.cr, request.uid, [('code', '=', lang)])[0]
lang_obj = pool_lang.browse(request.cr, request.uid, lang_ids)
lang_dict = {
'lang_obj': lang_obj,
'date_format': lang_obj.date_format,
'time_format': lang_obj.time_format
}
self.lang_dict.update(lang_dict)
self.default_lang[lang] = self.lang_dict.copy()
return True
def render(self, cr, uid, ids, template, values=None, context=None): def render(self, cr, uid, ids, template, values=None, context=None):
if values is None: if values is None:
values = {} values = {}
@ -228,8 +228,8 @@ class report(osv.Model):
return action return action
def eval_params(self, dict_param): def eval_params(self, dict_param):
"""Parse a dictionary generated from the webclient into a dictionary understandable by a """Parse a dictionary generated by the webclient (javascript) into a dictionary
wizard controller. understandable by a wizard controller (python).
""" """
for key, value in dict_param.iteritems(): for key, value in dict_param.iteritems():
if value.lower() == 'false': if value.lower() == 'false':

View File

@ -22,8 +22,8 @@
from openerp.osv import osv, fields from openerp.osv import osv, fields
class actions_report_paperformat(osv.Model): class report_paperformat(osv.Model):
_name = "ir.actions.report.paperformat" _name = "report.paperformat"
_description = "Allows customization of a report." _description = "Allows customization of a report."
_columns = {'name': fields.char('Name', required=True), _columns = {'name': fields.char('Name', required=True),
@ -98,10 +98,10 @@ class actions_report_paperformat(osv.Model):
class res_company(osv.Model): class res_company(osv.Model):
_inherit = 'res.company' _inherit = 'res.company'
_columns = {'paperformat_id': fields.many2one('ir.actions.report.paperformat', 'Paper format')} _columns = {'paperformat_id': fields.many2one('report.paperformat', 'Paper format')}
class ir_actions_report(osv.Model): class ir_actions_report(osv.Model):
_inherit = 'ir.actions.report.xml' _inherit = 'ir.actions.report.xml'
_columns = {'paperformat_id': fields.many2one('ir.actions.report.paperformat', 'Paper format')} _columns = {'paperformat_id': fields.many2one('report.paperformat', 'Paper format')}

View File

@ -1,4 +1,4 @@
"id","name","model_id:id","group_id:id","perm_read","perm_write","perm_create","perm_unlink" "id","name","model_id:id","group_id:id","perm_read","perm_write","perm_create","perm_unlink"
"paperformat_access_portal","ir_actions_report_paperformat group_portal","model_ir_actions_report_paperformat",,1,0,0,0 "paperformat_access_portal","ir_actions_report_paperformat group_portal","model_report_paperformat",,1,0,0,0
"paperformat_access_employee","ir_actions_report_paperformat group_hr_user","model_ir_actions_report_paperformat",,1,0,1,0 "paperformat_access_employee","ir_actions_report_paperformat group_hr_user","model_report_paperformat",,1,0,1,0
"access_report","access_report","model_report",,1,1,1,1 "access_report","access_report","model_report",,1,1,1,1

1 id name model_id:id group_id:id perm_read perm_write perm_create perm_unlink
2 paperformat_access_portal ir_actions_report_paperformat group_portal model_ir_actions_report_paperformat model_report_paperformat 1 0 0 0
3 paperformat_access_employee ir_actions_report_paperformat group_hr_user model_ir_actions_report_paperformat model_report_paperformat 1 0 1 0
4 access_report access_report model_report 1 1 1 1

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<openerp> <openerp>
<data> <data>
<template id="html_skeleton"> <template id="html_container">
&lt;!DOCTYPE html&gt; &lt;!DOCTYPE html&gt;
<html t-att-lang="lang and lang.replace('_', '-')" <html t-att-lang="lang and lang.replace('_', '-')"
t-att-data-website-id="website.id if editable else None" t-att-data-website-id="website.id if editable else None"
@ -170,7 +170,7 @@
<t t-raw="0" /> <t t-raw="0" />
</template> </template>
<template id="editor_head" inherit_id="report.html_skeleton" name="Editor" groups="base.group_website_publisher"> <template id="editor_head" inherit_id="report.html_container" name="Editor" groups="base.group_website_publisher">
<xpath expr="//body" position="attributes"> <xpath expr="//body" position="attributes">
<attribute name="style">padding-top: 51px;</attribute> <attribute name="style">padding-top: 51px;</attribute>
</xpath> </xpath>

View File

@ -18,7 +18,7 @@
<record id="paperformat_view_tree" model="ir.ui.view"> <record id="paperformat_view_tree" model="ir.ui.view">
<field name="name">paper_format_view_tree</field> <field name="name">paper_format_view_tree</field>
<field name="model">ir.actions.report.paperformat</field> <field name="model">report.paperformat</field>
<field name="arch" type="xml"> <field name="arch" type="xml">
<tree string="Paper format configuration"> <tree string="Paper format configuration">
<field name="name" /> <field name="name" />
@ -28,7 +28,7 @@
<record id="paperformat_view_form" model="ir.ui.view"> <record id="paperformat_view_form" model="ir.ui.view">
<field name="name">paper_format_view_form</field> <field name="name">paper_format_view_form</field>
<field name="model">ir.actions.report.paperformat</field> <field name="model">report.paperformat</field>
<field name="arch" type="xml"> <field name="arch" type="xml">
<form string="Paper format configuration" version="7.0"> <form string="Paper format configuration" version="7.0">
<group> <group>
@ -53,7 +53,7 @@
<record id="paper_format_action" model="ir.actions.act_window"> <record id="paper_format_action" model="ir.actions.act_window">
<field name="name">Paper Format General Configuration</field> <field name="name">Paper Format General Configuration</field>
<field name="res_model">ir.actions.report.paperformat</field> <field name="res_model">report.paperformat</field>
<field name="view_type">form</field> <field name="view_type">form</field>
<field name="view_mode">tree,form</field> <field name="view_mode">tree,form</field>
</record> </record>

View File

@ -2,7 +2,7 @@
<openerp> <openerp>
<data> <data>
<template id="report_saleorder"> <template id="report_saleorder">
<t t-call="report.html_skeleton"> <t t-call="report.html_container">
<t t-foreach="docs" t-as="o"> <t t-foreach="docs" t-as="o">
<t t-call="report.external_layout"> <t t-call="report.external_layout">
<div class="page"> <div class="page">
@ -53,46 +53,42 @@
</div> </div>
</div> </div>
<div class="row"> <table class="table table-condensed">
<div class="col-xs-12"> <thead>
<table class="table table-condensed"> <tr>
<thead> <th>Description</th>
<tr> <th>Taxes</th>
<th>Description</th> <th class="text-right">Quantity</th>
<th>Taxes</th> <th class="text-right">Unit Price</th>
<th class="text-right">Quantity</th> <th groups="sale.group_discount_per_so_line">Disc.(%)</th>
<th class="text-right">Unit Price</th> <th class="text-right">Price</th>
<th groups="sale.group_discount_per_so_line">Disc.(%)</th> </tr>
<th class="text-right">Price</th> </thead>
</tr> <tbody>
</thead> <tr t-foreach="o.order_line" t-as="l">
<tbody> <td>
<tr t-foreach="o.order_line" t-as="l"> <span t-field="l.name"/>
<td> </td>
<span t-field="l.name"/> <td>
</td> <span t-esc="', '.join(map(lambda x: x.name, l.tax_id))"/>
<td> </td>
<span t-esc="', '.join(map(lambda x: x.name, l.tax_id))"/> <td class="text-right">
</td> <span t-field="l.product_uom_qty"/>
<td class="text-right"> <span groups="product.group_uom" t-field="l.product_uom"/>
<span t-field="l.product_uom_qty"/> </td>
<span groups="product.group_uom" t-field="l.product_uom"/> <td class="text-right">
</td> <span t-field="l.price_unit"/>
<td class="text-right"> </td>
<span t-field="l.price_unit"/> <td groups="sale.group_discount_per_so_line">
</td> <span t-field="l.discount"/>
<td groups="sale.group_discount_per_so_line"> </td>
<span t-field="l.discount"/> <td class="text-right">
</td> <span t-field="l.price_subtotal"
<td class="text-right"> t-field-options='{"widget": "monetary", "display_currency": "o.pricelist_id.currency_id"}'/>
<span t-field="l.price_subtotal" </td>
t-field-options='{"widget": "monetary", "display_currency": "o.pricelist_id.currency_id"}'/> </tr>
</td> </tbody>
</tr> </table>
</tbody>
</table>
</div>
</div>
<div class="row"> <div class="row">
<div class="col-xs-4 pull-right"> <div class="col-xs-4 pull-right">