diff options
| author | Richard Mathot (OpenERP) <rim@openerp.com> | 2014-03-03 14:11:37 +0100 |
|---|---|---|
| committer | Richard Mathot (OpenERP) <rim@openerp.com> | 2014-03-03 14:11:37 +0100 |
| commit | dbd02d734bc7724854d24e7fedf5e99f9c8aab85 (patch) | |
| tree | b781ba7cac2e785e2aacc9babc638d6758e85edd | |
| parent | 2cde1e8b91b723097d92abb81104906cdea07974 (diff) | |
| parent | 7851c9f825f0e1133b928ce66bc7d3d6056b54da (diff) | |
[MERGE] Sync with trunk
bzr revid: rim@openerp.com-20140303131137-2shoyv0ywvgp5fx3
125 files changed, 2842 insertions, 3816 deletions
diff --git a/addons/account/__openerp__.py b/addons/account/__openerp__.py index 343512dc271..95ecdc8c35a 100644 --- a/addons/account/__openerp__.py +++ b/addons/account/__openerp__.py @@ -123,7 +123,9 @@ for a particular financial year and for preparation of vouchers there is a modul 'edi/invoice_action_data.xml', 'account_bank_view.xml', 'res_config_view.xml', - 'account_pre_install.yml' + 'account_pre_install.yml', + + 'views/report_vat.xml', ], 'js': [ 'static/src/js/account_move_reconciliation.js', diff --git a/addons/account/account_report.xml b/addons/account/account_report.xml index 6e121c9f5a5..4f9ad1b5c56 100644 --- a/addons/account/account_report.xml +++ b/addons/account/account_report.xml @@ -27,13 +27,13 @@ <report auto="False" id="account_intracom" menu="False" model="account.move.line" name="account.intracom" string="IntraCom"/> <report - auto="False" - id="account_vat_declaration" - menu="False" - model="account.tax.code" - name="account.vat.declaration" - rml="account/report/account_tax_report.rml" - string="Taxes Report"/> + id="action_report_vat" + model="account.tax.code" + report_type="qweb-pdf" + string="Account tax" + name="account.report_vat" + file="account.report_vat" + /> <menuitem id="menu_tax_report" diff --git a/addons/account/report/__init__.py b/addons/account/report/__init__.py index 70ceb4b8f83..544aa9e262e 100644 --- a/addons/account/report/__init__.py +++ b/addons/account/report/__init__.py @@ -32,7 +32,7 @@ import account_print_invoice import account_print_overdue import account_aged_partner_balance #import tax_report -import account_tax_report +import report_vat import account_invoice_report import account_report import account_entries_report diff --git a/addons/account/report/account_tax_report.rml b/addons/account/report/account_tax_report.rml deleted file mode 100644 index c25f1fccd22..00000000000 --- a/addons/account/report/account_tax_report.rml +++ /dev/null @@ -1,160 +0,0 @@ -<?xml version="1.0"?> -<document filename="Taxes.pdf"> - <template title="Taxes" author="OpenERP S.A.(sales@openerp.com)" allowSplitting="20"> - <pageTemplate id="first"> - <frame id="first" x1="42.0" y1="62.0" width="511" height="728"/> - </pageTemplate> - </template> - <stylesheet> - <blockTableStyle id="Standard_Outline"> - <blockAlignment value="LEFT"/> - <blockValign value="TOP"/> - </blockTableStyle> - <blockTableStyle id="Table1"> - <blockAlignment value="LEFT"/> - <blockValign value="TOP"/> - <blockBackground colorName="#e6e6e6" start="0,0" stop="0,0"/> - <blockBackground colorName="#e6e6e6" start="1,0" stop="1,0"/> - <blockBackground colorName="#e6e6e6" start="2,0" stop="2,0"/> - <blockBackground colorName="#e6e6e6" start="0,1" stop="0,1"/> - <blockBackground colorName="#e6e6e6" start="1,1" stop="1,1"/> - <blockBackground colorName="#e6e6e6" start="2,1" stop="2,1"/> - </blockTableStyle> - - <blockTableStyle id="Table2"> - <lineStyle kind="LINEBELOW" colorName="#000000" start="0,0" stop="0,0"/> - <lineStyle kind="LINEBELOW" colorName="#000000" start="1,0" stop="1,0"/> - <lineStyle kind="LINEBELOW" colorName="#000000" start="2,0" stop="2,0"/> - <lineStyle kind="LINEBELOW" colorName="#000000" start="3,0" stop="3,0"/> - - <lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="0,1" stop="0,-1"/> - <lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="1,1" stop="1,-1"/> - <lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="2,1" stop="2,-1"/> - <lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="3,1" stop="3,-1"/> - - - <blockValign value="TOP"/> - </blockTableStyle> - <blockTableStyle id="Table4"> - <blockAlignment value="LEFT"/> - <lineStyle kind="LINEBEFORE" colorName="#cccccc" start="1,0" stop="1,-1"/> - </blockTableStyle> - <blockTableStyle id="Table3"> - <blockAlignment value="LEFT"/> - <blockValign value="TOP"/> - <lineStyle kind="LINEBELOW" colorName="#cccccc" start="0,0" stop="-1,0"/> - <lineStyle kind="LINEBEFORE" colorName="#cccccc" start="0,0" stop="0,-1"/> - <lineStyle kind="LINEABOVE" colorName="#cccccc" start="0,0" stop="0,0"/> - <lineStyle kind="LINEBELOW" colorName="#cccccc" start="0,-1" stop="0,-1"/> - <lineStyle kind="LINEBEFORE" colorName="#cccccc" start="1,0" stop="1,-1"/> - <lineStyle kind="LINEABOVE" colorName="#cccccc" start="1,0" stop="1,0"/> - <lineStyle kind="LINEBELOW" colorName="#cccccc" start="1,-1" stop="1,-1"/> - <lineStyle kind="LINEBEFORE" colorName="#cccccc" start="2,0" stop="2,-1"/> - <lineStyle kind="LINEAFTER" colorName="#cccccc" start="2,0" stop="2,-1"/> - <lineStyle kind="LINEABOVE" colorName="#cccccc" start="2,0" stop="2,0"/> - <lineStyle kind="LINEBELOW" colorName="#cccccc" start="2,-1" stop="2,-1"/> - <lineStyle kind="LINEBEFORE" colorName="#cccccc" start="3,0" stop="3,-1"/> - <lineStyle kind="LINEAFTER" colorName="#cccccc" start="3,0" stop="3,-1"/> - <lineStyle kind="LINEABOVE" colorName="#cccccc" start="3,0" stop="3,0"/> - <lineStyle kind="LINEBELOW" colorName="#cccccc" start="3,-1" stop="3,-1"/> - <lineStyle kind="LINEBEFORE" colorName="#cccccc" start="4,0" stop="4,-1"/> - <lineStyle kind="LINEABOVE" colorName="#cccccc" start="4,0" stop="4,0"/> - <lineStyle kind="LINEBELOW" colorName="#cccccc" start="4,-1" stop="4,-1"/> - <lineStyle kind="LINEBEFORE" colorName="#cccccc" start="5,0" stop="5,-1"/> - <lineStyle kind="LINEABOVE" colorName="#cccccc" start="5,0" stop="5,0"/> - <lineStyle kind="LINEBELOW" colorName="#cccccc" start="5,-1" stop="5,-1"/> - <lineStyle kind="LINEBEFORE" colorName="#cccccc" start="6,0" stop="6,-1"/> - <lineStyle kind="LINEAFTER" colorName="#cccccc" start="6,0" stop="6,-1"/> - <lineStyle kind="LINEABOVE" colorName="#cccccc" start="6,0" stop="6,0"/> - <lineStyle kind="LINEBELOW" colorName="#cccccc" start="6,-1" stop="6,-1"/> - <lineStyle kind="LINEBEFORE" colorName="#cccccc" start="7,0" stop="7,-1"/> - <lineStyle kind="LINEAFTER" colorName="#cccccc" start="7,0" stop="7,-1"/> - <lineStyle kind="LINEABOVE" colorName="#cccccc" start="7,0" stop="7,0"/> - </blockTableStyle> - <blockTableStyle id="Tableau1"> - <blockAlignment value="LEFT"/> - <blockValign value="TOP"/> - </blockTableStyle> - <blockTableStyle id="Tableau2"> - <blockAlignment value="LEFT"/> - <blockValign value="TOP"/> - </blockTableStyle> - <initialize> - <paraStyle name="all" alignment="justify"/> - </initialize> - <paraStyle name="P1" fontName="Helvetica-Bold" alignment="CENTER" fontSize="14.5" leftIndent="-5.0"/> - <paraStyle name="P2" fontName="Helvetica-bold" fontSize="15.0" leading="10" alignment="CENTER" spaceBefore="0.0" spaceAfter="6.0"/> - <paraStyle name="P3" fontName="Helvetica" fontSize="8.0" leading="10" spaceBefore="0.0" spaceAfter="6.0"/> - <paraStyle name="P4" fontName="Helvetica" fontSize="8.0" leading="10" alignment="LEFT" spaceBefore="0.0" spaceAfter="6.0"/> - <paraStyle name="P5" fontName="Helvetica" fontSize="8.0" leading="10" alignment="LEFT" spaceBefore="0.0" spaceAfter="6.0"/> - <paraStyle name="P6" fontName="Helvetica" fontSize="8.0" alignment="RIGHT" spaceBefore="0.0" spaceAfter="6.0"/> - <paraStyle name="P7" fontName="Helvetica" fontSize="8.0" leading="14" alignment="RIGHT" spaceBefore="0.0" spaceAfter="6.0"/> - <paraStyle name="P8" fontName="Helvetica-Bold" fontSize="8.0" leading="10" alignment="RIGHT" spaceBefore="0.0" spaceAfter="6.0"/> - <paraStyle name="P9" fontName="Helvetica" fontSize="8.0" leading="10" alignment="RIGHT" spaceBefore="0.0" spaceAfter="6.0"/> - <paraStyle name="P9a" fontName="Helvetica-Bold" fontSize="8.0" leading="10" alignment="LEFT" spaceBefore="0.0" spaceAfter="6.0"/> - <paraStyle name="P9c" fontName="Helvetica" fontSize="8.0" leading="10" alignment="LEFT" spaceBefore="0.0" spaceAfter="6.0"/> - <paraStyle name="P9b" fontName="Helvetica-Bold" fontSize="8.0" leading="10" alignment="RIGHT" spaceBefore="0.0" spaceAfter="6.0"/> - <paraStyle name="P10" fontName="Helvetica" alignment="CENTER"/> - <paraStyle name="P11" fontName="Helvetica" fontSize="8.0" leading="14"/> - <paraStyle name="P12" fontName="Helvetica-bold" fontSize="9.0" leading="10" alignment="LEFT" spaceBefore="0.6" spaceAfter="6.0"/> - <paraStyle name="P12a" fontName="Helvetica-bold" fontSize="9.0" leading="10" alignment="RIGHT" spaceBefore="0.0" spaceAfter="0.0"/> - <paraStyle name="P13" fontName="Helvetica" fontSize="8.0" leading="10" spaceBefore="0.0" spaceAfter="6.0"/> - <paraStyle name="P14" fontName="Helvetica-Bold" spaceBefore="0.0" spaceAfter="6.0"/> - <paraStyle name="P15" rightIndent="17.0" leftIndent="-0.0" fontName="Helvetica" fontSize="8.0" leading="10" spaceBefore="0.0" spaceAfter="6.0"/> - <paraStyle name="P16" fontName="Helvetica-Bold" fontSize="8.0" leading="14" alignment="RIGHT" spaceBefore="0.0" spaceAfter="6.0"/> - <paraStyle name="Standard" fontName="Helvetica"/> - <paraStyle name="Text body" fontName="Helvetica" spaceBefore="0.0" spaceAfter="6.0"/> - <paraStyle name="List" fontName="Helvetica" spaceBefore="0.0" spaceAfter="6.0"/> - <paraStyle name="Table Contents" fontName="Helvetica" spaceBefore="0.0" spaceAfter="6.0"/> - <paraStyle name="Table Heading" fontName="Helvetica" alignment="CENTER" spaceBefore="0.0" spaceAfter="6.0"/> - <paraStyle name="Caption" fontName="Helvetica" fontSize="1.0" leading="1" spaceBefore="0" spaceAfter="0"/> - <paraStyle name="Index" fontName="Helvetica"/> - <paraStyle name="terp_tblheader_General_Centre" fontName="Helvetica-Bold" fontSize="8.0" leading="10" alignment="CENTER" spaceBefore="6.0" spaceAfter="6.0"/> - <paraStyle name="terp_default_Centre_8" fontName="Helvetica" fontSize="8.0" leading="10" alignment="CENTER" spaceBefore="0.0" spaceAfter="0.0"/> - - </stylesheet> - <story> - <para style="P2">Tax Statement</para> - <para style="P2"><font color="white"> </font></para> - <blockTable colWidths="140.0,120.0,160.0,120.0" style="Table3"> - <tr> - <td><para style="terp_tblheader_General_Centre">Chart of Tax</para></td> - <td><para style="terp_tblheader_General_Centre">Fiscal Year</para></td> - <td><para style="terp_tblheader_General_Centre">Periods</para></td> - <td><para style="terp_tblheader_General_Centre">Based On</para></td> - </tr> - <tr> - <td><para style="terp_default_Centre_8">[[ get_account(data) or removeParentNode('para') ]]</para></td> - <td><para style="terp_default_Centre_8">[[ get_fiscalyear(data) or '' ]]</para></td> - <td> - <blockTable colWidths="80.0,80.0" style="Table4"> - <tr> - <td><para style="terp_tblheader_General_Centre">Start Period</para></td> - <td><para style="terp_tblheader_General_Centre">End Period</para></td> - </tr> - <tr> - <td><para style="terp_default_Centre_8">[[ get_start_period(data) or '' ]]</para></td> - <td><para style="terp_default_Centre_8">[[ get_end_period(data) or '' ]]</para></td> - </tr> - </blockTable> - </td> - <td><para style="terp_default_Centre_8">[[ get_basedon(data) or '' ]]</para></td> - </tr> - </blockTable> - <para style="P2"><font color="white"> </font></para> - <blockTable colWidths="340.0,55.0,55.0,90.0" style="Table2" repeatRows="1"> - <tr> - <td><para style="P12">Tax Name</para></td> - <td><para style="P12a">Debit</para></td> - <td><para style="P12a">Credit</para></td> - <td><para style="P12a">Tax Amount</para></td> - </tr> - <tr> - <td><para style="P5"><font>[[ repeatIn(get_lines(data['form']['based_on'], data['form']['company_id']), 'o') ]]</font><font color="white">[[ (o['level']) ]]</font> <font>[[ (len(o['level'])<5 and setTag('para','para',{'fontName':'Helvetica-Bold'})) or removeParentNode('font') ]]</font><font>[[ o['code'] ]] [[ o['name'] ]] </font></para></td> - <td><para style="P6"><font>[[ len(o['level'])<5 and setTag('para','para',{'fontName':"Helvetica-Bold"}) or removeParentNode('font')]]</font><font>[[ o['type']=='view' and removeParentNode('font') ]][[ formatLang(o['debit']) ]]</font><font>[[ o['type']<>'view' and removeParentNode('font') ]][[ formatLang(o['debit']) ]]</font></para></td> - <td><para style="P6"><font>[[ len(o['level'])<5 and setTag('para','para',{'fontName':"Helvetica-Bold"}) or removeParentNode('font')]]</font><font>[[ o['type']=='view' and removeParentNode('font') ]][[ formatLang(o['credit']) ]]</font><font>[[ o['type']<>'view' and removeParentNode('font') ]][[ formatLang(o['credit'])]]</font></para></td> - <td><para style="P6"><font>[[ len(o['level'])<5 and setTag('para','para',{'fontName':"Helvetica-Bold"}) or removeParentNode('font')]]</font><font>[[ o['type']=='view' and removeParentNode('font') ]][[ formatLang(o['tax_amount'], currency_obj=company.currency_id) ]]</font><font>[[ o['type']<>'view' and removeParentNode('font') ]][[ formatLang(o['tax_amount'], currency_obj=company.currency_id) ]]</font> </para></td> - </tr> - </blockTable> - </story> -</document> diff --git a/addons/account/report/account_tax_report.py b/addons/account/report/report_vat.py index b3cbcb441bf..236e2ffaac2 100644 --- a/addons/account/report/account_tax_report.py +++ b/addons/account/report/report_vat.py @@ -19,16 +19,25 @@ # ############################################################################## -import time - +from openerp.addons.web import http +from openerp.addons.web.http import request from common_report_header import common_report_header -from openerp.report import report_sxw +try: + import cStringIO as StringIO +except ImportError: + import StringIO +import xlwt + + +class tax_report(http.Controller, common_report_header): -class tax_report(report_sxw.rml_parse, common_report_header): - _name = 'report.account.vat.declaration' + @http.route(['/report/account.report_vat'], type='http', auth='user', website=True, multilang=True) + def report_account_tax(self, **data): + report_obj = request.registry['report'] + self.cr, self.uid, self.pool = request.cr, request.uid, request.registry + + data = report_obj.eval_params(data) - def set_context(self, objects, data, ids, report_type=None): - new_ids = ids res = {} self.period_ids = [] period_obj = self.pool.get('account.period') @@ -38,28 +47,16 @@ class tax_report(report_sxw.rml_parse, common_report_header): if data['form'].get('period_from', False) and data['form'].get('period_to', False): self.period_ids = period_obj.build_ctx_periods(self.cr, self.uid, data['form']['period_from'], data['form']['period_to']) - periods_l = period_obj.read(self.cr, self.uid, self.period_ids, ['name']) - for period in periods_l: - if res['periods'] == '': - res['periods'] = period['name'] - else: - res['periods'] += ", "+ period['name'] - return super(tax_report, self).set_context(objects, data, new_ids, report_type=report_type) - - def __init__(self, cr, uid, name, context=None): - super(tax_report, self).__init__(cr, uid, name, context=context) - self.localcontext.update({ - 'time': time, - 'get_codes': self._get_codes, - 'get_general': self._get_general, - 'get_currency': self._get_currency, - 'get_lines': self._get_lines, - 'get_fiscalyear': self._get_fiscalyear, - 'get_account': self._get_account, - 'get_start_period': self.get_start_period, - 'get_end_period': self.get_end_period, - 'get_basedon': self._get_basedon, - }) + + docargs = { + 'fiscalyear': self._get_fiscalyear(data), + 'account': self._get_account(data), + 'based_on': self._get_basedon(data), + 'period_from': self.get_start_period(data), + 'period_to': self.get_end_period(data), + 'taxlines': self._get_lines(self._get_basedon(data), company_id=data['form']['company_id']), + } + return request.registry['report'].render(self.cr, self.uid, [], 'account.report_vat', docargs) def _get_basedon(self, form): return form['form']['based_on'] @@ -194,7 +191,6 @@ class tax_report(report_sxw.rml_parse, common_report_header): return self.pool.get('res.company').browse(self.cr, self.uid, form['company_id'], context=context).currency_id.name def sort_result(self, accounts, context=None): - # On boucle sur notre rapport result_accounts = [] ind=0 old_level=0 @@ -233,7 +229,43 @@ class tax_report(report_sxw.rml_parse, common_report_header): return result_accounts -report_sxw.report_sxw('report.account.vat.declaration', 'account.tax.code', - 'addons/account/report/account_tax_report.rml', parser=tax_report, header="internal") + @http.route(['/report/account.report_vat_xls'], type='http', auth='user', website=True, multilang=True) + def report_account_tax_xls(self, **data): + report_obj = request.registry['report'] + self.cr, self.uid, self.pool = request.cr, request.uid, request.registry + + data = report_obj.eval_params(data) + + res = {} + self.period_ids = [] + period_obj = self.pool.get('account.period') + self.display_detail = data['form']['display_detail'] + res['periods'] = '' + res['fiscalyear'] = data['form'].get('fiscalyear_id', False) + + if data['form'].get('period_from', False) and data['form'].get('period_to', False): + self.period_ids = period_obj.build_ctx_periods(self.cr, self.uid, data['form']['period_from'], data['form']['period_to']) + + content = '' + lines = self._get_lines(self._get_basedon(data), company_id=data['form']['company_id']) + + if lines: + xls = StringIO.StringIO() + xls_workbook = xlwt.Workbook() + vat_sheet = xls_workbook.add_sheet('report_vat') + + for x in range(0, len(lines)): + for y in range(0, len(lines[0])): + vat_sheet.write(x, y, lines[x].values()[y]) + + xls_workbook.save(xls) + xls.seek(0) + content = xls.read() + + response = request.make_response(content, headers=[ + ('Content-Type', 'application/vnd.ms-excel'), + ('Content-Disposition', 'attachment; filename=report_vat.xls;') + ]) + return response # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/addons/account/views/report_vat.xml b/addons/account/views/report_vat.xml new file mode 100644 index 00000000000..03664045ef4 --- /dev/null +++ b/addons/account/views/report_vat.xml @@ -0,0 +1,68 @@ +<?xml version="1.0" encoding="utf-8"?> +<openerp> +<data> +<template id="report_vat"> + <t t-call="report.html_container"> + <t t-call="report.internal_layout"> + <div class="page"> + <h2>Tax Statement</h2> + + <div class="row mt32 mb32"> + <div class="col-xs-3"> + <strong>Chart of Tax:</strong> + <p t-esc="account"/> + </div> + <div class="col-xs-3" t-if="fiscalyear"> + <strong>Fiscal Year:</strong> + <p t-esc="fiscalyear"/> + </div> + <div class="col-xs-3" t-if="period_from and period_to"> + <strong>Periods:</strong> + <p> + Start Period: <span t-esc="period_from"/><br/> + End Period: <span t-esc="period_to"/> + </p> + </div> + <div class="col-xs-3"> + <strong>Based On:</strong> + <p t-esc="based_on"/> + </div> + </div> + + <table class="table table-condensed"> + <thead> + <tr> + <th>Tax Name</th> + <th class="text-right">Debit</th> + <th class="text-right">Credit</th> + <th class="text-right">Tax Amount</th> + </tr> + </thead> + <tbody> + <tr t-foreach="taxlines" t-as="taxline"> + <t t-if="len(taxline['level']) > 5"> + <t t-set="style" t-value="'font-weight:normal;'"/> + </t> + <t t-if="not len(taxline['level']) > 5"> + <t t-set="style" t-value="'font-weight:bold;'"/> + </t> + + <td> + <span t-att-style="style" t-esc="taxline['level']" style="color:white;"/> + <span t-att-style="style" t-if="taxline['code']" t-esc="taxline['code']"/> + <span t-att-style="style" t-esc="taxline['name']"/> + </td> + <td class="text-right"><span t-att-style="style" t-esc="taxline['debit']"/></td> + <td class="text-right"><span t-att-style="style" t-esc="taxline['credit']"/></td> + <td class="text-right"> + <span t-att-style="style" t-esc="formatLang(taxline['tax_amount'], currency_obj=res_company.currency_id)"/> + </td> + </tr> + </tbody> + </table> + </div> + </t> + </t> +</template> +</data> +</openerp> diff --git a/addons/account/wizard/account_vat.py b/addons/account/wizard/account_vat.py index 37bf4b029a6..6fbfcc9ddf5 100644 --- a/addons/account/wizard/account_vat.py +++ b/addons/account/wizard/account_vat.py @@ -46,18 +46,20 @@ class account_vat_declaration(osv.osv_memory): def create_vat(self, cr, uid, ids, context=None): if context is None: context = {} + datas = {'ids': context.get('active_ids', [])} datas['model'] = 'account.tax.code' datas['form'] = self.read(cr, uid, ids, context=context)[0] + for field in datas['form'].keys(): if isinstance(datas['form'][field], tuple): datas['form'][field] = datas['form'][field][0] - datas['form']['company_id'] = self.pool.get('account.tax.code').browse(cr, uid, [datas['form']['chart_tax_id']], context=context)[0].company_id.id - return { - 'type': 'ir.actions.report.xml', - 'report_name': 'account.vat.declaration', - 'datas': datas, - } + taxcode_obj = self.pool.get('account.tax.code') + taxcode_id = datas['form']['chart_tax_id'] + taxcode = taxcode_obj.browse(cr, uid, [taxcode_id], context=context)[0] + datas['form']['company_id'] = taxcode.company_id.id + + return self.pool['report'].get_action(cr, uid, ids, 'account.report_vat', datas=datas, context=context) # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/addons/auth_oauth/__openerp__.py b/addons/auth_oauth/__openerp__.py index 76f15687eb9..64068fa9b5e 100644 --- a/addons/auth_oauth/__openerp__.py +++ b/addons/auth_oauth/__openerp__.py @@ -31,7 +31,7 @@ Allow users to login through OAuth2 Provider. 'author': 'OpenERP s.a.', 'maintainer': 'OpenERP s.a.', 'website': 'http://www.openerp.com', - 'depends': ['base', 'web', 'base_setup'], + 'depends': ['base', 'web', 'base_setup', 'auth_signup'], 'data': [ 'res_users.xml', 'auth_oauth_data.xml', diff --git a/addons/auth_oauth/controllers/main.py b/addons/auth_oauth/controllers/main.py index 5a22240abac..b62fb31d8b0 100644 --- a/addons/auth_oauth/controllers/main.py +++ b/addons/auth_oauth/controllers/main.py @@ -9,7 +9,7 @@ import openerp from openerp import SUPERUSER_ID from openerp import http from openerp.http import request -from openerp.addons.web.controllers.main import db_monodb, set_cookie_and_redirect, login_and_redirect +from openerp.addons.web.controllers.main import db_monodb, ensure_db, set_cookie_and_redirect, login_and_redirect from openerp.modules.registry import RegistryManager from openerp.tools.translate import _ @@ -61,13 +61,18 @@ class OAuthLogin(openerp.addons.web.controllers.main.Home): return providers def get_state(self, provider): - return dict( + state = dict( d=request.session.db, p=provider['id'] ) + token = request.params.get('token') + if token: + state['t'] = token + return state @http.route() def web_login(self, *args, **kw): + ensure_db() providers = self.list_providers() response = super(OAuthLogin, self).web_login(*args, **kw) @@ -88,6 +93,24 @@ class OAuthLogin(openerp.addons.web.controllers.main.Home): return response + @http.route() + def web_auth_signup(self, *args, **kw): + providers = self.list_providers() + if len(providers) == 1: + werkzeug.exceptions.abort(werkzeug.utils.redirect(providers[0]['auth_link'], 303)) + response = super(OAuthLogin, self).web_auth_signup(*args, **kw) + response.qcontext.update(providers=providers) + return response + + @http.route() + def web_auth_reset_password(self, *args, **kw): + providers = self.list_providers() + if len(providers) == 1: + werkzeug.exceptions.abort(werkzeug.utils.redirect(providers[0]['auth_link'], 303)) + response = super(OAuthLogin, self).web_auth_reset_password(*args, **kw) + response.qcontext.update(providers=providers) + return response + class OAuthController(http.Controller): @http.route('/auth_oauth/signin', type='http', auth='none') diff --git a/addons/auth_oauth/views/auth_oauth_login.xml b/addons/auth_oauth/views/auth_oauth_login.xml index f969d2f5eed..6c5deca924c 100644 --- a/addons/auth_oauth/views/auth_oauth_login.xml +++ b/addons/auth_oauth/views/auth_oauth_login.xml @@ -3,15 +3,35 @@ --> <openerp> <data> + <template id="auth_oauth.providers" name="OAuth Providers"> + <div t-foreach="providers" t-as="p"> + <a t-att-href="p['auth_link']" class="btn btn-link"> + <i t-att-class="p['css_class']"/> + <t t-esc="p['body']"/> + </a> + </div> + </template> + <template id="auth_oauth.login" inherit_id="web.login" name="OAuth Login buttons"> <xpath expr="//button[@type='submit']" position="before"> <div class="pull-right"> - <div t-foreach="providers" t-as="p"> - <a t-att-href="p['auth_link']" class="btn btn-link"> - <i t-att-class="p['css_class']"/> - <t t-esc="p['body']"/> - </a> - </div> + <t t-call="auth_oauth.providers"/> + </div> + </xpath> + </template> + + <template id="auth_oauth.signup" inherit_id="auth_signup.signup" name="OAuth Signup buttons"> + <xpath expr="//button[@type='submit']" position="before"> + <div class="pull-right"> + <t t-call="auth_oauth.providers"/> + </div> + </xpath> + </template> + + <template id="auth_oauth.reset_password" inherit_id="auth_signup.reset_password" name="OAuth Reset Password buttons"> + <xpath expr="//button[@type='submit']" position="before"> + <div class="pull-right"> + <t t-call="auth_oauth.providers"/> </div> </xpath> </template> diff --git a/addons/auth_oauth_signup/__init__.py b/addons/auth_oauth_signup/__init__.py deleted file mode 100644 index 7c73af367bd..00000000000 --- a/addons/auth_oauth_signup/__init__.py +++ /dev/null @@ -1,23 +0,0 @@ -# -*- coding: utf-8 -*- -############################################################################## -# -# OpenERP, Open Source Management Solution -# Copyright (C) 2012-today OpenERP SA (<http://www.openerp.com>) -# -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU Affero General Public License as -# published by the Free Software Foundation, either version 3 of the -# License, or (at your option) any later version -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Affero General Public License for more details -# -# You should have received a copy of the GNU Affero General Public License -# along with this program. If not, see <http://www.gnu.org/licenses/> -# -############################################################################## - -import res_users -import controllers diff --git a/addons/auth_oauth_signup/__openerp__.py b/addons/auth_oauth_signup/__openerp__.py deleted file mode 100644 index d3660f7c052..00000000000 --- a/addons/auth_oauth_signup/__openerp__.py +++ /dev/null @@ -1,41 +0,0 @@ -# -*- coding: utf-8 -*- -############################################################################## -# -# OpenERP, Open Source Management Solution -# Copyright (C) 2010-2014 OpenERP SA (<http://openerp.com>). -# -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU Affero General Public License as -# published by the Free Software Foundation, either version 3 of the -# License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Affero General Public License for more details. -# -# You should have received a copy of the GNU Affero General Public License -# along with this program. If not, see <http://www.gnu.org/licenses/>. -# -############################################################################## - -{ - 'name': 'Signup with OAuth2 Authentication', - 'version': '1.0', - 'category': 'Hidden', - 'description': """ -Allow users to sign up through OAuth2 Provider. -=============================================== -""", - 'author': 'OpenERP SA', - 'website': 'http://www.openerp.com', - 'depends': ['auth_oauth', 'auth_signup'], - 'data': [ - 'views/auth_oauth_signup.xml', - ], - 'js': [], - 'css': [], - 'qweb': [], - 'installable': True, - 'auto_install': True, -} diff --git a/addons/auth_oauth_signup/controllers/__init__.py b/addons/auth_oauth_signup/controllers/__init__.py deleted file mode 100644 index e11f9ba81bb..00000000000 --- a/addons/auth_oauth_signup/controllers/__init__.py +++ /dev/null @@ -1,3 +0,0 @@ -import main - -# vim:expandtab:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/addons/auth_oauth_signup/controllers/main.py b/addons/auth_oauth_signup/controllers/main.py deleted file mode 100644 index 0b8ab22cdaa..00000000000 --- a/addons/auth_oauth_signup/controllers/main.py +++ /dev/null @@ -1,20 +0,0 @@ -import openerp -import werkzeug - -from openerp.http import request - -class OAuthSignupLogin(openerp.addons.web.controllers.main.Home): - def list_providers(self): - providers = super(OAuthSignupLogin, self).list_providers() - if len(providers) == 1 and request.params.get('mode') == 'signup': - werkzeug.exceptions.abort(werkzeug.utils.redirect(providers[0]['auth_link'], 303)) - return providers - - def get_state(self, provider): - state = super(OAuthSignupLogin, self).get_state(provider) - token = request.params.get('token') - if token: - state['t'] = token - return state - -# vim:expandtab:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/addons/auth_oauth_signup/i18n/ar.po b/addons/auth_oauth_signup/i18n/ar.po deleted file mode 100644 index 9eeabd19d8b..00000000000 --- a/addons/auth_oauth_signup/i18n/ar.po +++ /dev/null @@ -1,23 +0,0 @@ -# Arabic translation for openobject-addons -# Copyright (c) 2013 Rosetta Contributors and Canonical Ltd 2013 -# This file is distributed under the same license as the openobject-addons package. -# FIRST AUTHOR <EMAIL@ADDRESS>, 2013. -# -msgid "" -msgstr "" -"Project-Id-Version: openobject-addons\n" -"Report-Msgid-Bugs-To: FULL NAME <EMAIL@ADDRESS>\n" -"POT-Creation-Date: 2012-12-21 17:05+0000\n" -"PO-Revision-Date: 2013-11-26 18:16+0000\n" -"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" -"Language-Team: Arabic <ar@li.org>\n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=UTF-8\n" -"Content-Transfer-Encoding: 8bit\n" -"X-Launchpad-Export-Date: 2014-01-28 06:41+0000\n" -"X-Generator: Launchpad (build 16914)\n" - -#. module: auth_oauth_signup -#: model:ir.model,name:auth_oauth_signup.model_res_users -msgid "Users" -msgstr "المستخدمين" diff --git a/addons/auth_oauth_signup/i18n/auth_oauth_signup.pot b/addons/auth_oauth_signup/i18n/auth_oauth_signup.pot deleted file mode 100644 index d4c0a829a7b..00000000000 --- a/addons/auth_oauth_signup/i18n/auth_oauth_signup.pot +++ /dev/null @@ -1,22 +0,0 @@ -# Translation of OpenERP Server. -# This file contains the translation of the following modules: -# * auth_oauth_signup -# -msgid "" -msgstr "" -"Project-Id-Version: OpenERP Server 7.0alpha\n" -"Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2012-12-21 17:05+0000\n" -"PO-Revision-Date: 2012-12-21 17:05+0000\n" -"Last-Translator: <>\n" -"Language-Team: \n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=UTF-8\n" -"Content-Transfer-Encoding: \n" -"Plural-Forms: \n" - -#. module: auth_oauth_signup -#: model:ir.model,name:auth_oauth_signup.model_res_users -msgid "Users" -msgstr "" - diff --git a/addons/auth_oauth_signup/i18n/cs.po b/addons/auth_oauth_signup/i18n/cs.po deleted file mode 100644 index bf6f59f24fa..00000000000 --- a/addons/auth_oauth_signup/i18n/cs.po +++ /dev/null @@ -1,23 +0,0 @@ -# Czech translation for openobject-addons -# Copyright (c) 2013 Rosetta Contributors and Canonical Ltd 2013 -# This file is distributed under the same license as the openobject-addons package. -# FIRST AUTHOR <EMAIL@ADDRESS>, 2013. -# -msgid "" -msgstr "" -"Project-Id-Version: openobject-addons\n" -"Report-Msgid-Bugs-To: FULL NAME <EMAIL@ADDRESS>\n" -"POT-Creation-Date: 2012-12-21 17:05+0000\n" -"PO-Revision-Date: 2014-02-03 16:54+0000\n" -"Last-Translator: Jakub Drozd <Unknown>\n" -"Language-Team: Czech <cs@li.org>\n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=UTF-8\n" -"Content-Transfer-Encoding: 8bit\n" -"X-Launchpad-Export-Date: 2014-02-04 05:51+0000\n" -"X-Generator: Launchpad (build 16916)\n" - -#. module: auth_oauth_signup -#: model:ir.model,name:auth_oauth_signup.model_res_users -msgid "Users" -msgstr "Uživatelé" diff --git a/addons/auth_oauth_signup/i18n/da.po b/addons/auth_oauth_signup/i18n/da.po deleted file mode 100644 index 75b7032c1de..00000000000 --- a/addons/auth_oauth_signup/i18n/da.po +++ /dev/null @@ -1,23 +0,0 @@ -# Danish translation for openobject-addons -# Copyright (c) 2013 Rosetta Contributors and Canonical Ltd 2013 -# This file is distributed under the same license as the openobject-addons package. -# FIRST AUTHOR <EMAIL@ADDRESS>, 2013. -# -msgid "" -msgstr "" -"Project-Id-Version: openobject-addons\n" -"Report-Msgid-Bugs-To: FULL NAME <EMAIL@ADDRESS>\n" -"POT-Creation-Date: 2012-12-21 17:05+0000\n" -"PO-Revision-Date: 2013-09-15 20:08+0000\n" -"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" -"Language-Team: Danish <da@li.org>\n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=UTF-8\n" -"Content-Transfer-Encoding: 8bit\n" -"X-Launchpad-Export-Date: 2014-01-28 06:41+0000\n" -"X-Generator: Launchpad (build 16914)\n" - -#. module: auth_oauth_signup -#: model:ir.model,name:auth_oauth_signup.model_res_users -msgid "Users" -msgstr "Bruger" diff --git a/addons/auth_oauth_signup/i18n/de.po b/addons/auth_oauth_signup/i18n/de.po deleted file mode 100644 index 57580243777..00000000000 --- a/addons/auth_oauth_signup/i18n/de.po +++ /dev/null @@ -1,23 +0,0 @@ -# German translation for openobject-addons -# Copyright (c) 2012 Rosetta Contributors and Canonical Ltd 2012 -# This file is distributed under the same license as the openobject-addons package. -# FIRST AUTHOR <EMAIL@ADDRESS>, 2012. -# -msgid "" -msgstr "" -"Project-Id-Version: openobject-addons\n" -"Report-Msgid-Bugs-To: FULL NAME <EMAIL@ADDRESS>\n" -"POT-Creation-Date: 2012-12-21 17:05+0000\n" -"PO-Revision-Date: 2012-12-27 22:22+0000\n" -"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" -"Language-Team: German <de@li.org>\n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=UTF-8\n" -"Content-Transfer-Encoding: 8bit\n" -"X-Launchpad-Export-Date: 2014-01-28 06:41+0000\n" -"X-Generator: Launchpad (build 16914)\n" - -#. module: auth_oauth_signup -#: model:ir.model,name:auth_oauth_signup.model_res_users -msgid "Users" -msgstr "Benutzer" diff --git a/addons/auth_oauth_signup/i18n/en_GB.po b/addons/auth_oauth_signup/i18n/en_GB.po deleted file mode 100644 index 699939d57b7..00000000000 --- a/addons/auth_oauth_signup/i18n/en_GB.po +++ /dev/null @@ -1,23 +0,0 @@ -# English (United Kingdom) translation for openobject-addons -# Copyright (c) 2013 Rosetta Contributors and Canonical Ltd 2013 -# This file is distributed under the same license as the openobject-addons package. -# FIRST AUTHOR <EMAIL@ADDRESS>, 2013. -# -msgid "" -msgstr "" -"Project-Id-Version: openobject-addons\n" -"Report-Msgid-Bugs-To: FULL NAME <EMAIL@ADDRESS>\n" -"POT-Creation-Date: 2012-12-21 17:05+0000\n" -"PO-Revision-Date: 2013-02-06 14:33+0000\n" -"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" -"Language-Team: English (United Kingdom) <en_GB@li.org>\n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=UTF-8\n" -"Content-Transfer-Encoding: 8bit\n" -"X-Launchpad-Export-Date: 2014-01-28 06:41+0000\n" -"X-Generator: Launchpad (build 16914)\n" - -#. module: auth_oauth_signup -#: model:ir.model,name:auth_oauth_signup.model_res_users -msgid "Users" -msgstr "Users" diff --git a/addons/auth_oauth_signup/i18n/es.po b/addons/auth_oauth_signup/i18n/es.po deleted file mode 100644 index 072378eeaa7..00000000000 --- a/addons/auth_oauth_signup/i18n/es.po +++ /dev/null @@ -1,23 +0,0 @@ -# Spanish translation for openobject-addons -# Copyright (c) 2012 Rosetta Contributors and Canonical Ltd 2012 -# This file is distributed under the same license as the openobject-addons package. -# FIRST AUTHOR <EMAIL@ADDRESS>, 2012. -# -msgid "" -msgstr "" -"Project-Id-Version: openobject-addons\n" -"Report-Msgid-Bugs-To: FULL NAME <EMAIL@ADDRESS>\n" -"POT-Creation-Date: 2012-12-21 17:05+0000\n" -"PO-Revision-Date: 2012-12-27 11:38+0000\n" -"Last-Translator: Pedro Manuel Baeza <pedro.baeza@gmail.com>\n" -"Language-Team: Spanish <es@li.org>\n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=UTF-8\n" -"Content-Transfer-Encoding: 8bit\n" -"X-Launchpad-Export-Date: 2014-01-28 06:41+0000\n" -"X-Generator: Launchpad (build 16914)\n" - -#. module: auth_oauth_signup -#: model:ir.model,name:auth_oauth_signup.model_res_users -msgid "Users" -msgstr "Usuarios" diff --git a/addons/auth_oauth_signup/i18n/et.po b/addons/auth_oauth_signup/i18n/et.po deleted file mode 100644 index 25c2888fea1..00000000000 --- a/addons/auth_oauth_signup/i18n/et.po +++ /dev/null @@ -1,23 +0,0 @@ -# Estonian translation for openobject-addons -# Copyright (c) 2013 Rosetta Contributors and Canonical Ltd 2013 -# This file is distributed under the same license as the openobject-addons package. -# FIRST AUTHOR <EMAIL@ADDRESS>, 2013. -# -msgid "" -msgstr "" -"Project-Id-Version: openobject-addons\n" -"Report-Msgid-Bugs-To: FULL NAME <EMAIL@ADDRESS>\n" -"POT-Creation-Date: 2012-12-21 17:05+0000\n" -"PO-Revision-Date: 2013-10-09 14:34+0000\n" -"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" -"Language-Team: Estonian <et@li.org>\n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=UTF-8\n" -"Content-Transfer-Encoding: 8bit\n" -"X-Launchpad-Export-Date: 2014-01-28 06:41+0000\n" -"X-Generator: Launchpad (build 16914)\n" - -#. module: auth_oauth_signup -#: model:ir.model,name:auth_oauth_signup.model_res_users -msgid "Users" -msgstr "Kasutajad" diff --git a/addons/auth_oauth_signup/i18n/fr.po b/addons/auth_oauth_signup/i18n/fr.po deleted file mode 100644 index 02544f189c5..00000000000 --- a/addons/auth_oauth_signup/i18n/fr.po +++ /dev/null @@ -1,23 +0,0 @@ -# French translation for openobject-addons -# Copyright (c) 2012 Rosetta Contributors and Canonical Ltd 2012 -# This file is distributed under the same license as the openobject-addons package. -# FIRST AUTHOR <EMAIL@ADDRESS>, 2012. -# -msgid "" -msgstr "" -"Project-Id-Version: openobject-addons\n" -"Report-Msgid-Bugs-To: FULL NAME <EMAIL@ADDRESS>\n" -"POT-Creation-Date: 2012-12-21 17:05+0000\n" -"PO-Revision-Date: 2012-12-29 16:08+0000\n" -"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" -"Language-Team: French <fr@li.org>\n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=UTF-8\n" -"Content-Transfer-Encoding: 8bit\n" -"X-Launchpad-Export-Date: 2014-01-28 06:41+0000\n" -"X-Generator: Launchpad (build 16914)\n" - -#. module: auth_oauth_signup -#: model:ir.model,name:auth_oauth_signup.model_res_users -msgid "Users" -msgstr "Utilisateurs" diff --git a/addons/auth_oauth_signup/i18n/gl.po b/addons/auth_oauth_signup/i18n/gl.po deleted file mode 100644 index 463caea11c3..00000000000 --- a/addons/auth_oauth_signup/i18n/gl.po +++ /dev/null @@ -1,23 +0,0 @@ -# Galician translation for openobject-addons -# Copyright (c) 2014 Rosetta Contributors and Canonical Ltd 2014 -# This file is distributed under the same license as the openobject-addons package. -# FIRST AUTHOR <EMAIL@ADDRESS>, 2014. -# -msgid "" -msgstr "" -"Project-Id-Version: openobject-addons\n" -"Report-Msgid-Bugs-To: FULL NAME <EMAIL@ADDRESS>\n" -"POT-Creation-Date: 2012-12-21 17:05+0000\n" -"PO-Revision-Date: 2014-02-05 16:37+0000\n" -"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" -"Language-Team: Galician <gl@li.org>\n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=UTF-8\n" -"Content-Transfer-Encoding: 8bit\n" -"X-Launchpad-Export-Date: 2014-02-06 05:33+0000\n" -"X-Generator: Launchpad (build 16916)\n" - -#. module: auth_oauth_signup -#: model:ir.model,name:auth_oauth_signup.model_res_users -msgid "Users" -msgstr "Usuarios" diff --git a/addons/auth_oauth_signup/i18n/hr.po b/addons/auth_oauth_signup/i18n/hr.po deleted file mode 100644 index c3cc0238ca0..00000000000 --- a/addons/auth_oauth_signup/i18n/hr.po +++ /dev/null @@ -1,23 +0,0 @@ -# Croatian translation for openobject-addons -# Copyright (c) 2013 Rosetta Contributors and Canonical Ltd 2013 -# This file is distributed under the same license as the openobject-addons package. -# FIRST AUTHOR <EMAIL@ADDRESS>, 2013. -# -msgid "" -msgstr "" -"Project-Id-Version: openobject-addons\n" -"Report-Msgid-Bugs-To: FULL NAME <EMAIL@ADDRESS>\n" -"POT-Creation-Date: 2012-12-21 17:05+0000\n" -"PO-Revision-Date: 2013-01-24 12:30+0000\n" -"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" -"Language-Team: Croatian <hr@li.org>\n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=UTF-8\n" -"Content-Transfer-Encoding: 8bit\n" -"X-Launchpad-Export-Date: 2014-01-28 06:41+0000\n" -"X-Generator: Launchpad (build 16914)\n" - -#. module: auth_oauth_signup -#: model:ir.model,name:auth_oauth_signup.model_res_users -msgid "Users" -msgstr "Korisnici" diff --git a/addons/auth_oauth_signup/i18n/hu.po b/addons/auth_oauth_signup/i18n/hu.po deleted file mode 100644 index eaed110eeeb..00000000000 --- a/addons/auth_oauth_signup/i18n/hu.po +++ /dev/null @@ -1,23 +0,0 @@ -# Hungarian translation for openobject-addons -# Copyright (c) 2013 Rosetta Contributors and Canonical Ltd 2013 -# This file is distributed under the same license as the openobject-addons package. -# FIRST AUTHOR <EMAIL@ADDRESS>, 2013. -# -msgid "" -msgstr "" -"Project-Id-Version: openobject-addons\n" -"Report-Msgid-Bugs-To: FULL NAME <EMAIL@ADDRESS>\n" -"POT-Creation-Date: 2012-12-21 17:05+0000\n" -"PO-Revision-Date: 2013-03-19 18:13+0000\n" -"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" -"Language-Team: Hungarian <hu@li.org>\n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=UTF-8\n" -"Content-Transfer-Encoding: 8bit\n" -"X-Launchpad-Export-Date: 2014-01-28 06:41+0000\n" -"X-Generator: Launchpad (build 16914)\n" - -#. module: auth_oauth_signup -#: model:ir.model,name:auth_oauth_signup.model_res_users -msgid "Users" -msgstr "Felhasználók" diff --git a/addons/auth_oauth_signup/i18n/it.po b/addons/auth_oauth_signup/i18n/it.po deleted file mode 100644 index 4c01dc40d00..00000000000 --- a/addons/auth_oauth_signup/i18n/it.po +++ /dev/null @@ -1,23 +0,0 @@ -# Italian translation for openobject-addons -# Copyright (c) 2012 Rosetta Contributors and Canonical Ltd 2012 -# This file is distributed under the same license as the openobject-addons package. -# FIRST AUTHOR <EMAIL@ADDRESS>, 2012. -# -msgid "" -msgstr "" -"Project-Id-Version: openobject-addons\n" -"Report-Msgid-Bugs-To: FULL NAME <EMAIL@ADDRESS>\n" -"POT-Creation-Date: 2012-12-21 17:05+0000\n" -"PO-Revision-Date: 2012-12-27 09:12+0000\n" -"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" -"Language-Team: Italian <it@li.org>\n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=UTF-8\n" -"Content-Transfer-Encoding: 8bit\n" -"X-Launchpad-Export-Date: 2014-01-28 06:41+0000\n" -"X-Generator: Launchpad (build 16914)\n" - -#. module: auth_oauth_signup -#: model:ir.model,name:auth_oauth_signup.model_res_users -msgid "Users" -msgstr "Utenti" diff --git a/addons/auth_oauth_signup/i18n/lt.po b/addons/auth_oauth_signup/i18n/lt.po deleted file mode 100644 index 6cf0153f69f..00000000000 --- a/addons/auth_oauth_signup/i18n/lt.po +++ /dev/null @@ -1,23 +0,0 @@ -# Lithuanian translation for openobject-addons -# Copyright (c) 2013 Rosetta Contributors and Canonical Ltd 2013 -# This file is distributed under the same license as the openobject-addons package. -# FIRST AUTHOR <EMAIL@ADDRESS>, 2013. -# -msgid "" -msgstr "" -"Project-Id-Version: openobject-addons\n" -"Report-Msgid-Bugs-To: FULL NAME <EMAIL@ADDRESS>\n" -"POT-Creation-Date: 2012-12-21 17:05+0000\n" -"PO-Revision-Date: 2013-04-24 18:21+0000\n" -"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" -"Language-Team: Lithuanian <lt@li.org>\n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=UTF-8\n" -"Content-Transfer-Encoding: 8bit\n" -"X-Launchpad-Export-Date: 2014-01-28 06:41+0000\n" -"X-Generator: Launchpad (build 16914)\n" - -#. module: auth_oauth_signup -#: model:ir.model,name:auth_oauth_signup.model_res_users -msgid "Users" -msgstr "Naudotojai" diff --git a/addons/auth_oauth_signup/i18n/mk.po b/addons/auth_oauth_signup/i18n/mk.po deleted file mode 100644 index 3afed5fe7b3..00000000000 --- a/addons/auth_oauth_signup/i18n/mk.po +++ /dev/null @@ -1,23 +0,0 @@ -# Macedonian translation for openobject-addons -# Copyright (c) 2013 Rosetta Contributors and Canonical Ltd 2013 -# This file is distributed under the same license as the openobject-addons package. -# FIRST AUTHOR <EMAIL@ADDRESS>, 2013. -# -msgid "" -msgstr "" -"Project-Id-Version: openobject-addons\n" -"Report-Msgid-Bugs-To: FULL NAME <EMAIL@ADDRESS>\n" -"POT-Creation-Date: 2012-12-21 17:05+0000\n" -"PO-Revision-Date: 2013-02-28 14:54+0000\n" -"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" -"Language-Team: Macedonian <mk@li.org>\n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=UTF-8\n" -"Content-Transfer-Encoding: 8bit\n" -"X-Launchpad-Export-Date: 2014-01-28 06:41+0000\n" -"X-Generator: Launchpad (build 16914)\n" - -#. module: auth_oauth_signup -#: model:ir.model,name:auth_oauth_signup.model_res_users -msgid "Users" -msgstr "Корисници" diff --git a/addons/auth_oauth_signup/i18n/mn.po b/addons/auth_oauth_signup/i18n/mn.po deleted file mode 100644 index 8c45059310f..00000000000 --- a/addons/auth_oauth_signup/i18n/mn.po +++ /dev/null @@ -1,23 +0,0 @@ -# Mongolian translation for openobject-addons -# Copyright (c) 2013 Rosetta Contributors and Canonical Ltd 2013 -# This file is distributed under the same license as the openobject-addons package. -# FIRST AUTHOR <EMAIL@ADDRESS>, 2013. -# -msgid "" -msgstr "" -"Project-Id-Version: openobject-addons\n" -"Report-Msgid-Bugs-To: FULL NAME <EMAIL@ADDRESS>\n" -"POT-Creation-Date: 2012-12-21 17:05+0000\n" -"PO-Revision-Date: 2013-02-06 07:44+0000\n" -"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" -"Language-Team: Mongolian <mn@li.org>\n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=UTF-8\n" -"Content-Transfer-Encoding: 8bit\n" -"X-Launchpad-Export-Date: 2014-01-28 06:41+0000\n" -"X-Generator: Launchpad (build 16914)\n" - -#. module: auth_oauth_signup -#: model:ir.model,name:auth_oauth_signup.model_res_users -msgid "Users" -msgstr "Хэрэглэгчид" diff --git a/addons/auth_oauth_signup/i18n/nl.po b/addons/auth_oauth_signup/i18n/nl.po deleted file mode 100644 index 5029138c5d9..00000000000 --- a/addons/auth_oauth_signup/i18n/nl.po +++ /dev/null @@ -1,23 +0,0 @@ -# Dutch translation for openobject-addons -# Copyright (c) 2012 Rosetta Contributors and Canonical Ltd 2012 -# This file is distributed under the same license as the openobject-addons package. -# FIRST AUTHOR <EMAIL@ADDRESS>, 2012. -# -msgid "" -msgstr "" -"Project-Id-Version: openobject-addons\n" -"Report-Msgid-Bugs-To: FULL NAME <EMAIL@ADDRESS>\n" -"POT-Creation-Date: 2012-12-21 17:05+0000\n" -"PO-Revision-Date: 2012-12-27 09:12+0000\n" -"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" -"Language-Team: Dutch <nl@li.org>\n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=UTF-8\n" -"Content-Transfer-Encoding: 8bit\n" -"X-Launchpad-Export-Date: 2014-01-28 06:41+0000\n" -"X-Generator: Launchpad (build 16914)\n" - -#. module: auth_oauth_signup -#: model:ir.model,name:auth_oauth_signup.model_res_users -msgid "Users" -msgstr "Gebruikers" diff --git a/addons/auth_oauth_signup/i18n/nl_BE.po b/addons/auth_oauth_signup/i18n/nl_BE.po deleted file mode 100644 index 2366d0844f2..00000000000 --- a/addons/auth_oauth_signup/i18n/nl_BE.po +++ /dev/null @@ -1,23 +0,0 @@ -# Dutch (Belgium) translation for openobject-addons -# Copyright (c) 2013 Rosetta Contributors and Canonical Ltd 2013 -# This file is distributed under the same license as the openobject-addons package. -# FIRST AUTHOR <EMAIL@ADDRESS>, 2013. -# -msgid "" -msgstr "" -"Project-Id-Version: openobject-addons\n" -"Report-Msgid-Bugs-To: FULL NAME <EMAIL@ADDRESS>\n" -"POT-Creation-Date: 2012-12-21 17:05+0000\n" -"PO-Revision-Date: 2013-04-15 16:01+0000\n" -"Last-Translator: Els Van Vossel (Foxy) <Unknown>\n" -"Language-Team: Dutch (Belgium) <nl_BE@li.org>\n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=UTF-8\n" -"Content-Transfer-Encoding: 8bit\n" -"X-Launchpad-Export-Date: 2014-01-28 06:41+0000\n" -"X-Generator: Launchpad (build 16914)\n" - -#. module: auth_oauth_signup -#: model:ir.model,name:auth_oauth_signup.model_res_users -msgid "Users" -msgstr "Gebruikers" diff --git a/addons/auth_oauth_signup/i18n/pl.po b/addons/auth_oauth_signup/i18n/pl.po deleted file mode 100644 index c0e6153a430..00000000000 --- a/addons/auth_oauth_signup/i18n/pl.po +++ /dev/null @@ -1,23 +0,0 @@ -# Polish translation for openobject-addons -# Copyright (c) 2013 Rosetta Contributors and Canonical Ltd 2013 -# This file is distributed under the same license as the openobject-addons package. -# FIRST AUTHOR <EMAIL@ADDRESS>, 2013. -# -msgid "" -msgstr "" -"Project-Id-Version: openobject-addons\n" -"Report-Msgid-Bugs-To: FULL NAME <EMAIL@ADDRESS>\n" -"POT-Creation-Date: 2012-12-21 17:05+0000\n" -"PO-Revision-Date: 2013-11-14 12:00+0000\n" -"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" -"Language-Team: Polish <pl@li.org>\n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=UTF-8\n" -"Content-Transfer-Encoding: 8bit\n" -"X-Launchpad-Export-Date: 2014-01-28 06:41+0000\n" -"X-Generator: Launchpad (build 16914)\n" - -#. module: auth_oauth_signup -#: model:ir.model,name:auth_oauth_signup.model_res_users -msgid "Users" -msgstr "Użytkownicy" diff --git a/addons/auth_oauth_signup/i18n/pt.po b/addons/auth_oauth_signup/i18n/pt.po deleted file mode 100644 index c0664b109b7..00000000000 --- a/addons/auth_oauth_signup/i18n/pt.po +++ /dev/null @@ -1,23 +0,0 @@ -# Portuguese translation for openobject-addons -# Copyright (c) 2013 Rosetta Contributors and Canonical Ltd 2013 -# This file is distributed under the same license as the openobject-addons package. -# FIRST AUTHOR <EMAIL@ADDRESS>, 2013. -# -msgid "" -msgstr "" -"Project-Id-Version: openobject-addons\n" -"Report-Msgid-Bugs-To: FULL NAME <EMAIL@ADDRESS>\n" -"POT-Creation-Date: 2012-12-21 17:05+0000\n" -"PO-Revision-Date: 2013-01-08 17:56+0000\n" -"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" -"Language-Team: Portuguese <pt@li.org>\n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=UTF-8\n" -"Content-Transfer-Encoding: 8bit\n" -"X-Launchpad-Export-Date: 2014-01-28 06:41+0000\n" -"X-Generator: Launchpad (build 16914)\n" - -#. module: auth_oauth_signup -#: model:ir.model,name:auth_oauth_signup.model_res_users -msgid "Users" -msgstr "Utilizadores" diff --git a/addons/auth_oauth_signup/i18n/pt_BR.po b/addons/auth_oauth_signup/i18n/pt_BR.po deleted file mode 100644 index 2d50e76837a..00000000000 --- a/addons/auth_oauth_signup/i18n/pt_BR.po +++ /dev/null @@ -1,23 +0,0 @@ -# Brazilian Portuguese translation for openobject-addons -# Copyright (c) 2013 Rosetta Contributors and Canonical Ltd 2013 -# This file is distributed under the same license as the openobject-addons package. -# FIRST AUTHOR <EMAIL@ADDRESS>, 2013. -# -msgid "" -msgstr "" -"Project-Id-Version: openobject-addons\n" -"Report-Msgid-Bugs-To: FULL NAME <EMAIL@ADDRESS>\n" -"POT-Creation-Date: 2012-12-21 17:05+0000\n" -"PO-Revision-Date: 2013-01-02 11:56+0000\n" -"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" -"Language-Team: Brazilian Portuguese <pt_BR@li.org>\n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=UTF-8\n" -"Content-Transfer-Encoding: 8bit\n" -"X-Launchpad-Export-Date: 2014-01-28 06:41+0000\n" -"X-Generator: Launchpad (build 16914)\n" - -#. module: auth_oauth_signup -#: model:ir.model,name:auth_oauth_signup.model_res_users -msgid "Users" -msgstr "Usuários" diff --git a/addons/auth_oauth_signup/i18n/ro.po b/addons/auth_oauth_signup/i18n/ro.po deleted file mode 100644 index 5d2593b66b4..00000000000 --- a/addons/auth_oauth_signup/i18n/ro.po +++ /dev/null @@ -1,23 +0,0 @@ -# Romanian translation for openobject-addons -# Copyright (c) 2013 Rosetta Contributors and Canonical Ltd 2013 -# This file is distributed under the same license as the openobject-addons package. -# FIRST AUTHOR <EMAIL@ADDRESS>, 2013. -# -msgid "" -msgstr "" -"Project-Id-Version: openobject-addons\n" -"Report-Msgid-Bugs-To: FULL NAME <EMAIL@ADDRESS>\n" -"POT-Creation-Date: 2012-12-21 17:05+0000\n" -"PO-Revision-Date: 2013-01-14 19:07+0000\n" -"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" -"Language-Team: Romanian <ro@li.org>\n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=UTF-8\n" -"Content-Transfer-Encoding: 8bit\n" -"X-Launchpad-Export-Date: 2014-01-28 06:41+0000\n" -"X-Generator: Launchpad (build 16914)\n" - -#. module: auth_oauth_signup -#: model:ir.model,name:auth_oauth_signup.model_res_users -msgid "Users" -msgstr "Utilizatori" diff --git a/addons/auth_oauth_signup/i18n/ru.po b/addons/auth_oauth_signup/i18n/ru.po deleted file mode 100644 index e60c290f8e3..00000000000 --- a/addons/auth_oauth_signup/i18n/ru.po +++ /dev/null @@ -1,23 +0,0 @@ -# Russian translation for openobject-addons -# Copyright (c) 2013 Rosetta Contributors and Canonical Ltd 2013 -# This file is distributed under the same license as the openobject-addons package. -# FIRST AUTHOR <EMAIL@ADDRESS>, 2013. -# -msgid "" -msgstr "" -"Project-Id-Version: openobject-addons\n" -"Report-Msgid-Bugs-To: FULL NAME <EMAIL@ADDRESS>\n" -"POT-Creation-Date: 2012-12-21 17:05+0000\n" -"PO-Revision-Date: 2013-02-13 09:46+0000\n" -"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" -"Language-Team: Russian <ru@li.org>\n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=UTF-8\n" -"Content-Transfer-Encoding: 8bit\n" -"X-Launchpad-Export-Date: 2014-01-28 06:41+0000\n" -"X-Generator: Launchpad (build 16914)\n" - -#. module: auth_oauth_signup -#: model:ir.model,name:auth_oauth_signup.model_res_users -msgid "Users" -msgstr "Пользователи" diff --git a/addons/auth_oauth_signup/i18n/sl.po b/addons/auth_oauth_signup/i18n/sl.po deleted file mode 100644 index a7acd1ceacc..00000000000 --- a/addons/auth_oauth_signup/i18n/sl.po +++ /dev/null @@ -1,23 +0,0 @@ -# Slovenian translation for openobject-addons -# Copyright (c) 2012 Rosetta Contributors and Canonical Ltd 2012 -# This file is distributed under the same license as the openobject-addons package. -# FIRST AUTHOR <EMAIL@ADDRESS>, 2012. -# -msgid "" -msgstr "" -"Project-Id-Version: openobject-addons\n" -"Report-Msgid-Bugs-To: FULL NAME <EMAIL@ADDRESS>\n" -"POT-Creation-Date: 2012-12-21 17:05+0000\n" -"PO-Revision-Date: 2012-12-30 09:36+0000\n" -"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" -"Language-Team: Slovenian <sl@li.org>\n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=UTF-8\n" -"Content-Transfer-Encoding: 8bit\n" -"X-Launchpad-Export-Date: 2014-01-28 06:41+0000\n" -"X-Generator: Launchpad (build 16914)\n" - -#. module: auth_oauth_signup -#: model:ir.model,name:auth_oauth_signup.model_res_users -msgid "Users" -msgstr "Uporabniki" diff --git a/addons/auth_oauth_signup/i18n/sv.po b/addons/auth_oauth_signup/i18n/sv.po deleted file mode 100644 index 93350614b98..00000000000 --- a/addons/auth_oauth_signup/i18n/sv.po +++ /dev/null @@ -1,23 +0,0 @@ -# Swedish translation for openobject-addons -# Copyright (c) 2013 Rosetta Contributors and Canonical Ltd 2013 -# This file is distributed under the same license as the openobject-addons package. -# FIRST AUTHOR <EMAIL@ADDRESS>, 2013. -# -msgid "" -msgstr "" -"Project-Id-Version: openobject-addons\n" -"Report-Msgid-Bugs-To: FULL NAME <EMAIL@ADDRESS>\n" -"POT-Creation-Date: 2012-12-21 17:05+0000\n" -"PO-Revision-Date: 2013-01-17 23:47+0000\n" -"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" -"Language-Team: Swedish <sv@li.org>\n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=UTF-8\n" -"Content-Transfer-Encoding: 8bit\n" -"X-Launchpad-Export-Date: 2014-01-28 06:41+0000\n" -"X-Generator: Launchpad (build 16914)\n" - -#. module: auth_oauth_signup -#: model:ir.model,name:auth_oauth_signup.model_res_users -msgid "Users" -msgstr "Användare" diff --git a/addons/auth_oauth_signup/i18n/tr.po b/addons/auth_oauth_signup/i18n/tr.po deleted file mode 100644 index 4b61dc5a190..00000000000 --- a/addons/auth_oauth_signup/i18n/tr.po +++ /dev/null @@ -1,23 +0,0 @@ -# Turkish translation for openobject-addons -# Copyright (c) 2013 Rosetta Contributors and Canonical Ltd 2013 -# This file is distributed under the same license as the openobject-addons package. -# FIRST AUTHOR <EMAIL@ADDRESS>, 2013. -# -msgid "" -msgstr "" -"Project-Id-Version: openobject-addons\n" -"Report-Msgid-Bugs-To: FULL NAME <EMAIL@ADDRESS>\n" -"POT-Creation-Date: 2012-12-21 17:05+0000\n" -"PO-Revision-Date: 2013-02-03 12:07+0000\n" -"Last-Translator: Ahmet Altınışık <Unknown>\n" -"Language-Team: Turkish <tr@li.org>\n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=UTF-8\n" -"Content-Transfer-Encoding: 8bit\n" -"X-Launchpad-Export-Date: 2014-01-28 06:41+0000\n" -"X-Generator: Launchpad (build 16914)\n" - -#. module: auth_oauth_signup -#: model:ir.model,name:auth_oauth_signup.model_res_users -msgid "Users" -msgstr "Kullanıcılar" diff --git a/addons/auth_oauth_signup/i18n/vi.po b/addons/auth_oauth_signup/i18n/vi.po deleted file mode 100644 index 086df785f57..00000000000 --- a/addons/auth_oauth_signup/i18n/vi.po +++ /dev/null @@ -1,23 +0,0 @@ -# Vietnamese translation for openobject-addons -# Copyright (c) 2013 Rosetta Contributors and Canonical Ltd 2013 -# This file is distributed under the same license as the openobject-addons package. -# FIRST AUTHOR <EMAIL@ADDRESS>, 2013. -# -msgid "" -msgstr "" -"Project-Id-Version: openobject-addons\n" -"Report-Msgid-Bugs-To: FULL NAME <EMAIL@ADDRESS>\n" -"POT-Creation-Date: 2012-12-21 17:05+0000\n" -"PO-Revision-Date: 2013-06-27 06:49+0000\n" -"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" -"Language-Team: Vietnamese <vi@li.org>\n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=UTF-8\n" -"Content-Transfer-Encoding: 8bit\n" -"X-Launchpad-Export-Date: 2014-01-28 06:41+0000\n" -"X-Generator: Launchpad (build 16914)\n" - -#. module: auth_oauth_signup -#: model:ir.model,name:auth_oauth_signup.model_res_users -msgid "Users" -msgstr "Người dùng" diff --git a/addons/auth_oauth_signup/i18n/zh_CN.po b/addons/auth_oauth_signup/i18n/zh_CN.po deleted file mode 100644 index f3009f88142..00000000000 --- a/addons/auth_oauth_signup/i18n/zh_CN.po +++ /dev/null @@ -1,23 +0,0 @@ -# Chinese (Simplified) translation for openobject-addons -# Copyright (c) 2012 Rosetta Contributors and Canonical Ltd 2012 -# This file is distributed under the same license as the openobject-addons package. -# FIRST AUTHOR <EMAIL@ADDRESS>, 2012. -# -msgid "" -msgstr "" -"Project-Id-Version: openobject-addons\n" -"Report-Msgid-Bugs-To: FULL NAME <EMAIL@ADDRESS>\n" -"POT-Creation-Date: 2012-12-21 17:05+0000\n" -"PO-Revision-Date: 2013-01-02 10:59+0000\n" -"Last-Translator: Oliver Yuan <Unknown>\n" -"Language-Team: Chinese (Simplified) <zh_CN@li.org>\n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=UTF-8\n" -"Content-Transfer-Encoding: 8bit\n" -"X-Launchpad-Export-Date: 2014-01-28 06:41+0000\n" -"X-Generator: Launchpad (build 16914)\n" - -#. module: auth_oauth_signup -#: model:ir.model,name:auth_oauth_signup.model_res_users -msgid "Users" -msgstr "用户" diff --git a/addons/auth_oauth_signup/i18n/zh_TW.po b/addons/auth_oauth_signup/i18n/zh_TW.po deleted file mode 100644 index 0e3e0b23c3b..00000000000 --- a/addons/auth_oauth_signup/i18n/zh_TW.po +++ /dev/null @@ -1,23 +0,0 @@ -# Chinese (Traditional) translation for openobject-addons -# Copyright (c) 2013 Rosetta Contributors and Canonical Ltd 2013 -# This file is distributed under the same license as the openobject-addons package. -# FIRST AUTHOR <EMAIL@ADDRESS>, 2013. -# -msgid "" -msgstr "" -"Project-Id-Version: openobject-addons\n" -"Report-Msgid-Bugs-To: FULL NAME <EMAIL@ADDRESS>\n" -"POT-Creation-Date: 2012-12-21 17:05+0000\n" -"PO-Revision-Date: 2013-01-30 13:18+0000\n" -"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" -"Language-Team: Chinese (Traditional) <zh_TW@li.org>\n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=UTF-8\n" -"Content-Transfer-Encoding: 8bit\n" -"X-Launchpad-Export-Date: 2014-01-28 06:41+0000\n" -"X-Generator: Launchpad (build 16914)\n" - -#. module: auth_oauth_signup -#: model:ir.model,name:auth_oauth_signup.model_res_users -msgid "Users" -msgstr "使用者" diff --git a/addons/auth_oauth_signup/res_users.py b/addons/auth_oauth_signup/res_users.py deleted file mode 100644 index a06968fa46f..00000000000 --- a/addons/auth_oauth_signup/res_users.py +++ /dev/null @@ -1,60 +0,0 @@ -# -*- coding: utf-8 -*- -############################################################################## -# -# OpenERP, Open Source Management Solution -# Copyright (C) 2010-2012 OpenERP SA (<http://openerp.com>). -# -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU Affero General Public License as -# published by the Free Software Foundation, either version 3 of the -# License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Affero General Public License for more details. -# -# You should have received a copy of the GNU Affero General Public License -# along with this program. If not, see <http://www.gnu.org/licenses/>. -# -############################################################################## - -import logging -import simplejson - -import openerp -from openerp.addons.auth_signup.res_users import SignupError -from openerp.osv import osv, fields - -_logger = logging.getLogger(__name__) - -class res_users(osv.Model): - _inherit = 'res.users' - - def _auth_oauth_signin(self, cr, uid, provider, validation, params, context=None): - # overridden to use signup method if regular oauth signin fails - try: - login = super(res_users, self)._auth_oauth_signin(cr, uid, provider, validation, params, context=context) - - except openerp.exceptions.AccessDenied, access_denied_exception: - if context and context.get('no_user_creation'): - return None - state = simplejson.loads(params['state']) - token = state.get('t') - oauth_uid = validation['user_id'] - email = validation.get('email', 'provider_%s_user_%s' % (provider, oauth_uid)) - name = validation.get('name', email) - values = { - 'name': name, - 'login': email, - 'email': email, - 'oauth_provider_id': provider, - 'oauth_uid': oauth_uid, - 'oauth_access_token': params['access_token'], - 'active': True, - } - try: - _, login, _ = self.signup(cr, uid, values, token, context=context) - except SignupError: - raise access_denied_exception - return login diff --git a/addons/auth_oauth_signup/views/auth_oauth_signup.xml b/addons/auth_oauth_signup/views/auth_oauth_signup.xml deleted file mode 100644 index 139f36a4c0f..00000000000 --- a/addons/auth_oauth_signup/views/auth_oauth_signup.xml +++ /dev/null @@ -1,18 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<!-- vim:et:si:ts=2:sts=2:sw=2 --> -<openerp> - <data> - <template id="auth_oauth_signup.signup" inherit_id="auth_signup.signup" name="OAuth Signup buttons"> - <xpath expr="//button[@type='submit']" position="before"> - <div class="pull-right"> - <div t-foreach="providers or []" t-as="p"> - <a t-att-href="p['auth_link']" class="btn btn-link"> - <i t-att-class="p['css_class']"/> - <t t-esc="p['body']"/> - </a> - </div> - </div> - </xpath> - </template> - </data> -</openerp> diff --git a/addons/auth_signup/__openerp__.py b/addons/auth_signup/__openerp__.py index 50402207018..2aaaf61d3dd 100644 --- a/addons/auth_signup/__openerp__.py +++ b/addons/auth_signup/__openerp__.py @@ -42,6 +42,6 @@ Allow users to sign up and reset their password 'res_users_view.xml', 'views/auth_signup_login.xml', ], - 'js': ['static/src/js/auth_signup.js'], + 'js': [], 'bootstrap': True, } diff --git a/addons/auth_signup/controllers/main.py b/addons/auth_signup/controllers/main.py index f6c466b7123..78f2833f3d1 100644 --- a/addons/auth_signup/controllers/main.py +++ b/addons/auth_signup/controllers/main.py @@ -19,83 +19,100 @@ # ############################################################################## import logging +import werkzeug import openerp -import openerp.addons.web.controllers.main as webmain from openerp.addons.auth_signup.res_users import SignupError +from openerp.addons.web.controllers.main import ensure_db from openerp import http from openerp.http import request from openerp.tools.translate import _ -from openerp.tools import exception_to_unicode _logger = logging.getLogger(__name__) -class AuthSignup(openerp.addons.web.controllers.main.Home): +class AuthSignupHome(openerp.addons.web.controllers.main.Home): @http.route() def web_login(self, *args, **kw): - mode = request.params.get('mode') + ensure_db() + response = super(AuthSignupHome, self).web_login(*args, **kw) + response.qcontext.update(self.get_auth_signup_config()) + return response + + @http.route('/web/signup', type='http', auth='public', website=True, multilang=True) + def web_auth_signup(self, *args, **kw): + qcontext = self.get_auth_signup_qcontext() + + if not qcontext.get('token') and not qcontext.get('signup_enabled'): + raise werkzeug.exceptions.NotFound() + + if 'error' not in qcontext and request.httprequest.method == 'POST': + try: + self.do_signup(qcontext) + return super(AuthSignupHome, self).web_login(*args, **kw) + except (SignupError, AssertionError), e: + qcontext['error'] = _(e.message) + + return request.render('auth_signup.signup', qcontext) + + @http.route('/web/reset_password', type='http', auth='public', website=True, multilang=True) + def web_auth_reset_password(self, *args, **kw): + qcontext = self.get_auth_signup_qcontext() + + if not qcontext.get('token') and not qcontext.get('reset_password_enabled'): + raise werkzeug.exceptions.NotFound() + + if 'error' not in qcontext and request.httprequest.method == 'POST': + try: + if qcontext.get('token'): + self.do_signup(qcontext) + return super(AuthSignupHome, self).web_login(*args, **kw) + else: + login = qcontext.get('login') + assert login, "No login provided." + res_users = request.registry.get('res.users') + res_users.reset_password(request.cr, openerp.SUPERUSER_ID, login) + qcontext['message'] = _("An email has been sent with credentials to reset your password") + except SignupError: + qcontext['error'] = _("Could not reset your password") + _logger.exception('error when resetting password') + except Exception, e: + qcontext['error'] = _(e.message) + + + return request.render('auth_signup.reset_password', qcontext) + + def get_auth_signup_config(self): + """retrieve the module config (which features are enabled) for the login page""" + + icp = request.registry.get('ir.config_parameter') + return { + 'signup_enabled': icp.get_param(request.cr, openerp.SUPERUSER_ID, 'auth_signup.allow_uninvited') == 'True', + 'reset_password_enabled': icp.get_param(request.cr, openerp.SUPERUSER_ID, 'auth_signup.reset_password') == 'True', + } + + def get_auth_signup_qcontext(self): + """ Shared helper returning the rendering context for signup and reset password """ qcontext = request.params.copy() - super_response = None - if request.httprequest.method != 'POST' or mode not in ('reset', 'signup'): - # Default behavior is to try to login, which in reset or signup mode in a non-sense. - super_response = super(AuthSignup, self).web_login(*args, **kw) - response = webmain.render_bootstrap_template('auth_signup.signup', qcontext) - if super_response.is_qweb: - response.qcontext.update(super_response.qcontext) - token = qcontext.get('token', None) - token_infos = None - if token: + qcontext.update(self.get_auth_signup_config()) + if qcontext.get('token'): try: # retrieve the user info (name, login or email) corresponding to a signup token res_partner = request.registry.get('res.partner') - token_infos = res_partner.signup_retrieve_info(request.cr, openerp.SUPERUSER_ID, token) + token_infos = res_partner.signup_retrieve_info(request.cr, openerp.SUPERUSER_ID, qcontext.get('token')) for k, v in token_infos.items(): qcontext.setdefault(k, v) except: qcontext['error'] = _("Invalid signup token") - response.params['template'] = 'web.login' - return response + return qcontext - # retrieve the module config (which features are enabled) for the login page - icp = request.registry.get('ir.config_parameter') - config = { - 'signup': icp.get_param(request.cr, openerp.SUPERUSER_ID, 'auth_signup.allow_uninvited') == 'True', - 'reset': icp.get_param(request.cr, openerp.SUPERUSER_ID, 'auth_signup.reset_password') == 'True', - } - qcontext.update(config) - - if 'error' in request.params or mode not in ('reset', 'signup') or (not token and not config[mode]): - if super_response.is_qweb: - super_response.qcontext.update(config) - return super_response - - if request.httprequest.method == 'GET': - if token_infos: - qcontext.update(token_infos) - else: - res_users = request.registry.get('res.users') - login = request.params.get('login') - if mode == 'reset' and not token: - try: - res_users.reset_password(request.cr, openerp.SUPERUSER_ID, login) - qcontext['message'] = _("An email has been sent with credentials to reset your password") - response.params['template'] = 'web.login' - except Exception, e: - qcontext['error'] = exception_to_unicode(e) or _("Could not reset your password") - _logger.exception('error when resetting password') - else: - values = dict((key, qcontext.get(key)) for key in ('login', 'name', 'password')) - try: - self._signup_with_values(token, values) - redirect = request.params.get('redirect') - if not redirect: - redirect = '/web?' + request.httprequest.query_string - return http.redirect_with_hash(redirect) - except SignupError, e: - qcontext['error'] = exception_to_unicode(e) - - return response + def do_signup(self, qcontext): + """ Shared helper that creates a res.partner out of a token """ + values = dict((key, qcontext.get(key)) for key in ('login', 'name', 'password')) + assert any([k for k in values.values()]), "The form was not properly filled in." + assert values.get('password') == qcontext.get('confirm_password'), "Passwords do not match; please retype them." + self._signup_with_values(qcontext.get('token'), values) + request.cr.commit() def _signup_with_values(self, token, values): db, login, password = request.registry['res.users'].signup(request.cr, openerp.SUPERUSER_ID, values, token) @@ -104,5 +121,4 @@ class AuthSignup(openerp.addons.web.controllers.main.Home): if not uid: raise SignupError(_('Authentification Failed.')) - # vim:expandtab:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/addons/auth_signup/res_users.py b/addons/auth_signup/res_users.py index e91af657cc2..4c1c1a671b7 100644 --- a/addons/auth_signup/res_users.py +++ b/addons/auth_signup/res_users.py @@ -66,11 +66,12 @@ class res_partner(osv.Model): self.signup_prepare(cr, uid, [partner.id], context=context) partner.refresh() + route = 'login' # the parameters to encode for the query query = dict(db=cr.dbname) signup_type = context.get('signup_force_type_in_url', partner.signup_type or '') if signup_type: - query['mode'] = signup_type + route = 'reset_password' if signup_type == 'reset' else signup_type if partner.signup_token and signup_type: query['token'] = partner.signup_token @@ -89,7 +90,7 @@ class res_partner(osv.Model): if res_id: fragment['id'] = res_id - res[partner.id] = urljoin(base_url, "/web/login?%s#%s" % (urlencode(query), urlencode(fragment))) + res[partner.id] = urljoin(base_url, "/web/%s?%s#%s" % (route, urlencode(query), urlencode(fragment))) return res diff --git a/addons/auth_signup/static/src/js/auth_signup.js b/addons/auth_signup/static/src/js/auth_signup.js deleted file mode 100644 index a317440fd6b..00000000000 --- a/addons/auth_signup/static/src/js/auth_signup.js +++ /dev/null @@ -1,19 +0,0 @@ -openerp.auth_signup = function(instance) { - openerp.web.LoginForm.include({ - start: function () { - var self = this; - this.$el.on('submit', function () { - var password = self.get_password_field('password'); - var confirm_password = self.get_password_field('confirm_password'); - if (password && confirm_password && (password.value != confirm_password.value)) { - alert("Passwords do not match; please retype them."); - return false; - } - }); - }, - get_password_field: function (field) { - var selector = 'input[name="' + field + '"][type="password"]:visible'; - return this.$(selector)[0]; - }, - }); -}; diff --git a/addons/auth_signup/views/auth_signup_login.xml b/addons/auth_signup/views/auth_signup_login.xml index a9e43c86f4f..ae813cc14ac 100644 --- a/addons/auth_signup/views/auth_signup_login.xml +++ b/addons/auth_signup/views/auth_signup_login.xml @@ -5,84 +5,94 @@ <data> <template id="auth_signup.login" inherit_id="web.login" name="Sign up - Reset Password"> <xpath expr="//button[@type='submit']" position="before"> - <a t-if="signup" t-attf-href="?{{ keep_query('*', mode='signup') }}" class="btn btn-link pull-right">Sign up</a> - <a t-if="reset" t-attf-href="?{{ keep_query('*', mode='reset') }}" class="btn btn-link pull-right">Reset Password</a> + <a t-if="signup_enabled" t-attf-href="/web/signup?redirect=/web%3f{{ quote_plus(keep_query()) }}" class="btn btn-link pull-right">Sign up</a> + <a t-if="reset_password_enabled" t-attf-href="/web/reset_password?redirect=/web/login%3f{{ quote_plus(keep_query()) }}" class="btn btn-link pull-right">Reset Password</a> </xpath> </template> - <template id="auth_signup.signup" name="Sign up"> - <t t-call="web.login_layout"> - <t t-set="head"> - <t t-foreach="css" t-as="css_file"> - <link rel="stylesheet" t-att-href="css_file"/> - </t> - <t t-foreach="js" t-as="js_file"> - <script type="text/javascript" t-att-src="js_file"></script> - </t> - </t> - <script type="text/javascript"> - $(function() { - var s = new openerp.init(<t t-raw="modules"/>); - var login_form = new openerp.web.LoginForm($('.oe_signup_form')); - }); - </script> - - <t t-set="reset_without_token" t-value="mode == 'reset' and not token"/> - - <form class="oe_signup_form" role="form" method="post"> - <t t-call="web.database_select"/> - - <div class="form-group field-name" t-if="not reset_without_token"> - <label for="name" class="control-label">Your Name</label> - <input type="text" name="name" t-att-value="name" id="name" class="form-control" placeholder="e.g. John Doe" - required="required" autofocus="autofocus" t-att-disabled="'disabled' if mode == 'reset' and token else None"/> - </div> + <template id="auth_signup.fields" name="Auth Signup/ResetPassword form fields"> + <t t-call="web.database_select"/> - <div class="form-group field-login"> - <label for="login" class="control-label">Your Email</label> - <input type="email" name="login" t-att-value="login" id="login" class="form-control" - t-att-autofocus="'autofocus' if reset_without_token else None" - required="required" t-att-disabled="'disabled' if mode == 'reset' and token else None"/> - <input type="hidden" name="login" t-att-value="login" t-if="mode == 'reset' and token"/> - </div> + <div class="form-group field-name"> + <label for="name" class="control-label">Your Name</label> + <input type="text" name="name" t-att-value="name" id="name" class="form-control" placeholder="e.g. John Doe" + required="required" t-att-autofocus="'autofocus' if not only_passwords else None" t-att-readonly="'readonly' if only_passwords else None"/> + </div> - <div class="form-group field-password" t-if="not reset_without_token"> - <label for="password" class="control-label">Password</label> - <input type="password" name="password" id="password" class="form-control" - required="required" t-att-autofocus="'autofocus' if mode == 'reset' and token else None"/> - </div> + <div class="form-group field-login"> + <label for="login" class="control-label">Your Email</label> + <input type="text" name="login" t-att-value="login" id="login" class="form-control" + required="required" t-att-readonly="'readonly' if only_passwords else None"/> + </div> - <div class="form-group field-confirm_password" t-if="not reset_without_token"> - <label for="confirm_password" class="control-label">Confirm Password</label> - <input type="password" name="confirm_password" id="confirm_password" class="form-control" required="required"/> - </div> + <div class="form-group field-password"> + <label for="password" class="control-label">Password</label> + <input type="password" name="password" autofocus="autofocus" id="password" class="form-control" + required="required" t-att-autofocus="'autofocus' if only_passwords else None"/> + </div> + + <div class="form-group field-confirm_password"> + <label for="confirm_password" class="control-label">Confirm Password</label> + <input type="password" name="confirm_password" id="confirm_password" class="form-control" required="required"/> + </div> + </template> + + <template id="auth_signup.signup" name="Sign up login"> + <t t-call="web.login_layout"> + <form class="oe_signup_form" role="form" t-attf-action="/web/signup{{ '?debug' if debug else '' }}" method="post" t-if="not message"> + + <t t-call="auth_signup.fields"/> <p class="alert alert-danger" t-if="error"> <t t-esc="error"/> </p> + <input type="hidden" name="redirect" t-att-value="redirect"/> + <input type="hidden" name="token" t-att-value="token"/> + <div class="clearfix oe_login_buttons"> + <a href="/web/login" class="btn btn-link pull-right">Back to Login</a> + <button type="submit" class="btn btn-primary pull-left">Sign up</button> + </div> + + </form> + </t> + </template> + + <template id="auth_signup.reset_password" name="Reset password"> + <t t-call="web.login_layout"> + <div t-if="message"> <p class="alert alert-success" t-if="message"> <t t-esc="message"/> </p> + <a href="/web/login" class="btn btn-link pull-right">Back to Login</a> + </div> + + <form class="oe_reset_password_form" role="form" t-attf-action="/web/reset_password{{ '?debug' if debug else '' }}" method="post" t-if="not message"> + + <t t-if="token"> + <t t-call="auth_signup.fields"> + <t t-set="only_passwords" t-value="1"/> + </t> + </t> + + <t t-if="not token"> + <div class="form-group field-login"> + <label for="login" class="control-label">Your Email</label> + <input type="text" name="login" t-att-value="login" id="login" class="form-control" + autofocus="autofocus" required="required"/> + </div> + </t> + <p class="alert alert-danger" t-if="error"> + <t t-esc="error"/> + </p> <input type="hidden" name="redirect" t-att-value="redirect"/> - <input type="hidden" name="mode" t-att-value="mode"/> <input type="hidden" name="token" t-att-value="token"/> <div class="clearfix oe_login_buttons"> - <a t-attf-href="?{{ keep_query('*', mode='login') }}" class="btn btn-link pull-right">Back to Login</a> - <button type="submit" class="btn btn-primary pull-left"> - <t t-if="mode == 'signup'">Sign up</t> - <t t-if="mode == 'reset'">Reset password</t> - </button> + <a href="/web/login" class="btn btn-link pull-right">Back to Login</a> + <button type="submit" class="btn btn-primary pull-left">Reset password</button> </div> </form> - <div class="oe_single_form_footer" t-if="not disable_footer"> - <t t-if="not disable_database_manager"> - <a class="oe_login_manage_db" t-attf-href="/web/database/manager{{ '?debug' if debug else '' }}">Manage Databases</a> - <span class="oe_footer_seperator"> | </span> - </t> - <a href="http://www.openerp.com" target="_blank">Powered by <span>OpenERP</span></a> - </div> </t> </template> diff --git a/addons/email_template/email_template.py b/addons/email_template/email_template.py index fcfe869da90..b6899a7da2b 100644 --- a/addons/email_template/email_template.py +++ b/addons/email_template/email_template.py @@ -381,12 +381,18 @@ class email_template(osv.osv): for res_id in template_res_ids: attachments = [] report_name = self.render_template(cr, uid, template.report_name, template.model, res_id, context=context) - report_service = report_xml_pool.browse(cr, uid, template.report_template.id, context).report_name + report = report_xml_pool.browse(cr, uid, template.report_template.id, context) + report_service = report.report_name # Ensure report is rendered using template's language ctx = context.copy() if template.lang: ctx['lang'] = self.render_template_batch(cr, uid, template.lang, template.model, [res_id], context)[res_id] # take 0 ? - result, format = openerp.report.render_report(cr, uid, [res_id], report_service, {'model': template.model}, ctx) + + if report.report_type in ['qweb-html', 'qweb-pdf']: + result, format = self.pool['report'].get_pdf(report, res_id, context=ctx), 'pdf' + else: + result, format = openerp.report.render_report(cr, uid, [res_id], report_service, {'model': template.model}, ctx) + result = base64.b64encode(result) if not report_name: report_name = 'report.' + report_service diff --git a/addons/lunch/__openerp__.py b/addons/lunch/__openerp__.py index 46c07c211c6..f8a4a1ddcf2 100644 --- a/addons/lunch/__openerp__.py +++ b/addons/lunch/__openerp__.py @@ -42,7 +42,7 @@ If you want to save your employees' time and avoid them to always have coins in """, 'data': ['security/lunch_security.xml','lunch_view.xml','wizard/lunch_order_view.xml','wizard/lunch_validation_view.xml','wizard/lunch_cancel_view.xml','lunch_report.xml', 'report/report_lunch_order_view.xml', - 'security/ir.model.access.csv',], + 'security/ir.model.access.csv','views/report_lunchorder.xml'], 'css':['static/src/css/lunch.css'], 'images': ['images/new_order.jpeg','images/lunch_account.jpeg','images/order_by_supplier_analysis.jpeg','images/alert.jpeg'], 'demo': ['lunch_demo.xml',], diff --git a/addons/lunch/lunch_report.xml b/addons/lunch/lunch_report.xml index 942caadeed3..990694af4a9 100644 --- a/addons/lunch/lunch_report.xml +++ b/addons/lunch/lunch_report.xml @@ -2,12 +2,12 @@ <openerp> <data> <report - id="report_lunch_order" + id="action_report_lunch_order" string="Lunch Order" model="lunch.order.line" - name="lunch.order.line" - rml="lunch/report/order.rml" - auto="False" - /> + report_type="qweb-pdf" + name="lunch.report_lunchorder" + file="lunch.report_lunchorder" + /> </data> </openerp> diff --git a/addons/lunch/report/order.py b/addons/lunch/report/order.py index 064fe8bc719..0bb99f01017 100644 --- a/addons/lunch/report/order.py +++ b/addons/lunch/report/order.py @@ -20,11 +20,11 @@ ############################################################################## import time -from openerp.report import report_sxw -from openerp.osv import osv +from openerp.addons.web import http +from openerp.addons.web.http import request -class order(report_sxw.rml_parse): +class order(http.Controller): def get_lines(self, user,objects): lines=[] @@ -60,19 +60,24 @@ class order(report_sxw.rml_parse): notes.append(obj.note) return notes - def __init__(self, cr, uid, name, context): - super(order, self).__init__(cr, uid, name, context) + @http.route(['/report/lunch.report_lunchorder/<docids>'], type='http', auth='user', website=True, multilang=True) + def report_lunch(self, docids): + self.cr, self.uid, self.context = request.cr, request.uid, request.context + + ids = [int(i) for i in docids.split(',')] + report_obj = request.registry['lunch.order.line'] + docs = report_obj.browse(self.cr, self.uid, ids, context=self.context) + self.net_total=0.0 - self.localcontext.update({ + docargs = { + 'docs': docs, 'time': time, 'get_lines': self.get_lines, 'get_users': self.get_users, 'get_total': self.get_total, 'get_nettotal': self.get_nettotal, 'get_note': self.get_note, - }) + } + return request.registry['report'].render(self.cr, self.uid, [], 'lunch.report_lunchorder', docargs) -report_sxw.report_sxw('report.lunch.order.line', 'lunch.order.line', - 'addons/lunch/report/order.rml',parser=order, header='external') # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: - diff --git a/addons/lunch/report/order.rml b/addons/lunch/report/order.rml deleted file mode 100644 index 1ab52a88bda..00000000000 --- a/addons/lunch/report/order.rml +++ /dev/null @@ -1,184 +0,0 @@ -<?xml version="1.0"?> -<document filename="Lunch Order.pdf"> - <template title="Lunch Order" author="OpenERP S.A.(sales@openerp.com)" allowSplitting="20"> - <pageTemplate id="first"> - <frame id="first" x1="34.0" y1="42.0" width="527" height="758"/> - </pageTemplate> - </template> - <stylesheet> - <blockTableStyle id="Standard_Outline"> - <blockAlignment value="LEFT"/> - <blockValign value="TOP"/> - </blockTableStyle> - <blockTableStyle id="Table1"> - <blockAlignment value="LEFT"/> - <blockValign value="TOP"/> - </blockTableStyle> - <blockTableStyle id="Table5"> - <blockAlignment value="LEFT"/> - <blockValign value="TOP"/> - <lineStyle kind="LINEBELOW" colorName="#000000" start="0,-1" stop="0,-1"/> - <lineStyle kind="LINEBELOW" colorName="#000000" start="1,-1" stop="1,-1"/> - <lineStyle kind="LINEBELOW" colorName="#000000" start="2,-1" stop="2,-1"/> - <lineStyle kind="LINEBELOW" colorName="#000000" start="3,-1" stop="3,-1"/> - </blockTableStyle> - <blockTableStyle id="Table6"> - <blockAlignment value="LEFT"/> - <blockValign value="TOP"/> - <lineStyle kind="LINEBELOW" colorName="#b3b3b3" start="0,-1" stop="0,-1"/> - </blockTableStyle> - <blockTableStyle id="Table7"> - <blockAlignment value="LEFT"/> - <blockValign value="TOP"/> - <lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="0,-1" stop="0,-1"/> - <lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="1,-1" stop="1,-1"/> - <lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="2,-1" stop="2,-1"/> - <lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="3,-1" stop="3,-1"/> - </blockTableStyle> - <blockTableStyle id="Table2"> - <blockAlignment value="LEFT"/> - <blockValign value="TOP"/> - <lineStyle kind="LINEABOVE" colorName="#000000" start="1,0" stop="1,0"/> - <lineStyle kind="LINEABOVE" colorName="#000000" start="2,0" stop="2,0"/> - </blockTableStyle> - <initialize> - <paraStyle name="all" alignment="justify"/> - </initialize> - <paraStyle name="Standard" fontName="Helvetica"/> - <paraStyle name="Text body" fontName="Helvetica" spaceBefore="0.0" spaceAfter="6.0"/> - <paraStyle name="Heading" fontName="Helvetica" fontSize="14.0" leading="17" spaceBefore="12.0" spaceAfter="6.0"/> - <paraStyle name="List" fontName="Helvetica" spaceBefore="0.0" spaceAfter="6.0"/> - <paraStyle name="Header" fontName="Helvetica"/> - <paraStyle name="Footer" fontName="Helvetica"/> - <paraStyle name="Table Contents" fontName="Helvetica"/> - <paraStyle name="Table Heading" fontName="Helvetica" alignment="CENTER"/> - <paraStyle name="Caption" fontName="Helvetica" fontSize="12.0" leading="15" spaceBefore="6.0" spaceAfter="6.0"/> - <paraStyle name="Footnote" rightIndent="0.0" leftIndent="14.0" fontName="Helvetica" fontSize="10.0" leading="13"/> - <paraStyle name="Index" fontName="Helvetica"/> - <paraStyle name="Heading 1" fontName="Helvetica-Bold" fontSize="115%" leading="NaN" spaceBefore="12.0" spaceAfter="6.0"/> - <paraStyle name="terp_header" fontName="Helvetica-Bold" fontSize="15.0" leading="19" alignment="LEFT" spaceBefore="12.0" spaceAfter="6.0"/> - <paraStyle name="terp_default_8" fontName="Helvetica" fontSize="8.0" leading="10" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/> - <paraStyle name="terp_default_9" fontName="Helvetica" fontSize="9.0" leading="11" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/> - <paraStyle name="terp_tbl_detail_header" fontName="Helvetica-Bold" fontSize="9.0" leading="11" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/> - <paraStyle name="terp_tbl_detail_header_right" fontName="Helvetica-Bold" fontSize="9.0" leading="11" alignment="RIGHT" spaceBefore="0.0" spaceAfter="0.0"/> - <paraStyle name="terp_tbl_detail_header_center" fontName="Helvetica-Bold" fontSize="9.0" leading="11" alignment="CENTER" spaceBefore="0.0" spaceAfter="0.0"/> - <paraStyle name="terp_default_9_right" fontName="Helvetica" fontSize="9.0" leading="11" alignment="RIGHT" spaceBefore="0.0" spaceAfter="0.0"/> - <paraStyle name="terp_default_9_right_bold" fontName="Helvetica-Bold" fontSize="9.0" leading="11" alignment="RIGHT" spaceBefore="0.0" spaceAfter="0.0"/> - <paraStyle name="terp_header_center" fontName="Helvetica-Bold" fontSize="15.0" leading="19" alignment="CENTER" spaceBefore="0.0" spaceAfter="0.0"/> - <paraStyle name="terp_default_9_center" fontName="Helvetica" fontSize="9.0" leading="11" alignment="CENTER" spaceBefore="0.0" spaceAfter="0.0"/> - <paraStyle name="terp_default_2" fontName="Helvetica" fontSize="2.0" leading="3" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/> - <paraStyle name="terp_default_9_left9" rightIndent="0.0" leftIndent="9.0" fontName="Helvetica" fontSize="9.0" leading="11" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/> - <images/> - </stylesheet> - <story> - <pto> - <pto_header> - <blockTable colWidths="149.0,114.0,201.0,63.0" style="Table5"> - <tr> - <td> - <para style="terp_tbl_detail_header">Name/Date</para> - </td> - <td> - <para style="terp_tbl_detail_header">Order</para> - </td> - <td> - <para style="terp_tbl_detail_header">Description</para> - </td> - <td> - <para style="terp_tbl_detail_header_right">Unit Price</para> - </td> - </tr> - </blockTable> - </pto_header> - <para style="terp_default_8"> - <font color="white"> </font> - </para> - <blockTable colWidths="293.0,235.0" style="Table1"> - <tr> - <td> - <para style="terp_default_8"> - <font color="white"> </font> - </para> - </td> - <td> - <para style="terp_default_8">[[ user.name ]] </para> - <para style="terp_default_8">[[ user.login ]]</para> - <para style="terp_default_8">[[ user.email ]]</para> - </td> - </tr> - </blockTable> - <para style="terp_header">Lunch Order</para> - <blockTable colWidths="149.0,114.0,201.0,63.0" style="Table5"> - <tr> - <td> - <para style="terp_tbl_detail_header">Name/Date</para> - </td> - <td> - <para style="terp_tbl_detail_header">Order</para> - </td> - <td> - <para style="terp_tbl_detail_header">Description</para> - </td> - <td> - <para style="terp_tbl_detail_header_right">Unit Price</para> - </td> - </tr> - </blockTable> - <section> - <para style="terp_default_2">[[repeatIn(get_users(objects),'o')]]</para> - <blockTable colWidths="263.0,201.0,63.0" style="Table6"> - <tr> - <td> - <para style="terp_tbl_detail_header">[[ o.name ]]</para> - </td> - <td> - <para style="terp_default_8"> - <font color="white"> </font> - </para> - </td> - <td> - <para style="terp_default_9_right_bold"><u>[[ formatLang(get_total(o,objects)) ]] [[ (o.company_id and o.company_id.currency_id and o.company_id.currency_id.symbol) or '' ]]</u></para> - </td> - </tr> - </blockTable> - <section> - <para style="terp_default_2">[[ repeatIn(get_lines(o,objects),'lines') ]]</para> - <blockTable colWidths="151.0,113.0,216.0,49.0" style="Table7"> - <tr> - <td> - <para style="terp_default_9_left9">[[ formatLang(lines.date,date='True') ]]</para> - </td> - <td> - <para style="terp_default_9">[[ (lines.product_id and lines.product_id.name) or '' ]]</para> - </td> - <td> - <para style="terp_default_9">[[ lines.note]]</para> - </td> - <td> - <para style="terp_default_9_right">[[ lines.price ]] [[ (o.company_id and o.company_id.currency_id and o.company_id.currency_id.symbol) or '' ]]</para> - </td> - </tr> - </blockTable> - </section> - </section> - <blockTable colWidths="409.0,50.0,70.0" style="Table2"> - <tr> - <td> - <para style="terp_default_8"> - <font color="white"> </font> - </para> - </td> - <td> - <para style="terp_tbl_detail_header">Total :</para> - </td> - <td> - <para style="terp_default_9_right_bold">[[ formatLang(get_nettotal()) ]] [[ (o.company_id and o.company_id.currency_id and o.company_id.currency_id.symbol) or '' ]]</para> - </td> - </tr> - </blockTable> - <para style="terp_default_2"> - <font color="white"> </font> - </para> - </pto> - </story> -</document> diff --git a/addons/lunch/views/report_lunchorder.xml b/addons/lunch/views/report_lunchorder.xml new file mode 100644 index 00000000000..93d43f6521d --- /dev/null +++ b/addons/lunch/views/report_lunchorder.xml @@ -0,0 +1,79 @@ +<?xml version="1.0" encoding="utf-8"?> +<openerp> +<data> +<template id="report_lunchorder"> + <t t-call="report.html_container"> + <t t-call="report.external_layout"> + <div class="page"> + <div class="oe_structure"/> + + <div class="row"> + <div class="col-xs-4 col-xs-offset-7"> + <div t-field="user.partner_id" + t-field-options='{"widget": "contact", "fields": ["address", "name"], "no_marker": true}' /> + </div> + </div> + + <h2>Lunch Order</h2> + + <table class="table table-condensed"> + <thead> + <tr> + <th>Name/Date</th> + <th>Order</th> + <th>Description</th> + <th class="text-right">Unit Price</th> + </tr> + </thead> + <tbody> + <t t-foreach="get_users(docs)" t-as="o"> + <tr> + <td colspan="2"> + <strong t-field="o.name"/> + </td> + <td class="text-right" colspan="2"> + <strong> + <span t-esc="get_total(o, docs)"/> + <span t-field="o.company_id.currency_id.symbol"/> + </strong> + </td> + </tr> + <tr t-foreach="get_lines(o, docs)" t-as="lines"> + <td> + <span t-field="lines.date"></span> + </td> + <td> + <span t-field="lines.product_id.name"/> + </td> + <td> + <span t-field="lines.note"/> + </td> + <td class="text-right"> + <span t-field="lines.price" + t-field-options='{"widget": "monetary", "display_currency": "o.company_id.currency_id"}'/> + </td> + </tr> + </t> + </tbody> + </table> + + <div class="row"> + <div class="col-xs-4 pull-right"> + <table class="table table-condensed"> + <tr class="border-black"> + <td><strong>Total</strong></td> + <td class="text-right"> + <span t-esc="formatLang(get_nettotal(), currency_obj=res_company.currency_id)"/> + </td> + </tr> + </table> + </div> + </div> + + <div class="oe_structure"/> + </div> + </t> + </t> +</template> +</data> +</openerp> diff --git a/addons/mrp/__openerp__.py b/addons/mrp/__openerp__.py index 99afd01707a..ef68b27a489 100644 --- a/addons/mrp/__openerp__.py +++ b/addons/mrp/__openerp__.py @@ -69,9 +69,11 @@ Dashboard / Reports for MRP will include: 'process/service_product_process.xml', 'process/procurement_process.xml', 'report/mrp_report_view.xml', - 'report/mrp_production_order_view.xml', 'board_manufacturing_view.xml', 'res_config_view.xml', + + 'views/report_mrporder.xml', + 'views/report_mrpbomstructure.xml', ], 'demo': ['mrp_demo.xml'], #TODO: This yml tests are needed to be completely reviewed again because the product wood panel is removed in product demo as it does not suit for new demo context of computer and consultant company diff --git a/addons/mrp/mrp_report.xml b/addons/mrp/mrp_report.xml index c37343f50db..29c848acbe4 100644 --- a/addons/mrp/mrp_report.xml +++ b/addons/mrp/mrp_report.xml @@ -1,23 +1,30 @@ <?xml version="1.0" encoding="utf-8"?> <openerp> <data> + <report + string="BOM Structure" + id="action_report_bom_structure" + model="mrp.bom" + name="mrp.report_mrpbomstructure" + file="mrp.report_mrpbomstructure" + report_type="qweb-pdf" + /> - <report auto="True" header="False" id="report_bom_structure" model="mrp.bom" name="bom.structure" rml="mrp/report/bom_structure.rml" string="BOM Structure"/> - - <report - id="report_mrp_production_report" - string="Production Order" - model="mrp.production" - name="mrp.production.order" - rml="mrp/report/order.rml" - auto="False" - /> + <report + string="Production Order" + id="action_report_production_order" + model="mrp.production" + name="mrp.report_mrporder" + file="mrp.report_mrporder" + report_type="qweb-pdf" + /> <report id="report_cost_structure" model="product.product" menu="False" name="product.price" string="Cost Structure" - xsl="mrp/report/price.xsl"/> + xsl="mrp/report/price.xsl" + /> </data> </openerp> diff --git a/addons/mrp/report/__init__.py b/addons/mrp/report/__init__.py index 471e3440af3..971c312343e 100644 --- a/addons/mrp/report/__init__.py +++ b/addons/mrp/report/__init__.py @@ -21,10 +21,8 @@ import price import workcenter_load -import order import bom_structure import mrp_report -import mrp_production_order # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/addons/mrp/report/bom_structure.py b/addons/mrp/report/bom_structure.py index b153ea2e4e9..9af4e91b8ce 100644 --- a/addons/mrp/report/bom_structure.py +++ b/addons/mrp/report/bom_structure.py @@ -19,16 +19,24 @@ # ############################################################################## -import time -from openerp.report import report_sxw +from openerp.addons.web import http +from openerp.addons.web.http import request -class bom_structure(report_sxw.rml_parse): - def __init__(self, cr, uid, name, context): - super(bom_structure, self).__init__(cr, uid, name, context=context) - self.localcontext.update({ - 'time': time, - 'get_children':self.get_children, - }) + +class bom_structure(http.Controller): + + @http.route(['/report/mrp.report_mrpbomstructure/<docids>'], type='http', auth='user', website=True, multilang=True) + def report_mrpbomstructure(self, docids): + ids = [int(i) for i in docids.split(',')] + ids = list(set(ids)) + report_obj = request.registry['mrp.bom'] + docs = report_obj.browse(request.cr, request.uid, ids, context=request.context) + + docargs = { + 'docs': docs, + 'get_children': self.get_children, + } + return request.registry['report'].render(request.cr, request.uid, [], 'mrp.report_mrpbomstructure', docargs) def get_children(self, object, level=0): result = [] @@ -56,7 +64,4 @@ class bom_structure(report_sxw.rml_parse): return children -report_sxw.report_sxw('report.bom.structure','mrp.bom','mrp/report/bom_structure.rml',parser=bom_structure,header='internal') - - # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/addons/mrp/report/bom_structure.rml b/addons/mrp/report/bom_structure.rml deleted file mode 100644 index cdc27c08d87..00000000000 --- a/addons/mrp/report/bom_structure.rml +++ /dev/null @@ -1,154 +0,0 @@ -<?xml version="1.0"?> -<document filename="BOM Structure.pdf"> - <template title="BOM Structure" author="OpenERP S.A.(sales@openerp.com)" allowSplitting="20"> - <pageTemplate id="first"> - <frame id="first" x1="31.0" y1="30.0" width="532" height="781"/> - </pageTemplate> - </template> - <stylesheet> - <blockTableStyle id="Standard_Outline"> - <blockAlignment value="LEFT"/> - <blockValign value="TOP"/> - </blockTableStyle> - <blockTableStyle id="Table2"> - <blockAlignment value="LEFT"/> - <blockValign value="TOP"/> - <lineStyle kind="LINEBELOW" colorName="#000000" start="0,-1" stop="0,-1"/> - <lineStyle kind="LINEBELOW" colorName="#000000" start="1,-1" stop="1,-1"/> - <lineStyle kind="LINEBELOW" colorName="#000000" start="2,-1" stop="2,-1"/> - <lineStyle kind="LINEBELOW" colorName="#000000" start="3,-1" stop="3,-1"/> - </blockTableStyle> - <blockTableStyle id="Table1"> - <blockAlignment value="LEFT"/> - <blockValign value="TOP"/> - <lineStyle kind="LINEBELOW" colorName="#999999" start="0,-1" stop="0,-1"/> - <lineStyle kind="LINEBELOW" colorName="#999999" start="1,-1" stop="1,-1"/> - <lineStyle kind="LINEBELOW" colorName="#999999" start="2,-1" stop="2,-1"/> - <lineStyle kind="LINEBELOW" colorName="#999999" start="3,-1" stop="3,-1"/> - </blockTableStyle> - <blockTableStyle id="Table3"> - <blockAlignment value="LEFT"/> - <blockValign value="TOP"/> - <lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="0,-1" stop="0,-1"/> - <lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="1,-1" stop="1,-1"/> - <lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="2,-1" stop="2,-1"/> - <lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="3,-1" stop="3,-1"/> - </blockTableStyle> - <initialize> - <paraStyle name="all" alignment="justify"/> - </initialize> - <paraStyle name="Standard" fontName="Helvetica"/> - <paraStyle name="Heading" fontName="Helvetica" fontSize="14.0" leading="17" spaceBefore="12.0" spaceAfter="6.0"/> - <paraStyle name="Text body" fontName="Helvetica" spaceBefore="0.0" spaceAfter="6.0"/> - <paraStyle name="List" fontName="Helvetica" spaceBefore="0.0" spaceAfter="6.0"/> - <paraStyle name="Caption" fontName="Helvetica" fontSize="12.0" leading="15" spaceBefore="6.0" spaceAfter="6.0"/> - <paraStyle name="Index" fontName="Helvetica"/> - <paraStyle name="Table Contents" fontName="Helvetica" fontSize="6.0" leading="8" alignment="LEFT"/> - <paraStyle name="Table Heading" fontName="Helvetica" fontSize="6.0" leading="8" alignment="CENTER"/> - <paraStyle name="terp_header" fontName="Helvetica-Bold" fontSize="15.0" leading="19" alignment="LEFT" spaceBefore="12.0" spaceAfter="6.0"/> - <paraStyle name="terp_default_8" fontName="Helvetica" fontSize="8.0" leading="10" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/> - <paraStyle name="terp_default_Bold_8" fontName="Helvetica-Bold" fontSize="8.0" leading="10" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/> - <paraStyle name="terp_default_Bold_9" fontName="Helvetica-Bold" fontSize="9.0" leading="11" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/> - <paraStyle name="terp_default_9" fontName="Helvetica" fontSize="9.0" leading="11" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/> - <paraStyle name="terp_tblheader_General" fontName="Helvetica-Bold" fontSize="9.0" leading="11" alignment="LEFT" spaceBefore="6.0" spaceAfter="6.0"/> - <paraStyle name="terp_tblheader_General_Centre" fontName="Helvetica-Bold" fontSize="9.0" leading="11" alignment="CENTER" spaceBefore="6.0" spaceAfter="6.0"/> - <paraStyle name="terp_default_Centre_8" fontName="Helvetica" fontSize="8.0" leading="10" alignment="CENTER" spaceBefore="0.0" spaceAfter="0.0"/> - <paraStyle name="terp_tblheader_Details" fontName="Helvetica-Bold" fontSize="9.0" leading="11" alignment="LEFT" spaceBefore="6.0" spaceAfter="6.0"/> - <paraStyle name="Footer" fontName="Helvetica"/> - <paraStyle name="Horizontal Line" fontName="Helvetica" fontSize="6.0" leading="8" spaceBefore="0.0" spaceAfter="14.0"/> - <paraStyle name="Heading 9" fontName="Helvetica-Bold" fontSize="75%" leading="NaN" spaceBefore="12.0" spaceAfter="6.0"/> - <paraStyle name="terp_tblheader_General_Right" fontName="Helvetica-Bold" fontSize="9.0" leading="11" alignment="RIGHT" spaceBefore="6.0" spaceAfter="6.0"/> - <paraStyle name="terp_tblheader_Details_Centre" fontName="Helvetica-Bold" fontSize="9.0" leading="11" alignment="CENTER" spaceBefore="6.0" spaceAfter="6.0"/> - <paraStyle name="terp_tblheader_Details_Right" fontName="Helvetica-Bold" fontSize="9.0" leading="11" alignment="RIGHT" spaceBefore="6.0" spaceAfter="6.0"/> - <paraStyle name="terp_default_Right_8" fontName="Helvetica" fontSize="8.0" leading="10" alignment="RIGHT" spaceBefore="0.0" spaceAfter="0.0"/> - <paraStyle name="terp_header_Right" fontName="Helvetica-Bold" fontSize="15.0" leading="19" alignment="LEFT" spaceBefore="12.0" spaceAfter="6.0"/> - <paraStyle name="terp_header_Centre" fontName="Helvetica-Bold" fontSize="15.0" leading="19" alignment="CENTER" spaceBefore="12.0" spaceAfter="6.0"/> - <paraStyle name="terp_default_address" fontName="Helvetica" fontSize="10.0" leading="13" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/> - <paraStyle name="terp_default_Centre_9" fontName="Helvetica" fontSize="9.0" leading="11" alignment="CENTER" spaceBefore="0.0" spaceAfter="0.0"/> - <paraStyle name="terp_default_Right_9" fontName="Helvetica" fontSize="9.0" leading="11" alignment="RIGHT" spaceBefore="0.0" spaceAfter="0.0"/> - <paraStyle name="terp_default_1" fontName="Helvetica" fontSize="2.0" leading="3" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/> - <paraStyle name="terp_default_Right_9_Bold" fontName="Helvetica-Bold" fontSize="9.0" leading="11" alignment="RIGHT" spaceBefore="0.0" spaceAfter="0.0"/> - <paraStyle name="terp_default_8_Italic" fontName="Helvetica-Oblique" fontSize="8.0" leading="10" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/> - <paraStyle name="Heading 2" fontName="Helvetica-BoldOblique" fontSize="14.0" leading="17" spaceBefore="12.0" spaceAfter="6.0"/> - <paraStyle name="terp_remove_space" fontName="Helvetica" fontSize="2.0" leading="3" spaceBefore="0.0" spaceAfter="0.0"/> - <images/> - </stylesheet> - <story> - <pto> - <pto_header> - <blockTable colWidths="192.0,198.0,71.0,71.0" style="Table2"> - <tr> - <td> - <para style="terp_tblheader_Details">BOM Name</para> - </td> - <td> - <para style="terp_tblheader_Details">Product Name</para> - </td> - <td> - <para style="terp_tblheader_Details_Right">Quantity</para> - </td> - <td> - <para style="terp_tblheader_General_Centre">BOM Ref</para> - </td> - </tr> - </blockTable> - </pto_header> - - <para style="terp_header_Centre">BOM Structure</para> - <blockTable colWidths="192.0,198.0,71.0,71.0" style="Table2"> - <tr> - <td> - <para style="terp_tblheader_Details">BOM Name</para> - </td> - <td> - <para style="terp_tblheader_Details">Product Name</para> - </td> - <td> - <para style="terp_tblheader_Details_Right">Quantity</para> - </td> - <td> - <para style="terp_tblheader_General_Centre">BOM Ref</para> - </td> - </tr> - </blockTable> - <section> - <para style="terp_default_8">[[ repeatIn(objects, 'o') ]]</para> - <blockTable colWidths="192.0,198.0,71.0,71.0" style="Table1"> - <tr> - <td> - <para style="terp_default_Bold_9">[[ o.name ]]</para> - </td> - <td> - <para style="terp_default_Bold_9">[ [[ (o.product_id.default_code) or removeParentNode('font') ]] ] [[ o.product_id.name ]]</para> - </td> - <td> - <para style="terp_default_Right_9_Bold">[[ o.product_qty ]] [[ o.product_uom.name ]]</para> - </td> - <td> - <para style="terp_tblheader_Details_Centre">[[ o.code ]]</para> - </td> - </tr> - </blockTable> - <section> - <para style="terp_default_8">[[ repeatIn(get_children(o.bom_lines), 'l') ]]</para> - <blockTable colWidths="192.0,198.0,71.0,71.0" style="Table3"> - <tr> - <td> - <para style="terp_default_9"><font face="Helvetica" size="8.0" color="white">[[ '... '*(l['level']) ]]</font> - [[ l['name'] ]]</para> - </td> - <td> - <para style="terp_default_9">[ [[ (l['pcode']) or removeParentNode('font') ]] ] [[ l['pname'] ]]</para> - </td> - <td> - <para style="terp_default_Right_9">[[ l['pqty'] ]] [[ l['uname'] ]]</para> - </td> - <td> - <para style="terp_default_Centre_9">[[ l['code'] ]]</para> - </td> - </tr> - </blockTable> - </section> - </section> - </pto> - </story> -</document>
\ No newline at end of file diff --git a/addons/mrp/report/mrp_production_order.py b/addons/mrp/report/mrp_production_order.py deleted file mode 100644 index d0ff7ba7970..00000000000 --- a/addons/mrp/report/mrp_production_order.py +++ /dev/null @@ -1,24 +0,0 @@ -# -*- coding: utf-8 -*- -############################################################################## -# -# OpenERP, Open Source Management Solution -# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>). -# -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU Affero General Public License as -# published by the Free Software Foundation, either version 3 of the -# License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Affero General Public License for more details. -# -# You should have received a copy of the GNU Affero General Public License -# along with this program. If not, see <http://www.gnu.org/licenses/>. -# -############################################################################## - - - -# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/addons/mrp/report/mrp_production_order_view.xml b/addons/mrp/report/mrp_production_order_view.xml deleted file mode 100644 index 140170e4906..00000000000 --- a/addons/mrp/report/mrp_production_order_view.xml +++ /dev/null @@ -1,7 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<openerp> - <data> - - </data> -</openerp> - diff --git a/addons/mrp/report/order.py b/addons/mrp/report/order.py deleted file mode 100644 index eb3f5663677..00000000000 --- a/addons/mrp/report/order.py +++ /dev/null @@ -1,34 +0,0 @@ -# -*- coding: utf-8 -*- -############################################################################## -# -# OpenERP, Open Source Management Solution -# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>). -# -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU Affero General Public License as -# published by the Free Software Foundation, either version 3 of the -# License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Affero General Public License for more details. -# -# You should have received a copy of the GNU Affero General Public License -# along with this program. If not, see <http://www.gnu.org/licenses/>. -# -############################################################################## - -import time -from openerp.report import report_sxw - -class order(report_sxw.rml_parse): - def __init__(self, cr, uid, name, context): - super(order, self).__init__(cr, uid, name, context=context) - self.localcontext.update({ - 'time': time, - }) - -report_sxw.report_sxw('report.mrp.production.order','mrp.production','addons/mrp/report/order.rml',parser=order,header='internal') - -# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/addons/mrp/report/order.rml b/addons/mrp/report/order.rml deleted file mode 100644 index f413a6cfc70..00000000000 --- a/addons/mrp/report/order.rml +++ /dev/null @@ -1,373 +0,0 @@ -<?xml version="1.0"?> -<document filename="Production Order.pdf"> - <template title="Production Order" author="OpenERP S.A. (sales@openerp.com)" allowSplitting="20"> - <pageTemplate id="first"> - <frame id="first" x1="34.0" y1="42.0" width="527" height="758"/> - </pageTemplate> - </template> - <stylesheet> - <blockTableStyle id="Standard_Outline"> - <blockAlignment value="LEFT"/> - <blockValign value="TOP"/> - </blockTableStyle> - <blockTableStyle id="Table3"> - <blockAlignment value="LEFT"/> - <blockValign value="TOP"/> - <lineStyle kind="LINEBEFORE" colorName="#e6e6e6" start="0,0" stop="0,-1"/> - <lineStyle kind="LINEABOVE" colorName="#e6e6e6" start="0,0" stop="0,0"/> - <lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="0,-1" stop="0,-1"/> - <lineStyle kind="LINEBEFORE" colorName="#e6e6e6" start="1,0" stop="1,-1"/> - <lineStyle kind="LINEABOVE" colorName="#e6e6e6" start="1,0" stop="1,0"/> - <lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="1,-1" stop="1,-1"/> - <lineStyle kind="LINEBEFORE" colorName="#e6e6e6" start="2,0" stop="2,-1"/> - <lineStyle kind="LINEAFTER" colorName="#e6e6e6" start="2,0" stop="2,-1"/> - <lineStyle kind="LINEABOVE" colorName="#e6e6e6" start="2,0" stop="2,0"/> - <lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="2,-1" stop="2,-1"/> - </blockTableStyle> - <blockTableStyle id="Table5"> - <blockAlignment value="LEFT"/> - <blockValign value="TOP"/> - <lineStyle kind="LINEBEFORE" colorName="#e6e6e6" start="0,0" stop="0,-1"/> - <lineStyle kind="LINEABOVE" colorName="#e6e6e6" start="0,0" stop="0,0"/> - <lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="0,-1" stop="0,-1"/> - <lineStyle kind="LINEBEFORE" colorName="#e6e6e6" start="1,0" stop="1,-1"/> - <lineStyle kind="LINEABOVE" colorName="#e6e6e6" start="1,0" stop="1,0"/> - <lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="1,-1" stop="1,-1"/> - <lineStyle kind="LINEBEFORE" colorName="#e6e6e6" start="2,0" stop="2,-1"/> - <lineStyle kind="LINEAFTER" colorName="#e6e6e6" start="2,0" stop="2,-1"/> - <lineStyle kind="LINEABOVE" colorName="#e6e6e6" start="2,0" stop="2,0"/> - <lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="2,-1" stop="2,-1"/> - </blockTableStyle> - <blockTableStyle id="Table1"> - <blockAlignment value="LEFT"/> - <blockValign value="TOP"/> - <lineStyle kind="LINEBEFORE" colorName="#e6e6e6" start="0,0" stop="0,-1"/> - <lineStyle kind="LINEABOVE" colorName="#e6e6e6" start="0,0" stop="0,0"/> - <lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="0,-1" stop="0,-1"/> - <lineStyle kind="LINEBEFORE" colorName="#e6e6e6" start="1,0" stop="1,-1"/> - <lineStyle kind="LINEABOVE" colorName="#e6e6e6" start="1,0" stop="1,0"/> - <lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="1,-1" stop="1,-1"/> - <lineStyle kind="LINEBEFORE" colorName="#e6e6e6" start="2,0" stop="2,-1"/> - <lineStyle kind="LINEABOVE" colorName="#e6e6e6" start="2,0" stop="2,0"/> - <lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="2,-1" stop="2,-1"/> - <lineStyle kind="LINEBEFORE" colorName="#e6e6e6" start="3,0" stop="3,-1"/> - <lineStyle kind="LINEAFTER" colorName="#e6e6e6" start="3,0" stop="3,-1"/> - <lineStyle kind="LINEABOVE" colorName="#e6e6e6" start="3,0" stop="3,0"/> - <lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="3,-1" stop="3,-1"/> - </blockTableStyle> - <blockTableStyle id="Table2"> - <blockAlignment value="LEFT"/> - <blockValign value="TOP"/> - <lineStyle kind="LINEBEFORE" colorName="#e6e6e6" start="0,0" stop="0,-1"/> - <lineStyle kind="LINEABOVE" colorName="#e6e6e6" start="0,0" stop="0,0"/> - <lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="0,-1" stop="0,-1"/> - <lineStyle kind="LINEBEFORE" colorName="#e6e6e6" start="1,0" stop="1,-1"/> - <lineStyle kind="LINEABOVE" colorName="#e6e6e6" start="1,0" stop="1,0"/> - <lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="1,-1" stop="1,-1"/> - <lineStyle kind="LINEBEFORE" colorName="#e6e6e6" start="2,0" stop="2,-1"/> - <lineStyle kind="LINEABOVE" colorName="#e6e6e6" start="2,0" stop="2,0"/> - <lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="2,-1" stop="2,-1"/> - <lineStyle kind="LINEBEFORE" colorName="#e6e6e6" start="3,0" stop="3,-1"/> - <lineStyle kind="LINEAFTER" colorName="#e6e6e6" start="3,0" stop="3,-1"/> - <lineStyle kind="LINEABOVE" colorName="#e6e6e6" start="3,0" stop="3,0"/> - <lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="3,-1" stop="3,-1"/> - </blockTableStyle> - <blockTableStyle id="Table6"> - <blockAlignment value="LEFT"/> - <blockValign value="TOP"/> - <lineStyle kind="LINEBEFORE" colorName="#e6e6e6" start="0,0" stop="0,-1"/> - <lineStyle kind="LINEABOVE" colorName="#e6e6e6" start="0,0" stop="0,0"/> - <lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="0,-1" stop="0,-1"/> - <lineStyle kind="LINEBEFORE" colorName="#e6e6e6" start="1,0" stop="1,-1"/> - <lineStyle kind="LINEABOVE" colorName="#e6e6e6" start="1,0" stop="1,0"/> - <lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="1,-1" stop="1,-1"/> - <lineStyle kind="LINEBEFORE" colorName="#e6e6e6" start="2,0" stop="2,-1"/> - <lineStyle kind="LINEABOVE" colorName="#e6e6e6" start="2,0" stop="2,0"/> - <lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="2,-1" stop="2,-1"/> - <lineStyle kind="LINEBEFORE" colorName="#e6e6e6" start="3,0" stop="3,-1"/> - <lineStyle kind="LINEABOVE" colorName="#e6e6e6" start="3,0" stop="3,0"/> - <lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="3,-1" stop="3,-1"/> - <lineStyle kind="LINEBEFORE" colorName="#e6e6e6" start="4,0" stop="4,-1"/> - <lineStyle kind="LINEAFTER" colorName="#e6e6e6" start="4,0" stop="4,-1"/> - <lineStyle kind="LINEABOVE" colorName="#e6e6e6" start="4,0" stop="4,0"/> - <lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="4,-1" stop="4,-1"/> - </blockTableStyle> - <blockTableStyle id="Table4"> - <blockAlignment value="LEFT"/> - <blockValign value="TOP"/> - <lineStyle kind="LINEBEFORE" colorName="#e6e6e6" start="0,0" stop="0,-1"/> - <lineStyle kind="LINEABOVE" colorName="#e6e6e6" start="0,0" stop="0,0"/> - <lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="0,-1" stop="0,-1"/> - <lineStyle kind="LINEBEFORE" colorName="#e6e6e6" start="1,0" stop="1,-1"/> - <lineStyle kind="LINEABOVE" colorName="#e6e6e6" start="1,0" stop="1,0"/> - <lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="1,-1" stop="1,-1"/> - <lineStyle kind="LINEBEFORE" colorName="#e6e6e6" start="2,0" stop="2,-1"/> - <lineStyle kind="LINEABOVE" colorName="#e6e6e6" start="2,0" stop="2,0"/> - <lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="2,-1" stop="2,-1"/> - <lineStyle kind="LINEBEFORE" colorName="#e6e6e6" start="3,0" stop="3,-1"/> - <lineStyle kind="LINEABOVE" colorName="#e6e6e6" start="3,0" stop="3,0"/> - <lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="3,-1" stop="3,-1"/> - <lineStyle kind="LINEBEFORE" colorName="#e6e6e6" start="4,0" stop="4,-1"/> - <lineStyle kind="LINEAFTER" colorName="#e6e6e6" start="4,0" stop="4,-1"/> - <lineStyle kind="LINEABOVE" colorName="#e6e6e6" start="4,0" stop="4,0"/> - <lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="4,-1" stop="4,-1"/> - </blockTableStyle> - <blockTableStyle id="Table8"> - <blockAlignment value="LEFT"/> - <blockValign value="TOP"/> - <lineStyle kind="LINEBELOW" colorName="#000000" start="0,-1" stop="0,-1"/> - <lineStyle kind="LINEBELOW" colorName="#000000" start="1,-1" stop="1,-1"/> - <lineStyle kind="LINEBELOW" colorName="#000000" start="2,-1" stop="2,-1"/> - <lineStyle kind="LINEBELOW" colorName="#000000" start="3,-1" stop="3,-1"/> - </blockTableStyle> - <blockTableStyle id="Table9"> - <blockAlignment value="LEFT"/> - <blockValign value="TOP"/> - <lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="0,-1" stop="0,-1"/> - <lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="1,-1" stop="1,-1"/> - <lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="2,-1" stop="2,-1"/> - <lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="3,-1" stop="3,-1"/> - </blockTableStyle> - <blockTableStyle id="Table10"> - <blockAlignment value="LEFT"/> - <blockValign value="TOP"/> - <lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="0,-1" stop="0,-1"/> - <lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="1,-1" stop="1,-1"/> - <lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="2,-1" stop="2,-1"/> - <lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="3,-1" stop="3,-1"/> - </blockTableStyle> - <initialize> - <paraStyle name="all" alignment="justify"/> - </initialize> - <paraStyle name="terp_header" fontSize="15.0" leading="19" alignment="LEFT" spaceBefore="12.0" spaceAfter="6.0"/> - <paraStyle name="terp_tblheader_Details" fontSize="9.0" leading="11" alignment="LEFT" spaceBefore="6.0" spaceAfter="6.0"/> - <paraStyle name="terp_default_8" fontSize="8.0" leading="10" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/> - <paraStyle name="terp_default_Bold_8" fontSize="8.0" leading="10" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/> - <paraStyle name="terp_tblheader_General_Centre" fontSize="8.0" leading="10" alignment="CENTER" spaceBefore="6.0" spaceAfter="6.0"/> - <paraStyle name="terp_tblheader_Details_Centre" fontSize="9.0" leading="11" alignment="CENTER" spaceBefore="6.0" spaceAfter="6.0"/> - <paraStyle name="terp_default_Centre_8" fontSize="8.0" leading="10" alignment="CENTER" spaceBefore="0.0" spaceAfter="0.0"/> - <paraStyle name="terp_default_9" fontSize="9.0" leading="11" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/> - <paraStyle name="terp_default_Bold_9" fontSize="9.0" leading="11" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/> - <paraStyle name="terp_default_Centre_9" fontSize="9.0" leading="11" alignment="CENTER" spaceBefore="0.0" spaceAfter="0.0"/> - <paraStyle name="terp_default_Right_9" fontSize="9.0" leading="11" alignment="RIGHT" spaceBefore="0.0" spaceAfter="0.0"/> - <paraStyle name="terp_default_2" fontSize="2.0" leading="3" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/> - <images/> - </stylesheet> - <story> - <pto> - <pto_header> - <blockTable colWidths="256.0,61.0,107.0,104.0" style="Table8"> - <tr> - <td> - <para style="terp_tblheader_Details"><b>Product </b></para> - </td> - <td> - <para style="terp_tblheader_Details_Centre"><b>Quantity</b></para> - </td> - <td> - <para style="terp_tblheader_Details_Centre"><b>Source Location</b></para> - </td> - <td> - <para style="terp_tblheader_Details_Centre"><b>Destination Location</b></para> - </td> - </tr> - </blockTable> - </pto_header> - <para style="terp_default_8">[[repeatIn(objects,'o')]] </para> - <para style="terp_default_8"> - <font color="white"> </font> - </para> - <para style="terp_header"><b>Production Order N° : [[ o.name ]]</b></para> - <para style="terp_default_8"> - <font color="white"> </font> - </para> - <blockTable colWidths="193.0,206.0,129.0" style="Table3"> - <tr> - <td> - <para style="terp_tblheader_General_Centre"><b>Source Document</b></para> - </td> - <td> - <para style="terp_tblheader_General_Centre"><b>Product </b></para> - </td> - <td> - <para style="terp_tblheader_General_Centre"><b>Quantity</b></para> - </td> - </tr> - </blockTable> - <blockTable colWidths="193.0,205.0,129.0" style="Table5"> - <tr> - <td> - <para style="terp_default_Centre_8">[[ o.origin ]]</para> - </td> - <td> - <para style="terp_default_Centre_8">[[ (o.product_id and o.product_id.code) or '' ]] [[ (o.product_id and o.product_id.name) or '' ]]</para> - </td> - <td> - <para style="terp_default_Centre_8">[[formatLang(o.product_qty) ]] [[ (o.product_id and o.product_uom and o.product_uom.name) or '']]</para> - </td> - </tr> - </blockTable> - <para style="terp_default_8"> - <font color="white"> </font> - </para> - <blockTable colWidths="193.0,92.0,114.0,129.0" repeatRows="1" style="Table1"> - <tr> - <td> - <para style="terp_tblheader_General_Centre"><b>Scheduled Date</b></para> - </td> - <td> - <para style="terp_tblheader_General_Centre"><b>Printing date</b></para> - </td> - <td> - <para style="terp_tblheader_General_Centre"><b>Partner Ref</b></para> - </td> - <td> - <para style="terp_tblheader_General_Centre"><b>SO Number</b></para> - </td> - </tr> - </blockTable> - <section> - <blockTable colWidths="193.0,92.0,114.0,129.0" style="Table2"> - <tr> - <td> - <para style="terp_default_Centre_8">[[ formatLang(o.date_planned, date_time = True) ]]</para> - </td> - <td> - <para style="terp_default_Centre_8">[[ formatLang(time.strftime('%Y-%m-%d'),date = True) ]]</para> - </td> - <td> - <para style="terp_default_Centre_8">[[ ('sale_ref' in o._columns.keys() and o.sale_ref) or '' ]]</para> - </td> - <td> - <para style="terp_default_Centre_8">[[ ('sale_name' in o._columns.keys() and o.sale_name) or '' ]]</para> - </td> - </tr> - </blockTable> - </section> - <para style="terp_default_8"> - <font color="white"> </font> - </para> - <para style="terp_default_Bold_8"><b>Work Orders [[ o.workcenter_lines ==[] and removeParentNode('para')]]</b></para> - <para style="terp_default_8"> - <font color="white"> </font> - </para> - <blockTable colWidths="74.0,212.0,112.0,66.0,64.0" style="Table6"> - <tr> - <td> - <para style="terp_tblheader_General_Centre"><b>Sequence</b></para> - </td> - <td> - <para style="terp_tblheader_Details_Centre"><b>Name [[ o.workcenter_lines ==[] and removeParentNode('blockTable')]]</b></para> - </td> - <td> - <para style="terp_tblheader_General_Centre"><b>WorkCenter</b></para> - </td> - <td> - <para style="terp_tblheader_General_Centre"><b>No. Of Cycles</b></para> - </td> - <td> - <para style="terp_tblheader_General_Centre"><b>No. Of Hours</b></para> - </td> - </tr> - </blockTable> - <section> - <para style="terp_default_8">[[ repeatIn(o.workcenter_lines,'line2') ]]</para> - <blockTable colWidths="74.0,212.0,112.0,66.0,64.0" style="Table4"> - <tr> - <td> - <para style="terp_default_Centre_8">[[ str(line2.sequence) ]]</para> - </td> - <td> - <para style="terp_default_Centre_8">[[ line2.name ]]</para> - </td> - <td> - <para style="terp_default_Centre_8">[[ (line2.workcenter_id and line2.workcenter_id.name) or '' ]]</para> - </td> - <td> - <para style="terp_default_Centre_8">[[ formatLang(line2.cycle) ]]</para> - </td> - <td> - <para style="terp_default_Centre_8">[[ formatLang(line2.hour) ]]</para> - </td> - </tr> - </blockTable> - <para style="terp_default_2"> - <font color="white"> </font> - </para> - </section> - <para style="terp_default_8"> - <font color="white"> </font> - </para> - <para style="terp_default_Bold_9"><b>Bill Of Material </b></para> - <para style="terp_default_8"> - <font color="white"> </font> - </para> - <blockTable colWidths="256.0,61.0,107.0,104.0" style="Table8"> - <tr> - <td> - <para style="terp_tblheader_Details"><b>Product </b></para> - </td> - <td> - <para style="terp_tblheader_Details_Centre"><b>Quantity</b></para> - </td> - <td> - <para style="terp_tblheader_Details_Centre"><b>Source Location</b></para> - </td> - <td> - <para style="terp_tblheader_Details_Centre"><b>Destination Location</b></para> - </td> - </tr> - </blockTable> - <section> - <para style="terp_default_Bold_9"><b>Products to Consume [[ o.move_lines ==[] and removeParentNode('section')]]</b></para> - <section> - <para style="terp_default_2">[[ repeatIn(o.move_lines,'line') ]]</para> - <blockTable colWidths="250.0,65.0,108.0,104.0" style="Table9"> - <tr> - <td> - <para style="terp_default_9">[[ (line.product_id and line.product_id.code) or '' ]] [[ (line.product_id and line.product_id.name) or '' ]]</para> - </td> - <td> - <para style="terp_default_Right_9">[[ formatLang( line.product_qty) ]] [[ (line.product_uom and line.product_uom.name) or '']] </para> - </td> - <td> - <para style="terp_default_Centre_9">[[ (line.location_id and line.location_id.name) or '' ]]</para> - </td> - <td> - <para style="terp_default_Centre_9">[[ (line.location_dest_id and line.location_dest_id.name) or '' ]]</para> - </td> - </tr> - </blockTable> - </section> - </section> - <section> - <para style="terp_default_Bold_9"> - <font color="white"> </font> - </para> - <para style="terp_default_Bold_9"><b>Consumed Products [[ o.move_lines2 ==[] and removeParentNode('section')]]</b></para> - <section> - <para style="terp_default_2">[[ repeatIn(o.move_lines2,'line2') ]]</para> - <blockTable colWidths="251.0,66.0,106.0,104.0" style="Table10"> - <tr> - <td> - <para style="terp_default_9">[[ (line2.product_id and line2.product_id.code) or '' ]] [[ (line2.product_id and line2.product_id.name) or '' ]]</para> - </td> - <td> - <para style="terp_default_Right_9">[[ formatLang( line2.product_qty) ]] [[ (line2.product_uom and line2.product_uom.name) or '']] </para> - </td> - <td> - <para style="terp_default_Centre_9">[[ (line2.location_id and line2.location_id.name) or '' ]]</para> - </td> - <td> - <para style="terp_default_Centre_9">[[ (line2.location_dest_id and line2.location_dest_id.name) or '' ]]</para> - </td> - </tr> - </blockTable> - </section> - <para style="terp_default_2"> - <font color="white"> </font> - </para> - </section> - </pto> - </story> -</document>
\ No newline at end of file diff --git a/addons/mrp/test/order_process.yml b/addons/mrp/test/order_process.yml index c4050208570..9fa13bbf33d 100644 --- a/addons/mrp/test/order_process.yml +++ b/addons/mrp/test/order_process.yml @@ -225,30 +225,6 @@ assert line.product_id.id == wc.product_id.id, "Product is not correspond." assert line.product_uom_id.id == wc.product_id.uom_id.id, "UOM is not correspond." - - I print a "BOM Structure". -- - !context - uid: 'res_users_mrp_user' -- - !python {model: mrp.production}: | - import os - import openerp.report - from openerp import tools - order = self.browse(cr, uid, ref("mrp_production_test1")) - data, format = openerp.report.render_report(cr, uid, [order.bom_id.id], 'bom.structure', {}, {}) - if tools.config['test_report_directory']: - file(os.path.join(tools.config['test_report_directory'], 'mrp-bom_structure_report.'+format), 'wb+').write(data) -- - I print "Production Order". -- - !python {model: mrp.production}: | - import os - import openerp.report - from openerp import tools - data, format = openerp.report.render_report(cr, uid, [ref("mrp_production_test1")], 'mrp.production.order', {}, {}) - if tools.config['test_report_directory']: - file(os.path.join(tools.config['test_report_directory'], 'mrp-production_order_report.'+format), 'wb+').write(data) -- I print "Work Center Load Report". - !python {model: mrp.workcenter}: | diff --git a/addons/mrp/views/report_mrpbomstructure.xml b/addons/mrp/views/report_mrpbomstructure.xml new file mode 100644 index 00000000000..ae5469dbc17 --- /dev/null +++ b/addons/mrp/views/report_mrpbomstructure.xml @@ -0,0 +1,55 @@ +<?xml version="1.0" encoding="utf-8"?> +<openerp> +<data> +<template id="report_mrpbomstructure"> + <t t-call="report.html_container"> + <t t-call="report.internal_layout"> + <div class="page"> + <h2>BOM Structure</h2> + + <table class="table table-condensed"> + <thead> + <tr> + <th>BOM Name</th> + <th>Product Name</th> + <th>Quantity</th> + <th>BOM Ref</th> + </tr> + </thead> + <tbody> + <t t-foreach="docs" t-as="o"> + <tr style="font-weight: bold;"> + <td><span t-field="o.name"/></td> + <td><span t-field="o.product_id.default_code"/><span t-field="o.product_id.name"/></td> + <td> + <span t-field="o.product_qty"/> + <span groups="product.group_uom" t-field="o.product_uom.name"/> + </td> + <td><span t-field="o.code"/></td> + </tr> + <tr t-foreach="get_children(o.bom_lines)" t-as="l"> + <td> + <span style="color: white;" t-esc="'... '*(l['level'])"/> + - <span t-esc="l['name']"/> + </td> + <td> + [ <span t-esc="l['pcode']"/> ] + <span t-esc="l['pname']"/> + </td> + <td> + <span t-esc="formatLang(l['pqty'])"/> + <span t-esc="l['uname']" groups="product.group_uom"/> + </td> + <td> + <span t-esc="l['code']"/> + </td> + </tr> + </t> + </tbody> + </table> + </div> + </t> + </t> +</template> +</data> +</openerp> diff --git a/addons/mrp/views/report_mrporder.xml b/addons/mrp/views/report_mrporder.xml new file mode 100644 index 00000000000..3aa77ba1222 --- /dev/null +++ b/addons/mrp/views/report_mrporder.xml @@ -0,0 +1,135 @@ +<?xml version="1.0" encoding="utf-8"?> +<openerp> +<data> +<template id="report_mrporder"> + <t t-call="report.html_container"> + <t t-foreach="docs" t-as="o"> + <t t-call="report.internal_layout"> + <div class="page"> + <div class="oe_structure"/> + <h2>Production Order N° : <span t-field="o.name"/></h2> + + <div class="row mt32 mb32"> + <div class="col-xs-3"> + <strong>Source Document:</strong><br/> + <span t-field="o.origin"/> + </div> + <div class="col-xs-3"> + <strong>Product:</strong><br/> + <span t-field="o.product_id.code"/> + <span t-field="o.product_id.name"/> + </div> + <div class="col-xs-3"> + <strong>Quantity:</strong><br/> + <span t-field="o.product_qty"/> + <span t-field="o.product_uom.name" groups="product.group_uom"/> + </div> + </div> + + <div class="row mt32 mb32"> + <div class="col-xs-3"> + <strong>Scheduled Date:</strong><br/> + <span t-field="o.date_planned"/> + </div> + <div class="col-xs-3"> + <strong>Printing date:</strong><br/> + <span t-esc="time.strftime('%Y-%m-%d')"/> + </div> + <div class="col-xs-3" t-if="'sale_ref' in o._columns.keys()"> + <strong>Partner Ref:</strong><br/> + <span t-esc="'sale_ref' in o._columns.keys() and o.sale_ref"/> + </div> + <div class="col-xs-3" t-if="'sale_name' in o._columns.keys()"> + <strong>SO Number:</strong><br/> + <span t-esc="'sale_name' in o._columns.keys() and o.sale_name"/> + </div> + </div> + + <div t-if="o.workcenter_lines"> + <strong>Work Orders</strong> + <table class="table table-condensed"> + <tr> + <td class="text-center"><strong>Sequence</strong></td> + <td class="text-center"><strong>Name</strong></td> + <td class="text-center"><strong>WorkCenter</strong></td> + <td class="text-center"><strong>No. Of Cycles</strong></td> + <td class="text-center"><strong>No. Of Hours</strong></td> + </tr> + <tr t-foreach="o.workcenter_lines" t-as="line2"> + <td class="text-center"><span t-field="line2.sequence"/></td> + <td class="text-center"><span t-field="line2.name"/></td> + <td class="text-center"><span t-field="line2.workcenter_id.name"/></td> + <td class="text-center"><span t-field="line2.cycle"/></td> + <td class="text-center"><span t-field="line2.hour"/></td> + </tr> + </table> + </div> + + <h3 t-if="o.move_lines">Bill Of Material</h3> + + <table class="table table-condensed" t-if="o.move_lines or o.move_lines2"> + <thead> + <tr> + <th><strong>Product</strong></th> + <th class="text-right"><strong>Quantity</strong></th> + <th class="text-center" groups="stock.group_locations"> + <strong>Source Location</strong> + </th> + <th class="text-center" groups="stock.group_locations"> + <strong>Destination Location</strong> + </th> + </tr> + </thead> + <tbody> + <t t-if="o.move_lines"> + <tr> + <td colspan="4"><strong>Products to Consume</strong></td> + </tr> + <tr t-foreach="o.move_lines" t-as="line"> + <td> + <span t-field="line.product_id.code"/> + <span t-field="line.product_id.name"/> + </td> + <td class="text-right"> + <span t-field="line.product_qty"/> + <span t-field="line.product_uom.name" groups="product.group_uom"/> + </td> + <td class="text-center" groups="stock.group_locations"> + <span t-field="line.location_id.name"/> + </td> + <td class="text-center" groups="stock.group_locations"> + <span t-field="line.location_dest_id.name"/> + </td> + </tr> + </t> + <t t-if="o.move_lines2"> + <tr> + <td colspan="4"><strong>Consumed Products</strong></td> + </tr> + <tr t-foreach="o.move_lines2" t-as="line2">> + <td> + <span t-field="line2.product_id.code"/> + <span t-field="line2.product_id.name"/> + </td> + <td class="text-right"> + <span t-field="line2.product_qty"/> + <span t-field="line2.product_uom.name"/> + </td> + <td class="text-center" groups="stock.group_locations"> + <span t-field="line2.location_id.name"/> + </td> + <td class="text-center" groups="stock.group_locations"> + <span t-field="line2.location_dest_id.name"/> + </td> + </tr> + </t> + </tbody> + </table> + <div class="oe_structure"/> + </div> + </t> + </t> + </t> +</template> +</data> +</openerp> diff --git a/addons/mrp_repair/__init__.py b/addons/mrp_repair/__init__.py index 9727c3d05e9..388c5d2b72a 100644 --- a/addons/mrp_repair/__init__.py +++ b/addons/mrp_repair/__init__.py @@ -21,7 +21,5 @@ import mrp_repair import wizard -import report # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: - diff --git a/addons/mrp_repair/__openerp__.py b/addons/mrp_repair/__openerp__.py index a274cbc3ef4..c929ee2f43e 100644 --- a/addons/mrp_repair/__openerp__.py +++ b/addons/mrp_repair/__openerp__.py @@ -50,6 +50,8 @@ The following topics should be covered by this module: 'mrp_repair_view.xml', 'mrp_repair_workflow.xml', 'mrp_repair_report.xml', + + 'views/report_mrprepairorder.xml', ], 'demo': ['mrp_repair_demo.yml'], 'test': ['test/mrp_repair_users.yml', @@ -57,7 +59,6 @@ The following topics should be covered by this module: 'test/test_mrp_repair_b4inv.yml', 'test/test_mrp_repair_afterinv.yml', 'test/test_mrp_repair_cancel.yml', - 'test/mrp_repair_report.yml' ], 'installable': True, 'auto_install': False, diff --git a/addons/mrp_repair/mrp_repair_report.xml b/addons/mrp_repair/mrp_repair_report.xml index a28067609cd..3fd607ead90 100644 --- a/addons/mrp_repair/mrp_repair_report.xml +++ b/addons/mrp_repair/mrp_repair_report.xml @@ -1,12 +1,13 @@ <?xml version="1.0" encoding="utf-8"?> <openerp> <data> - <report - id="report_mrp_repair" - string="Quotation / Order" - model="mrp.repair" - name="repair.order" - rml="mrp_repair/report/order.rml" - auto="False"/> + <report + string="Quotation / Order" + id="action_report_mrp_repair_order" + model="mrp.repair" + name="mrp_repair.report_mrprepairorder" + file="mrp_repair.report_mrprepairorder" + report_type="qweb-pdf" + /> </data> </openerp> diff --git a/addons/mrp_repair/report/__init__.py b/addons/mrp_repair/report/__init__.py deleted file mode 100644 index d7659b7fc65..00000000000 --- a/addons/mrp_repair/report/__init__.py +++ /dev/null @@ -1,25 +0,0 @@ -# -*- coding: utf-8 -*- -############################################################################## -# -# OpenERP, Open Source Management Solution -# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>). -# -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU Affero General Public License as -# published by the Free Software Foundation, either version 3 of the -# License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Affero General Public License for more details. -# -# You should have received a copy of the GNU Affero General Public License -# along with this program. If not, see <http://www.gnu.org/licenses/>. -# -############################################################################## - -import order - -# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: - diff --git a/addons/mrp_repair/report/order.py b/addons/mrp_repair/report/order.py deleted file mode 100644 index 818a55f0070..00000000000 --- a/addons/mrp_repair/report/order.py +++ /dev/null @@ -1,45 +0,0 @@ -# -*- coding: utf-8 -*- -############################################################################## -# -# OpenERP, Open Source Management Solution -# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>). -# -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU Affero General Public License as -# published by the Free Software Foundation, either version 3 of the -# License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Affero General Public License for more details. -# -# You should have received a copy of the GNU Affero General Public License -# along with this program. If not, see <http://www.gnu.org/licenses/>. -# -############################################################################## - -import time -from openerp.report import report_sxw - -class order(report_sxw.rml_parse): - def __init__(self, cr, uid, name, context): - super(order, self).__init__(cr, uid, name, context=context) - self.localcontext.update({ - 'time': time, - 'total': self.total, - }) - - def total(self, repair): - total = 0.0 - for operation in repair.operations: - total += operation.price_subtotal - for fee in repair.fees_lines: - total += fee.price_subtotal - total = total + repair.amount_tax - return total - -report_sxw.report_sxw('report.repair.order','mrp.repair','addons/mrp_repair/report/order.rml',parser=order) - -# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: - diff --git a/addons/mrp_repair/report/order.rml b/addons/mrp_repair/report/order.rml deleted file mode 100644 index 202ed6e4684..00000000000 --- a/addons/mrp_repair/report/order.rml +++ /dev/null @@ -1,405 +0,0 @@ -<?xml version="1.0"?> -<document filename="test.pdf"> - <template title="Repair" author="OpenERP S.A. (sales@openerp.com)" allowSplitting="20"> - <pageTemplate id="first"> - <frame id="first" x1="15.0" y1="42.0" width="539" height="758"/> - </pageTemplate> - </template> - <stylesheet> - <blockTableStyle id="Standard_Outline"> - <blockAlignment value="LEFT"/> - <blockValign value="TOP"/> - </blockTableStyle> - <blockTableStyle id="Table1"> - <blockAlignment value="LEFT"/> - <blockValign value="TOP"/> - </blockTableStyle> - <blockTableStyle id="Table2"> - <blockAlignment value="LEFT"/> - <blockValign value="TOP"/> - <lineStyle kind="LINEBEFORE" colorName="#e6e6e6" start="0,0" stop="0,-1"/> - <lineStyle kind="LINEABOVE" colorName="#e6e6e6" start="0,0" stop="0,0"/> - <lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="0,-1" stop="0,-1"/> - <lineStyle kind="LINEBEFORE" colorName="#e6e6e6" start="1,0" stop="1,-1"/> - <lineStyle kind="LINEABOVE" colorName="#e6e6e6" start="1,0" stop="1,0"/> - <lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="1,-1" stop="1,-1"/> - <lineStyle kind="LINEBEFORE" colorName="#e6e6e6" start="2,0" stop="2,-1"/> - <lineStyle kind="LINEABOVE" colorName="#e6e6e6" start="2,0" stop="2,0"/> - <lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="2,-1" stop="2,-1"/> - <lineStyle kind="LINEBEFORE" colorName="#e6e6e6" start="3,0" stop="3,-1"/> - <lineStyle kind="LINEAFTER" colorName="#e6e6e6" start="3,0" stop="3,-1"/> - <lineStyle kind="LINEABOVE" colorName="#e6e6e6" start="3,0" stop="3,0"/> - <lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="3,-1" stop="3,-1"/> - </blockTableStyle> - <blockTableStyle id="Table3"> - <blockAlignment value="LEFT"/> - <blockValign value="TOP"/> - <lineStyle kind="LINEBEFORE" colorName="#e6e6e6" start="0,0" stop="0,-1"/> - <lineStyle kind="LINEABOVE" colorName="#e6e6e6" start="0,0" stop="0,0"/> - <lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="0,-1" stop="0,-1"/> - <lineStyle kind="LINEBEFORE" colorName="#e6e6e6" start="1,0" stop="1,-1"/> - <lineStyle kind="LINEABOVE" colorName="#e6e6e6" start="1,0" stop="1,0"/> - <lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="1,-1" stop="1,-1"/> - <lineStyle kind="LINEBEFORE" colorName="#e6e6e6" start="2,0" stop="2,-1"/> - <lineStyle kind="LINEABOVE" colorName="#e6e6e6" start="2,0" stop="2,0"/> - <lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="2,-1" stop="2,-1"/> - <lineStyle kind="LINEBEFORE" colorName="#e6e6e6" start="3,0" stop="3,-1"/> - <lineStyle kind="LINEAFTER" colorName="#e6e6e6" start="3,0" stop="3,-1"/> - <lineStyle kind="LINEABOVE" colorName="#e6e6e6" start="3,0" stop="3,0"/> - <lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="3,-1" stop="3,-1"/> - </blockTableStyle> - <blockTableStyle id="Table4"> - <blockAlignment value="LEFT"/> - <blockValign value="TOP"/> - <lineStyle kind="LINEBELOW" colorName="#000000" start="0,-1" stop="0,-1"/> - <lineStyle kind="LINEBELOW" colorName="#000000" start="1,-1" stop="1,-1"/> - <lineStyle kind="LINEBELOW" colorName="#000000" start="2,-1" stop="2,-1"/> - <lineStyle kind="LINEBELOW" colorName="#000000" start="3,-1" stop="3,-1"/> - <lineStyle kind="LINEBELOW" colorName="#000000" start="4,-1" stop="4,-1"/> - </blockTableStyle> - <blockTableStyle id="Table5"> - <blockAlignment value="LEFT"/> - <blockValign value="TOP"/> - <lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="0,-1" stop="0,-1"/> - <lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="1,-1" stop="1,-1"/> - <lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="2,-1" stop="2,-1"/> - <lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="3,-1" stop="3,-1"/> - <lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="4,-1" stop="4,-1"/> - <lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="5,-1" stop="5,-1"/> - </blockTableStyle> - <blockTableStyle id="Table6"> - <blockAlignment value="LEFT"/> - <blockValign value="TOP"/> - <lineStyle kind="LINEBELOW" colorName="#cccccc" start="0,-1" stop="0,-1"/> - <lineStyle kind="LINEBELOW" colorName="#cccccc" start="1,-1" stop="1,-1"/> - <lineStyle kind="LINEBELOW" colorName="#cccccc" start="2,-1" stop="2,-1"/> - <lineStyle kind="LINEBELOW" colorName="#cccccc" start="3,-1" stop="3,-1"/> - <lineStyle kind="LINEBELOW" colorName="#cccccc" start="4,-1" stop="4,-1"/> - <lineStyle kind="LINEBELOW" colorName="#cccccc" start="5,-1" stop="5,-1"/> - </blockTableStyle> - <blockTableStyle id="Table9"> - <blockAlignment value="LEFT"/> - <blockValign value="TOP"/> - <lineStyle kind="LINEABOVE" colorName="#000000" start="1,0" stop="1,0"/> - <lineStyle kind="LINEABOVE" colorName="#000000" start="2,0" stop="2,0"/> - <lineStyle kind="LINEABOVE" colorName="#000000" start="3,0" stop="3,0"/> - <lineStyle kind="LINEABOVE" colorName="#000000" start="1,2" stop="1,2"/> - <lineStyle kind="LINEABOVE" colorName="#000000" start="2,2" stop="2,2"/> - <lineStyle kind="LINEABOVE" colorName="#000000" start="3,2" stop="3,2"/> - </blockTableStyle> - <blockTableStyle id="Table8"> - <blockAlignment value="LEFT"/> - <blockValign value="TOP"/> - </blockTableStyle> - <initialize> - <paraStyle name="all" alignment="justify"/> - </initialize> - <paraStyle name="P1" fontName="Helvetica" fontSize="9.0" leading="11" alignment="CENTER" spaceBefore="0.0" spaceAfter="0.0"/> - <paraStyle name="P2" fontName="Helvetica" fontSize="9.0" leading="11" alignment="RIGHT" spaceBefore="0.0" spaceAfter="0.0"/> - <paraStyle name="P3" fontName="Helvetica" fontSize="9.0" leading="11" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/> - <paraStyle name="P4" fontName="Helvetica-Oblique" fontSize="7.0" leading="9" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/> - <paraStyle name="P5" fontName="Helvetica-Bold" fontSize="9.0" leading="11" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/> - <paraStyle name="P6" fontName="Helvetica" fontSize="9.0" leading="11" alignment="CENTER" spaceBefore="0.0" spaceAfter="0.0"/> - <paraStyle name="P7" fontName="Helvetica" fontSize="8.0" leading="10" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/> - <paraStyle name="P8" fontName="Helvetica-Bold" fontSize="15.0" leading="19" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/> - <paraStyle name="P9" fontName="Helvetica-Bold" fontSize="15.0" leading="19" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/> - <paraStyle name="P10" fontName="Helvetica-Bold" fontSize="5.0" leading="7" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/> - <paraStyle name="P11" fontName="Helvetica-Bold" fontSize="7.0" leading="9" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/> - <paraStyle name="P12" fontName="Helvetica" fontSize="8.0" leading="10" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/> - <paraStyle name="P13" fontName="Helvetica-Bold" fontSize="9.0" leading="11" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/> - <paraStyle name="P14" fontName="Helvetica-Bold" fontSize="10.0" leading="13" alignment="CENTER" spaceBefore="6.0" spaceAfter="6.0"/> - <paraStyle name="P15" fontName="Helvetica-Bold" fontSize="8.0" leading="10" alignment="CENTER" spaceBefore="6.0" spaceAfter="6.0"/> - <paraStyle name="P16" fontName="Helvetica" fontSize="8.0" leading="10" alignment="CENTER" spaceBefore="0.0" spaceAfter="0.0"/> - <paraStyle name="P17" fontName="Helvetica-Bold" fontSize="10.0" leading="13" alignment="CENTER" spaceBefore="6.0" spaceAfter="6.0"/> - <paraStyle name="P18" fontName="Helvetica-Bold" fontSize="10.0" leading="13" alignment="CENTER" spaceBefore="6.0" spaceAfter="6.0"/> - <paraStyle name="P19" fontName="Helvetica-Bold" fontSize="10.0" leading="13" alignment="RIGHT" spaceBefore="6.0" spaceAfter="6.0"/> - <paraStyle name="P20" fontName="Helvetica" fontSize="9.0" leading="11" alignment="CENTER" spaceBefore="0.0" spaceAfter="0.0"/> - <paraStyle name="P21" fontName="Helvetica-Oblique" fontSize="2.0" leading="3" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/> - <paraStyle name="P22" fontName="Helvetica-Oblique" fontSize="2.0" leading="3"/> - <paraStyle name="P23" fontName="Helvetica-Bold" fontSize="9.0" leading="11"/> - <paraStyle name="P24" fontName="Helvetica"/> - <paraStyle name="P25" fontName="Helvetica-Bold" fontSize="9.0" leading="11" alignment="RIGHT"/> - <paraStyle name="P26" fontName="Helvetica" fontSize="9.0" leading="11" alignment="RIGHT"/> - <paraStyle name="P27" fontName="Helvetica" fontSize="9.0" leading="11" alignment="RIGHT"/> - <paraStyle name="P28" fontName="Helvetica-Bold" fontSize="9.0" leading="11" alignment="RIGHT"/> - <paraStyle name="P29" fontName="Helvetica-Bold" fontSize="9.0" leading="11" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/> - <paraStyle name="P30" fontName="Helvetica" fontSize="2.0" leading="3" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/> - <paraStyle name="Standard" fontName="Times-Roman"/> - <paraStyle name="Text body" fontName="Times-Roman" spaceBefore="0.0" spaceAfter="6.0"/> - <paraStyle name="Heading" fontName="Helvetica" fontSize="8.0" leading="10" spaceBefore="12.0" spaceAfter="6.0"/> - <paraStyle name="List" fontName="Helvetica" spaceBefore="0.0" spaceAfter="6.0"/> - <paraStyle name="Table Contents" fontName="Times-Roman"/> - <paraStyle name="Table Heading" fontName="Times-Roman" alignment="CENTER"/> - <paraStyle name="Caption" fontName="Times-Roman" fontSize="12.0" leading="15" spaceBefore="6.0" spaceAfter="6.0"/> - <paraStyle name="Index" fontName="Times-Roman"/> - <paraStyle name="terp_header" fontName="Helvetica-Bold" fontSize="15.0" leading="19" alignment="LEFT" spaceBefore="12.0" spaceAfter="6.0"/> - <paraStyle name="terp_default_8" fontName="Helvetica" fontSize="8.0" leading="10" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/> - <paraStyle name="terp_default_Bold_8" fontName="Helvetica-Bold" fontSize="8.0" leading="10" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/> - <paraStyle name="terp_default_Bold_9" fontName="Helvetica-Bold" fontSize="9.0" leading="11" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/> - <paraStyle name="terp_default_9" fontName="Helvetica" fontSize="9.0" leading="11" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/> - <paraStyle name="terp_tblheader_General" fontName="Helvetica-Bold" fontSize="8.0" leading="10" alignment="LEFT" spaceBefore="6.0" spaceAfter="6.0"/> - <paraStyle name="terp_tblheader_General_Centre" fontName="Helvetica-Bold" fontSize="8.0" leading="10" alignment="CENTER" spaceBefore="6.0" spaceAfter="6.0"/> - <paraStyle name="terp_default_Centre_8" fontName="Helvetica" fontSize="8.0" leading="10" alignment="CENTER" spaceBefore="0.0" spaceAfter="0.0"/> - <paraStyle name="terp_tblheader_Details" fontName="Helvetica-Bold" fontSize="10.0" leading="13" alignment="LEFT" spaceBefore="6.0" spaceAfter="6.0"/> - <paraStyle name="Footer" fontName="Times-Roman"/> - <paraStyle name="Horizontal Line" fontName="Times-Roman" fontSize="6.0" leading="8" spaceBefore="0.0" spaceAfter="14.0"/> - <paraStyle name="Heading 9" fontName="Helvetica-Bold" fontSize="75%" leading="NaN" spaceBefore="12.0" spaceAfter="6.0"/> - <paraStyle name="terp_tblheader_General_Right" fontName="Helvetica-Bold" fontSize="8.0" leading="10" alignment="RIGHT" spaceBefore="6.0" spaceAfter="6.0"/> - <paraStyle name="terp_tblheader_Details_Centre" fontName="Helvetica-Bold" fontSize="10.0" leading="13" alignment="CENTER" spaceBefore="6.0" spaceAfter="6.0"/> - <paraStyle name="terp_tblheader_Details_Right" fontName="Helvetica-Bold" fontSize="10.0" leading="13" alignment="RIGHT" spaceBefore="6.0" spaceAfter="6.0"/> - <paraStyle name="terp_default_Right_8" fontName="Helvetica" fontSize="8.0" leading="10" alignment="RIGHT" spaceBefore="0.0" spaceAfter="0.0"/> - <paraStyle name="terp_header_Right" fontName="Helvetica-Bold" fontSize="15.0" leading="19" alignment="LEFT" spaceBefore="12.0" spaceAfter="6.0"/> - <paraStyle name="terp_header_Centre" fontName="Helvetica-Bold" fontSize="15.0" leading="19" alignment="CENTER" spaceBefore="12.0" spaceAfter="6.0"/> - <paraStyle name="terp_default_address" fontName="Helvetica" fontSize="10.0" leading="13" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/> - <paraStyle name="terp_default_Centre_9" fontName="Helvetica" fontSize="9.0" leading="11" alignment="CENTER" spaceBefore="0.0" spaceAfter="0.0"/> - <paraStyle name="terp_default_Right_9" fontName="Helvetica" fontSize="9.0" leading="11" alignment="RIGHT" spaceBefore="0.0" spaceAfter="0.0"/> - <paraStyle name="terp_default_1" fontName="Helvetica" fontSize="2.0" leading="3" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/> - <paraStyle name="terp_default_Italic" fontName="Helvetica-Oblique" fontSize="8.0" leading="10" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/> - <paraStyle name="Preformatted Text" fontName="Times-Roman" fontSize="10.0" leading="13" spaceBefore="0.0" spaceAfter="0.0"/> - <paraStyle name="terp_default_right_bold_9" fontName="Helvetica-Bold" fontSize="9.0" leading="11" alignment="RIGHT" spaceBefore="0.0" spaceAfter="0.0"/> - <paraStyle name="terp_default_centre_9_bold" fontName="Helvetica-Bold" fontSize="9.0" leading="11" alignment="CENTER" spaceBefore="0.0" spaceAfter="0.0"/> - </stylesheet> - <images/> - <story> - <pto> - <pto_header> - <blockTable colWidths="254.0,100.0,60.0,60.0,60.0" repeatRows="1" style="Table4"> - <tr> - <td> - <para style="terp_tblheader_Details">Description</para> - </td> - <td> - <para style="terp_tblheader_Details_Centre">Tax</para> - </td> - <td> - <para style="terp_tblheader_Details_Right">Quantity</para> - </td> - <td> - <para style="terp_tblheader_Details_Right">Unit Price</para> - </td> - <td> - <para style="terp_tblheader_Details_Right">Price</para> - </td> - </tr> - </blockTable> - </pto_header> - <para style="P12">[[ repeatIn(objects,'o') ]]</para> - <blockTable colWidths="265.0,51.0,225.0" style="Table1"> - <tr> - <td> - <para style="P5">Shipping address :</para> - <para style="P3">[[ o.partner_id.name ]]</para> - <para style="P3">[[ o.address_id and display_address(o.address_id) ]] </para> - <para style="P3"> - <font color="white"> </font> - </para> - <para style="P13">Invoice address :</para> - <para style="P3">[[ o.partner_id and o.partner_id.property_payment_term.name ]]</para> - <para style="P3">[[ o.partner_invoice_id and display_address(o.partner_invoice_id) ]] </para> - </td> - <td> - <para style="P12"> - <font color="white"> </font> - </para> - </td> - <td> - <para style="P3">[[ o.partner_id.name or removeParentNode('para') ]]</para> - <para style="P3">[[ o.default_address_id and display_address(o.default_address_id) ]] </para> - <para style="P3"> - <font color="white"> </font> - </para> - <para style="P3"> - <font color="white"> </font> - </para> - <para style="P3"> - <font color="white"> </font> - </para> - <para style="P3"> - <font color="white"> </font> - </para> - </td> - </tr> - </blockTable> - <para style="P12"> - <font color="white"> </font> - </para> - <para style="P10"> - <font color="white"> </font> - </para> - <para style="P8">[[ o.state<>'draft' and removeParentNode('para') ]]Repair Quotation <font face="Helvetica">N° : [[ o.name ]]</font></para> - <para style="P9">[[ o.state=='draft' and removeParentNode('para') ]]Repair Order N° : [[ o.name ]]</para> - <para style="P11"> - <font color="white"> </font> - </para> - <para style="P7"> - <font color="white"> </font> - </para> - <blockTable colWidths="130.0,136.0,136.0,136.0" style="Table2"> - <tr> - <td> - <para style="P15">Product to Repair </para> - </td> - <td> - <para style="P15">Lot Number</para> - </td> - <td> - <para style="P15">Guarantee Limit </para> - </td> - <td> - <para style="P15">Printing Date</para> - </td> - </tr> - </blockTable> - <blockTable colWidths="130.0,136.0,136.0,136.0" style="Table3"> - <tr> - <td> - <para style="P16">[[ o.product_id.name or '' ]]</para> - </td> - <td> - <para style="P16">[[ o.prodlot_id.name or ' ' ]]</para> - </td> - <td> - <para style="P16">[[ formatLang(o.guarantee_limit,date = True) ]]</para> - </td> - <td> - <para style="P16">[[ formatLang(time.strftime('%Y-%m-%d'),date = True)]] </para> - </td> - </tr> - </blockTable> - <para style="P12"> - <font color="white"> </font> - </para> - <para style="P12"> - <font color="white"> </font> - </para> - <blockTable colWidths="254.0,100.0,60.0,60.0,60.0" repeatRows="1" style="Table4"> - <tr> - <td> - <para style="terp_tblheader_Details">Description</para> - </td> - <td> - <para style="terp_tblheader_Details_Centre">Tax</para> - </td> - <td> - <para style="terp_tblheader_Details_Right">Quantity</para> - </td> - <td> - <para style="terp_tblheader_Details_Right">Unit Price</para> - </td> - <td> - <para style="terp_tblheader_Details_Right">Price</para> - </td> - </tr> - </blockTable> - <para style="P29">Operation Line(s)</para> - <section> - <para style="P30"><font color="white">[[ repeatIn(o.operations,'line') ]] </font></para> - <para style="P29">[[ (not line) and removeParentNode('section') ]]</para> - <blockTable colWidths="254.0,100.0,60.0,60.0,60.0" style="Table5">[[ (line.to_invoice==True) or removeParentNode('blockTable') ]] - <tr> - <td> - <para style="terp_default_9"><font face="Helvetica-Oblique" size="8.0">(Add) [[ ((line.type == 'add') or removeParentNode('para')) and '' ]]</font><font> [[ line.name ]]</font></para> - <para style="terp_default_9"><font face="Helvetica-Oblique" size="8.0">(Remove) [[ ((line.type == 'remove') or removeParentNode('para')) and '' ]]</font><font> [[ line.name ]]</font></para> - </td> - <td> - <para style="terp_default_Centre_9">[[ ','.join(map( lambda x: x.name, line.tax_id)) ]]</para> - </td> - <td> - <para style="terp_default_Right_9">[[ formatLang(line.product_uom_qty) ]] [[ line.product_uom.name ]]</para> - - </td> - <td> - <para style="terp_default_Right_9">[[ formatLang(line.price_unit) ]] </para> - </td> - <td> - <para style="terp_default_Right_9">[[ formatLang(line.price_subtotal, currency_obj = o.pricelist_id.currency_id) ]]</para> - </td> - </tr> - </blockTable> - </section> - <para style="P29">Fees Line(s) [[ (o.fees_lines ==[] and removeParentNode('para') ) ]]</para> - <section> - <para style="P30"><font color="white">[[ repeatIn(o.fees_lines,'fees') ]]</font></para> - <para style="P29">[[ (not fees) and removeParentNode('section') ]]</para> - - <blockTable colWidths="254.0,100.0,60.0,60.0,60.0" style="Table6">[[ (fees.to_invoice==True) or removeParentNode('blockTable') ]] - <tr> - <td> - <para style="terp_default_9"><font>[[ fees.name ]]</font></para> - </td> - <td> - <para style="terp_default_Centre_9">[[ ','.join(map( lambda x: x.name, fees.tax_id)) ]]</para> - </td> - <td> - <para style="terp_default_Right_9">[[ formatLang(fees.product_uom_qty) ]] [[ fees.product_uom.name ]] </para> - </td> - <td> - <para style="terp_default_Right_9">[[ formatLang(fees.price_unit) ]]</para> - </td> - <td> - <para style="terp_default_Right_9">[[ formatLang(fees.price_subtotal, currency_obj = o.pricelist_id.currency_id) ]]</para> - </td> - </tr> - </blockTable> - </section> - <blockTable colWidths="404.0,67.0,64.0" style="Table9"> - <tr> - <td> - <para style="P28"> - <font color="white"> </font> - </para> - </td> - <td> - <para style="terp_default_9">Net Total :</para> - </td> - <td> - <para style="P26">[[ formatLang(o.amount_untaxed, dp='Sale Price', currency_obj=o.pricelist_id.currency_id) ]]</para> - </td> - - </tr> - <tr> - <td> - <para style="P28"> - <font color="white"> </font> - </para> - </td> - <td> - <para style="terp_default_9">Taxes:</para> - </td> - <td> - <para style="P26">[[ formatLang(o.amount_tax, dp='Account', currency_obj=o.pricelist_id.currency_id) ]]</para> - </td> - </tr> - <tr> - <td> - <para style="P28"> - <font color="white"> </font> - </para> - </td> - <td> - <para style="terp_tblheader_Details">Total :</para> - </td> - <td> - <para style="terp_default_right_bold_9">[[ formatLang(total(o), dp='Sale Price', currency_obj=o.pricelist_id.currency_id) ]]</para> - </td> - </tr> - </blockTable> - <para style="Standard"> - <font color="white"> </font> - </para> - <para style="Standard"> - <font color="white"> </font> - </para> - <blockTable colWidths="534.0" style="Table8"> - <tr> - <td> - <para style="P3">[[ format(o.quotation_notes or '') or removeParentNode('blockTable') ]]</para> - </td> - </tr> - </blockTable> - <para style="P24"> - <font color="white"> </font> - </para> - </pto> - </story> -</document> diff --git a/addons/mrp_repair/test/mrp_repair_report.yml b/addons/mrp_repair/test/mrp_repair_report.yml deleted file mode 100644 index 166ace684d3..00000000000 --- a/addons/mrp_repair/test/mrp_repair_report.yml +++ /dev/null @@ -1,10 +0,0 @@ -- - In order to test the PDF reports defined on a MRP Repair, we will print an Order Report -- - !python {model: mrp.repair}: | - import os - import openerp.report - from openerp import tools - data, format = openerp.report.render_report(cr, uid, [ref('mrp_repair.mrp_repair_rmrp0')], 'repair.order', {}, {}) - if tools.config['test_report_directory']: - file(os.path.join(tools.config['test_report_directory'], 'mrp_repair-order_report.'+format), 'wb+').write(data) diff --git a/addons/mrp_repair/views/report_mrprepairorder.xml b/addons/mrp_repair/views/report_mrprepairorder.xml new file mode 100644 index 00000000000..0ea3f22167c --- /dev/null +++ b/addons/mrp_repair/views/report_mrprepairorder.xml @@ -0,0 +1,155 @@ +<?xml version="1.0" encoding="utf-8"?> +<openerp> +<data> +<template id="report_mrprepairorder"> + <t t-call="report.html_container"> + <t t-foreach="docs" t-as="o"> + <t t-call="report.external_layout"> + <div class="page"> + <div class="oe_structure"/> + + <div class="row"> + <div class="col-xs-6"> + <p t-if="o.address_id == o.partner_invoice_id">Invoice and shipping address:</p> + <p t-if="o.address_id != o.partner_invoice_id">Invoice address: </p> + <div t-field="o.partner_invoice_id" + t-field-options='{"widget": "contact", "fields": ["address", "name", "phone", "fax"], "no_marker": true}'/> + <p t-if="o.partner_id.vat">VAT: <span t-field="o.partner_id.vat"/></p> + <div t-if="o.address_id != o.partner_invoice_id"> + <p>Shipping address :</p> + <div t-field="o.address_id" + t-field-options='{"widget": "contact", "fields": ["address", "name", "phone", "fax"], "no_marker": true}'/> + <p t-if="o.partner_id.vat">VAT: <span t-field="o.partner_id.vat"/></p> + </div> + </div> + <div class="col-xs-4 col-xs-offset-2"> + <div t-field="o.partner_id" + t-field-options='{"widget": "contact", "fields": ["address", "name"], "no_marker": true}' /> + </div> + </div> + + <h2> + <span t-if="o.state != 'draft'">Repair Order N°:</span> + <span t-if="o.state == 'draft'">Repair Quotation N°:</span> + <span t-field="o.name"/> + </h2> + + <div class="row mt32 mb32"> + <div t-if="o.product_id.name" class="col-xs-3"> + <strong>Product to Repair:</strong> + <p t-field="o.product_id.name"/> + </div> + <div class="col-xs-3" groups="stock.group_production_lot"> + <strong>Lot Number</strong> + <span t-field="o.prodlot_id.name"/> + </div> + <div t-if="o.guarantee_limit" class="col-xs-3"> + <strong>Guarantee Limit:</strong> + <p t-field="o.guarantee_limit"/> + </div> + <div class="col-xs-3"> + <strong>Printing Date:</strong> + <p t-esc="time.strftime('%Y-%m-%d')"/> + </div> + </div> + + <table class="table table-condensed"> + <thead> + <tr> + <th>Description</th> + <th class="text-center">Tax</th> + <th class="text-right">Quantity</th> + <th class="text-right">Unit Price</th> + <th class="text-right">Price</th> + </tr> + </thead> + <tbody> + <t t-if="o.operations"> + <tr><td colspan="5"><strong>Operation Line(s)</strong></td></tr> + <tr t-foreach="o.operations" t-as="line"> + <t t-if="(line.to_invoice is True)"> + <td> + <p t-if="line.type == 'add'"><i>(Add)</i> <span t-field="line.name" /></p> + <p t-if="line.type == 'remove'">(<i>Remove</i>) <span t-field="line.name"/></p> + </td> + <td class="text-center"> + <span t-esc="','.join(map( lambda x: x.name, line.tax_id))"/> + </td> + <td class="text-right"> + <span t-field="line.product_uom_qty"/> + <span groups="product.group_uom" t-field="line.product_uom.name"/> + </td> + <td class="text-right"> + <span t-field="line.price_unit"/> + </td> + <td class="text-right"> + <span t-field="line.price_subtotal" + t-field-options='{"widget": "monetary", "display_currency": "o.pricelist_id.currency_id"}'/> + </td> + </t> + </tr> + </t> + <t t-if="o.fees_lines"> + <tr><td colspan="5"><strong>Fees Line(s)</strong></td></tr> + <tr t-foreach="o.fees_lines" t-as="fees"> + <t t-if="fees.to_invoice is True"> + <td> + <span t-field="fees.name"/> + </td> + <td class="text-center"> + <span t-esc="','.join(map( lambda x: x.name, fees.tax_id))"/> + </td> + <td class="text-right"> + <span t-field="fees.product_uom_qty"/> + <span groups="product.group_uom" t-field="fees.product_uom.name"/> + </td> + <td class="text-right"> + <span t-field="fees.price_unit"/> + </td> + <td class="text-right"> + <span t-field="fees.price_subtotal" + t-field-options='{"widget": "monetary", "display_currency": "o.pricelist_id.currency_id"}'/> + </td> + </t> + </tr> + </t> + </tbody> + </table> + + <div class="row"> + <div class="col-xs-4 pull-right"> + <table class="table table-condensed"> + <tr class="border-black"> + <td><strong>Total Without Taxes</strong></td> + <td class="text-right"> + <span t-field="o.amount_untaxed" + t-field-options='{"widget": "monetary", "display_currency": "o.pricelist_id.currency_id"}'/> + </td> + </tr> + <tr> + <td>Taxes</td> + <td class="text-right"> + <span t-field="o.amount_tax" + t-field-options='{"widget": "monetary", "display_currency": "o.pricelist_id.currency_id"}'/> + </td> + </tr> + <tr class="border-black"> + <td><strong>Total</strong></td> + <td class="text-right"> + <span t-field="o.amount_total" + t-field-options='{"widget": "monetary", "display_currency": "o.pricelist_id.currency_id"}'/> + </td> + </tr> + </table> + </div> + </div> + + <p t-field="o.quotation_notes"/> + <div class="oe_structure"/> + </div> + </t> + </t> + </t> +</template> +</data> +</openerp> diff --git a/addons/purchase/__openerp__.py b/addons/purchase/__openerp__.py index 9d72579cc77..0d0a372a3d0 100644 --- a/addons/purchase/__openerp__.py +++ b/addons/purchase/__openerp__.py @@ -65,6 +65,9 @@ Dashboard / Reports for Purchase Management will include: 'board_purchase_view.xml', 'edi/purchase_order_action_data.xml', 'res_config_view.xml', + + 'views/report_purchaseorder.xml', + 'views/report_purchasequotation.xml', ], 'test': [ 'test/ui/purchase_users.yml', @@ -75,7 +78,6 @@ Dashboard / Reports for Purchase Management will include: 'test/process/merge_order.yml', 'test/process/edi_purchase_order.yml', 'test/process/invoice_on_poline.yml', - 'test/ui/print_report.yml', 'test/ui/duplicate_order.yml', 'test/ui/delete_order.yml', ], diff --git a/addons/purchase/purchase_report.xml b/addons/purchase/purchase_report.xml index a3a4a6a70b6..424a450cd9e 100644 --- a/addons/purchase/purchase_report.xml +++ b/addons/purchase/purchase_report.xml @@ -1,11 +1,22 @@ <?xml version="1.0" encoding="utf-8"?> <openerp> <data> - <report auto="False" id="report_purchase_quotation" model="purchase.order" - name="purchase.quotation" rml="purchase/report/request_quotation.rml" - string="Request for Quotation"/> - <report auto="False" id="report_purchase_order" model="purchase.order" - name="purchase.order" rml="purchase/report/order.rml" - usage="default" string="Purchase Order"/> + <report + string="Purchase Order" + id="action_report_purchase_order" + model="purchase.order" + report_type="qweb-pdf" + name="purchase.report_purchaseorder" + file="purchase.report_purchaseorder" + /> + + <report + string="Request for Quotation" + id="report_purchase_quotation" + model="purchase.order" + report_type="qweb-pdf" + name="purchase.report_purchasequotation" + file="purchase.report_purchasequotation" + /> </data> </openerp> diff --git a/addons/purchase/report/__init__.py b/addons/purchase/report/__init__.py index 65d4fb0bc65..0ec2c3ca9ef 100644 --- a/addons/purchase/report/__init__.py +++ b/addons/purchase/report/__init__.py @@ -19,8 +19,6 @@ # ############################################################################## -import order -import request_quotation import purchase_report # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/addons/purchase/report/order.py b/addons/purchase/report/order.py deleted file mode 100644 index 68d92970aa0..00000000000 --- a/addons/purchase/report/order.py +++ /dev/null @@ -1,33 +0,0 @@ -# -*- coding: utf-8 -*- -############################################################################## -# -# OpenERP, Open Source Management Solution -# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>). -# -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU Affero General Public License as -# published by the Free Software Foundation, either version 3 of the -# License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Affero General Public License for more details. -# -# You should have received a copy of the GNU Affero General Public License -# along with this program. If not, see <http://www.gnu.org/licenses/>. -# -############################################################################## - -import time -from openerp.report import report_sxw - -class order(report_sxw.rml_parse): - def __init__(self, cr, uid, name, context): - super(order, self).__init__(cr, uid, name, context=context) - self.localcontext.update({'time': time}) - -report_sxw.report_sxw('report.purchase.order','purchase.order','addons/purchase/report/order.rml',parser=order) - -# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: - diff --git a/addons/purchase/report/order.rml b/addons/purchase/report/order.rml deleted file mode 100644 index 6eb1b2167ee..00000000000 --- a/addons/purchase/report/order.rml +++ /dev/null @@ -1,319 +0,0 @@ -<?xml version="1.0"?> -<document filename="Purchase Order.pdf"> - <template title="Purchase Order" author="OpenERP S.A.(sales@openerp.com)" allowSplitting="20"> - <pageTemplate id="first"> - <frame id="first" x1="18.0" y1="42.0" width="535" height="758"/> - </pageTemplate> - </template> - <stylesheet> - <blockTableStyle id="Standard_Outline"> - <blockAlignment value="LEFT"/> - <blockValign value="TOP"/> - </blockTableStyle> - <blockTableStyle id="Tableau1"> - <blockAlignment value="LEFT"/> - <blockValign value="TOP"/> - </blockTableStyle> - <blockTableStyle id="Tableau2"> - <blockAlignment value="LEFT"/> - <blockValign value="TOP"/> - </blockTableStyle> - <blockTableStyle id="Header_Order_Reference_Tbl"> - <blockAlignment value="LEFT"/> - <blockValign value="TOP"/> - <lineStyle kind="LINEBEFORE" colorName="#e6e6e6" start="0,0" stop="0,-1"/> - <lineStyle kind="LINEABOVE" colorName="#e6e6e6" start="0,0" stop="0,0"/> - <lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="0,-1" stop="0,-1"/> - <lineStyle kind="LINEBEFORE" colorName="#e6e6e6" start="1,0" stop="1,-1"/> - <lineStyle kind="LINEABOVE" colorName="#e6e6e6" start="1,0" stop="1,0"/> - <lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="1,-1" stop="1,-1"/> - <lineStyle kind="LINEBEFORE" colorName="#e6e6e6" start="2,0" stop="2,-1"/> - <lineStyle kind="LINEABOVE" colorName="#e6e6e6" start="2,0" stop="2,0"/> - <lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="2,-1" stop="2,-1"/> - <lineStyle kind="LINEBEFORE" colorName="#e6e6e6" start="3,0" stop="3,-1"/> - <lineStyle kind="LINEAFTER" colorName="#e6e6e6" start="3,0" stop="3,-1"/> - <lineStyle kind="LINEABOVE" colorName="#e6e6e6" start="3,0" stop="3,0"/> - <lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="3,-1" stop="3,-1"/> - </blockTableStyle> - <blockTableStyle id="Content_Order_Reference_Table"> - <blockAlignment value="LEFT"/> - <blockValign value="TOP"/> - <lineStyle kind="LINEBEFORE" colorName="#e6e6e6" start="0,0" stop="0,-1"/> - <lineStyle kind="LINEABOVE" colorName="#e6e6e6" start="0,0" stop="0,0"/> - <lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="0,-1" stop="0,-1"/> - <lineStyle kind="LINEBEFORE" colorName="#e6e6e6" start="1,0" stop="1,-1"/> - <lineStyle kind="LINEABOVE" colorName="#e6e6e6" start="1,0" stop="1,0"/> - <lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="1,-1" stop="1,-1"/> - <lineStyle kind="LINEBEFORE" colorName="#e6e6e6" start="2,0" stop="2,-1"/> - <lineStyle kind="LINEABOVE" colorName="#e6e6e6" start="2,0" stop="2,0"/> - <lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="2,-1" stop="2,-1"/> - <lineStyle kind="LINEBEFORE" colorName="#e6e6e6" start="3,0" stop="3,-1"/> - <lineStyle kind="LINEAFTER" colorName="#e6e6e6" start="3,0" stop="3,-1"/> - <lineStyle kind="LINEABOVE" colorName="#e6e6e6" start="3,0" stop="3,0"/> - <lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="3,-1" stop="3,-1"/> - </blockTableStyle> - <blockTableStyle id="Table_Header_Pur_ord_Line"> - <blockAlignment value="LEFT"/> - <blockValign value="TOP"/> - <lineStyle kind="LINEBELOW" colorName="#000000" start="0,-1" stop="0,-1"/> - <lineStyle kind="LINEBELOW" colorName="#000000" start="1,-1" stop="1,-1"/> - <lineStyle kind="LINEBELOW" colorName="#000000" start="2,-1" stop="2,-1"/> - <lineStyle kind="LINEBELOW" colorName="#000000" start="3,-1" stop="3,-1"/> - <lineStyle kind="LINEBELOW" colorName="#000000" start="4,-1" stop="4,-1"/> - <lineStyle kind="LINEBELOW" colorName="#000000" start="5,-1" stop="5,-1"/> - </blockTableStyle> - <blockTableStyle id="Table_Order_Pur_line_Content"> - <blockAlignment value="LEFT"/> - <blockValign value="TOP"/> - <lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="0,-1" stop="0,-1"/> - <lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="1,-1" stop="1,-1"/> - <lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="2,-1" stop="2,-1"/> - <lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="3,-1" stop="3,-1"/> - <lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="4,-1" stop="4,-1"/> - <lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="5,-1" stop="5,-1"/> - <lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="0,-1" stop="0,-1"/> - <lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="1,-1" stop="1,-1"/> - <lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="2,-1" stop="2,-1"/> - <lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="3,-1" stop="3,-1"/> - <lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="4,-1" stop="4,-1"/> - <lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="5,-1" stop="5,-1"/> - </blockTableStyle> - <blockTableStyle id="Table_All_Total_Detail"> - <blockAlignment value="LEFT"/> - <blockValign value="TOP"/> - <lineStyle kind="LINEABOVE" colorName="#ffffff" start="0,0" stop="0,0"/> - <lineStyle kind="LINEABOVE" colorName="#000000" start="1,0" stop="1,0"/> - <lineStyle kind="LINEABOVE" colorName="#000000" start="2,0" stop="2,0"/> - <lineStyle kind="LINEABOVE" colorName="#000000" start="1,2" stop="1,2"/> - <lineStyle kind="LINEABOVE" colorName="#000000" start="2,2" stop="2,2"/> - </blockTableStyle> - <blockTableStyle id="Table_Outer_Notes"> - <blockAlignment value="LEFT"/> - <blockValign value="TOP"/> - </blockTableStyle> - <initialize> - <paraStyle name="all" alignment="justify"/> - </initialize> - <paraStyle name="terp_header" fontSize="12.0" leading="15" alignment="LEFT" spaceBefore="12.0" spaceAfter="6.0"/> - <paraStyle name="terp_tblheader_General" fontSize="8.0" leading="10" alignment="LEFT" spaceBefore="6.0" spaceAfter="6.0"/> - <paraStyle name="terp_default_8" fontSize="8.0" leading="10" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/> - <paraStyle name="terp_tblheader_General_Centre" fontSize="8.0" leading="10" alignment="CENTER" spaceBefore="6.0" spaceAfter="6.0"/> - <paraStyle name="terp_tblheader_General_Right" fontSize="8.0" leading="10" alignment="RIGHT" spaceBefore="6.0" spaceAfter="6.0"/> - <paraStyle name="terp_default_Centre_8" fontSize="8.0" leading="10" alignment="CENTER" spaceBefore="0.0" spaceAfter="0.0"/> - <paraStyle name="terp_default_9" fontSize="9.0" leading="11" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/> - <paraStyle name="terp_default_Bold_9" fontSize="9.0" leading="11" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/> - <paraStyle name="terp_default_Right_9" fontSize="9.0" leading="11" alignment="RIGHT" spaceBefore="0.0" spaceAfter="0.0"/> - <paraStyle name="terp_default_Bold_9_Right" fontSize="9.0" leading="11" alignment="RIGHT" spaceBefore="0.0" spaceAfter="0.0"/> - <images/> - </stylesheet> - <story> - <pto> - <para style="terp_default_8">[[repeatIn(objects,'o')]]</para> - <para style="terp_default_8">[[ setLang(o.partner_id.lang) ]]</para> - <pto_header> - <blockTable colWidths="180.0,70.0,60.0,80.0,60.0,85.0" repeatRows="1" style="Table_Header_Pur_ord_Line"> - <tr> - <td> - <para style="terp_tblheader_General"><b>Description</b></para> - </td> - <td> - <para style="terp_tblheader_General"><b>Taxes</b></para> - </td> - <td> - <para style="terp_tblheader_General"><b>Date Req.</b></para> - </td> - <td> - <para style="terp_tblheader_General_Right"><b>Qty</b></para> - </td> - <td> - <para style="terp_tblheader_General_Right"><b>Unit Price</b></para> - </td> - <td> - <para style="terp_tblheader_General_Right"><b>Net Price</b></para> - </td> - </tr> - </blockTable> - </pto_header> - <para style="terp_default_9"> - <font color="white"> </font> - </para> - <blockTable colWidths="253.0,59.0,223.0" style="Tableau1"> - <tr> - <td> - <blockTable colWidths="253.0" style="Tableau2"> - <tr> - <td> - <para style="terp_default_Bold_9"><b>Shipping address :</b></para> - <para style="terp_default_9">[[ (o.dest_address_id and o.dest_address_id.name) or (o.warehouse_id and o.warehouse_id.name) or '']]</para> - <para style="terp_default_9">[[ (o.dest_address_id and display_address(o.dest_address_id)) or (o.warehouse_id and display_address(o.warehouse_id.partner_id)) or '']]</para> - </td> - </tr> - </blockTable> - <para style="terp_default_9"> - <font color="white"> </font> - </para> - </td> - <td> - <para style="terp_default_9"> - <font color="white"> </font> - </para> - </td> - <td> - <para style="terp_default_9">[[ (o.partner_id and o.partner_id.title and o.partner_id.title.name) or '' ]] [[ (o.partner_id and o.partner_id.name) or '' ]]</para> - <para style="terp_default_9">[[ o.partner_id and display_address(o.partner_id) ]] </para> - <para style="terp_default_9"> - <font color="white"> </font> - </para> - <para style="terp_default_9">Tel : [[ (o.partner_id.phone) or removeParentNode('para') ]]</para> - <para style="terp_default_9">Fax : [[ (o.partner_id.fax) or removeParentNode('para') ]]</para> - <para style="terp_default_9">TIN : [[ (o.partner_id.vat) or removeParentNode('para') ]]</para> - </td> - </tr> - </blockTable> - <para style="terp_default_9"> - <font color="white"> </font> - </para> - <para style="terp_header"><b>[[ o.state=='draft' and removeParentNode('para') ]] Purchase Order Confirmation N° [[ o.name ]]</b></para> - <para style="terp_header"><b>[[ o.state<>'draft' and removeParentNode('para') ]] Request for Quotation N° [[ o.name ]]</b></para> - <para style="terp_default_8"> - <font color="white"> </font> - </para> - <blockTable colWidths="136.0,132.0,133.0,133.0" style="Header_Order_Reference_Tbl"> - <tr> - <td> - <para style="terp_tblheader_General_Centre"><b>Our Order Reference</b></para> - </td> - <td> - <para style="terp_tblheader_General_Centre"><b>Your Order Reference</b></para> - </td> - <td> - <para style="terp_tblheader_General_Centre"><b>Order Date</b></para> - </td> - <td> - <para style="terp_tblheader_General_Centre"><b>Validated By</b></para> - </td> - </tr> - </blockTable> - <blockTable colWidths="136.0,132.0,133.0,133.0" style="Content_Order_Reference_Table"> - <tr> - <td> - <para style="terp_default_Centre_8">[[ o.name or '' ]]</para> - </td> - <td> - <para style="terp_default_Centre_8">[[ o.partner_ref or '' ]]</para> - </td> - <td> - <para style="terp_default_Centre_8">[[formatLang(o.date_order,date=True) ]]</para> - </td> - <td> - <para style="terp_default_Centre_8">[[ (o.validator and o.validator.name) or '' ]]</para> - </td> - </tr> - </blockTable> - <para style="terp_default_9"> - <font color="white"> </font> - </para> - <blockTable colWidths="180.0,70.0,60.0,80.0,60.0,85.0" repeatRows="1" style="Table_Header_Pur_ord_Line"> - <tr> - <td> - <para style="terp_tblheader_General"><b>Description</b></para> - </td> - <td> - <para style="terp_tblheader_General"><b>Taxes</b></para> - </td> - <td> - <para style="terp_tblheader_General"><b>Date Req.</b></para> - </td> - <td> - <para style="terp_tblheader_General_Right"><b>Qty</b></para> - </td> - <td> - <para style="terp_tblheader_General_Right"><b>Unit Price</b></para> - </td> - <td> - <para style="terp_tblheader_General_Right"><b>Net Price</b></para> - </td> - </tr> - </blockTable> - <section> - <para style="terp_default_8">[[repeatIn(o.order_line,'line')]]</para> - <blockTable colWidths="180.0,70.0,60.0,80.0,60.0,85.0" style="Table_Order_Pur_line_Content"> - <tr> - <td> - <para style="terp_default_9">[[ line.name ]]</para> - </td> - <td> - <para style="terp_default_9">[[ ', '.join(map(lambda x: x.name, line.taxes_id)) ]]</para> - </td> - <td> - <para style="terp_default_9">[[ formatLang( line.date_planned, date=True) ]]</para> - </td> - <td> - <para style="terp_default_Right_9">[[ formatLang(line.product_qty ) ]] [[ line.product_uom.name ]] </para> - </td> - <td> - <para style="terp_default_Right_9">[[ formatLang(line.price_unit, digits=get_digits(dp='Product Price') ) ]]</para> - </td> - <td> - <para style="terp_default_Right_9">[[ formatLang(line.price_subtotal, digits=get_digits(dp='Account'), currency_obj=o.pricelist_id.currency_id ) ]]</para> - </td> - </tr> - </blockTable> - </section> - <blockTable colWidths="375.0,60.0,100.0" style="Table_All_Total_Detail"> - <tr> - <td> - <para style="terp_default_9"> - <font color="white"> </font> - </para> - </td> - <td> - <para style="terp_default_9">Net Total :</para> - </td> - <td> - <para style="terp_default_Right_9">[[ formatLang(o.amount_untaxed, digits=get_digits(dp='Account'), currency_obj=o.pricelist_id.currency_id ) ]]</para> - </td> - </tr> - <tr> - <td> - <para style="terp_default_9"> - <font color="white"> </font> - </para> - </td> - <td> - <para style="terp_default_9">Taxes :</para> - </td> - <td> - <para style="terp_default_Right_9">[[ formatLang(o.amount_tax, dp='Account', currency_obj=o.pricelist_id.currency_id) ]]</para> - </td> - </tr> - <tr> - <td> - <para style="terp_default_9"> - <font color="white"> </font> - </para> - </td> - <td> - <para style="terp_default_Bold_9"><b>Total :</b></para> - </td> - <td> - <para style="terp_default_Bold_9_Right"><b>[[ formatLang(o.amount_total, digits=get_digits(dp='Account') , currency_obj=o.pricelist_id.currency_id) ]]</b></para> - </td> - </tr> - </blockTable> - <para style="terp_default_8"> - <font color="white"> </font> - </para> - <blockTable colWidths="535.0" style="Table_Outer_Notes"> - <tr> - <td> - <para style="terp_default_9">[[ format(o.notes or '') ]]</para> - </td> - </tr> - </blockTable> - <para style="terp_default_9"> - <font color="white"> </font> - </para> - </pto> - </story> -</document> diff --git a/addons/purchase/report/request_quotation.py b/addons/purchase/report/request_quotation.py deleted file mode 100644 index 7be23113584..00000000000 --- a/addons/purchase/report/request_quotation.py +++ /dev/null @@ -1,35 +0,0 @@ -# -*- coding: utf-8 -*- -############################################################################## -# -# OpenERP, Open Source Management Solution -# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>). -# -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU Affero General Public License as -# published by the Free Software Foundation, either version 3 of the -# License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Affero General Public License for more details. -# -# You should have received a copy of the GNU Affero General Public License -# along with this program. If not, see <http://www.gnu.org/licenses/>. -# -############################################################################## - -import time -from openerp.report import report_sxw - -class request_quotation(report_sxw.rml_parse): - def __init__(self, cr, uid, name, context): - super(request_quotation, self).__init__(cr, uid, name, context=context) - self.localcontext.update({ - 'time': time, - 'user': self.pool.get('res.users').browse(cr, uid, uid, context) - }) -report_sxw.report_sxw('report.purchase.quotation','purchase.order','addons/purchase/report/request_quotation.rml',parser=request_quotation) - -# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: - diff --git a/addons/purchase/report/request_quotation.rml b/addons/purchase/report/request_quotation.rml deleted file mode 100644 index cfc97a75aa4..00000000000 --- a/addons/purchase/report/request_quotation.rml +++ /dev/null @@ -1,146 +0,0 @@ -<?xml version="1.0"?> -<document filename="requestforquotation.pdf"> - <template pageSize="(595.0,842.0)" title="Test" author="Martin Simon" allowSplitting="20"> - <pageTemplate id="first"> - <frame id="first" x1="23.0" y1="43.0" width="530" height="799"/> - </pageTemplate> - </template> - <stylesheet> - <blockTableStyle id="Standard_Outline"> - <blockAlignment value="LEFT"/> - <blockValign value="TOP"/> - </blockTableStyle> - <blockTableStyle id="Tableau1"> - <blockAlignment value="LEFT"/> - <blockValign value="TOP"/> - </blockTableStyle> - <blockTableStyle id="Tableau2"> - <blockAlignment value="LEFT"/> - <blockValign value="TOP"/> - </blockTableStyle> - <blockTableStyle id="Table_Product_Header_Title"> - <blockAlignment value="LEFT"/> - <blockValign value="TOP"/> - <lineStyle kind="LINEBELOW" colorName="#000000" start="0,-1" stop="0,-1"/> - <lineStyle kind="LINEBELOW" colorName="#000000" start="1,-1" stop="1,-1"/> - <lineStyle kind="LINEBELOW" colorName="#000000" start="2,-1" stop="2,-1"/> - </blockTableStyle> - <blockTableStyle id="Table_Product_Line"> - <blockAlignment value="LEFT"/> - <blockValign value="TOP"/> - <lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="0,-1" stop="0,-1"/> - <lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="1,-1" stop="1,-1"/> - <lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="2,-1" stop="2,-1"/> - <lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="3,-1" stop="3,-1"/> - </blockTableStyle> - <initialize> - <paraStyle name="all" alignment="justify"/> - </initialize> - <paraStyle name="P1" fontSize="9.0" leading="11" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/> - <paraStyle name="Standard"/> - <paraStyle name="terp_header" fontSize="12.0" leading="15" alignment="LEFT" spaceBefore="12.0" spaceAfter="6.0"/> - <paraStyle name="terp_tblheader_Details" fontSize="9.0" leading="11" alignment="LEFT" spaceBefore="6.0" spaceAfter="6.0"/> - <paraStyle name="terp_default_8" fontSize="8.0" leading="10" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/> - <paraStyle name="terp_tblheader_Details_Centre" fontSize="9.0" leading="11" alignment="CENTER" spaceBefore="6.0" spaceAfter="6.0"/> - <paraStyle name="terp_default_9" fontSize="9.0" leading="11" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/> - <paraStyle name="terp_default_Bold_9" fontSize="9.0" leading="11" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/> - <paraStyle name="terp_default_Centre_9" fontSize="9.0" leading="11" alignment="CENTER" spaceBefore="0.0" spaceAfter="0.0"/> - <paraStyle name="terp_default_Right_9" fontSize="9.0" leading="11" alignment="RIGHT" spaceBefore="0.0" spaceAfter="0.0"/> - <paraStyle name="Space bet user and signature" fontSize="4.0" leading="5" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/> - <images/> - </stylesheet> - <story> - <para style="terp_default_9">[[repeatIn(objects,'order')]]</para> - <para style="terp_default_9">[[ setLang(order.partner_id.lang) ]]</para> - <para style="terp_default_9"> - <font color="white"> </font> - </para> - <blockTable colWidths="250.0,59.0,221.0" style="Tableau1"> - <tr> - <td> - <blockTable colWidths="250.0" style="Tableau2"> - <tr> - <td> - <para style="terp_default_Bold_9"><b>Expected Delivery address:</b></para> - <para style="terp_default_9">[[ (order.dest_address_id and order.dest_address_id.name) or (order.warehouse_id and order.warehouse_id.name) or '']]</para> - <para style="P1">[[ order.dest_address_id and display_address(order.dest_address_id) ]]</para> - </td> - </tr> - </blockTable> - <para style="terp_default_9"> - <font color="white"> </font> - </para> - </td> - <td> - <para style="terp_default_9"> - <font color="white"> </font> - </para> - </td> - <td> - <para style="terp_default_9">[[ (order .partner_id and order.partner_id.title and order.partner_id.title.name) or '' ]] [[ (order .partner_id and order.partner_id.name) or '' ]] </para> - <para style="terp_default_9">[[ order.partner_id and display_address(order .partner_id) ]] </para> - <para style="terp_default_9"> - <font color="white"> </font> - </para> - <para style="terp_default_9">Tel.: [[ (order.partner_id and order.partner_id.phone) or removeParentNode('para') ]]</para> - <para style="terp_default_9">Fax: [[ (order.partner_id and order.partner_id.fax) or removeParentNode('para') ]]</para> - <para style="P1">TVA: [[ (order.partner_id and order.partner_id.vat) or removeParentNode('para') ]]</para> - </td> - </tr> - </blockTable> - <para style="Standard"> - <font color="white"> </font> - </para> - <para style="terp_header"><b>Request for Quotation : [[order.name]]</b></para> - <para style="terp_default_8"> - <font color="white"> </font> - </para> - <blockTable colWidths="349.0,90.0,92.0" repeatRows="1" style="Table_Product_Header_Title"> - <tr> - <td> - <para style="terp_tblheader_Details"><b>Description</b></para> - </td> - <td> - <para style="terp_tblheader_Details_Centre"><b>Expected Date</b></para> - </td> - <td> - <para style="terp_tblheader_Details_Centre"><b>Qty</b></para> - </td> - </tr> - </blockTable> - <section> - <para style="terp_default_9">[[ repeatIn(order.order_line,'order_line') ]]</para> - <blockTable colWidths="349.0,89.0,49.0,43.0" style="Table_Product_Line"> - <tr> - <td> - <para style="terp_default_9">[[ order_line.name ]]</para> - </td> - <td> - <para style="terp_default_Centre_9">[[ formatLang(order_line.date_planned, date = True) ]]</para> - </td> - <td> - <para style="terp_default_Right_9">[[ formatLang(order_line.product_qty )]]</para> - </td> - <td> - <para style="terp_default_Right_9">[[ (order_line.product_uom and order_line.product_uom.name) or '' ]]</para> - </td> - </tr> - </blockTable> - </section> - <para style="terp_default_9"> - <font color="white"> </font> - </para> - <para style="terp_default_9">[[ format(order.notes or '') ]]</para> - <para style="terp_default_9"> - <font color="white"> </font> - </para> - <para style="terp_default_9">Regards,</para> - <para style="terp_default_9"> - <font color="white"> </font> - </para> - <para style="Space bet user and signature"> - <font color="white"> </font> - </para> - <para style="terp_default_9">[[ user.signature or '' ]]</para> - </story> -</document> diff --git a/addons/purchase/test/ui/print_report.yml b/addons/purchase/test/ui/print_report.yml deleted file mode 100644 index 2fe7ec89d25..00000000000 --- a/addons/purchase/test/ui/print_report.yml +++ /dev/null @@ -1,21 +0,0 @@ -- - In order to test the PDF reports defined on a Purchase Order, I print a Request Quotation report -- - !python {model: purchase.order}: | - import os - import openerp.report - from openerp import tools - data, format = openerp.report.render_report(cr, uid, [ref('purchase.purchase_order_1'), ref('purchase.purchase_order_2')], 'purchase.quotation', {}, {}) - if tools.config['test_report_directory']: - file(os.path.join(tools.config['test_report_directory'], 'purchase-request_quotation'+format), 'wb+').write(data) -- - I print Purchase Order report -- - !python {model: purchase.order}: | - import os - from openerp import tools - from openerp.report import render_report - ids = [ref('purchase.purchase_order_1'), ref('purchase.purchase_order_2')] - data, format = render_report(cr, uid, ids, 'purchase.order', {}) - if tools.config['test_report_directory']: - file(os.path.join(tools.config['test_report_directory'], 'purchase-purchase_order_report'+format), 'wb+').write(data) diff --git a/addons/purchase/views/report_purchaseorder.xml b/addons/purchase/views/report_purchaseorder.xml new file mode 100644 index 00000000000..c03e535ff75 --- /dev/null +++ b/addons/purchase/views/report_purchaseorder.xml @@ -0,0 +1,127 @@ +<?xml version="1.0" encoding="utf-8"?> +<openerp> +<data> +<template id="report_purchaseorder"> + <t t-call="report.html_container"> + <t t-foreach="docs" t-as="o"> + <t t-call="report.external_layout"> + <div class="page"> + <div class="oe_structure"/> + <div class="row"> + <div class="col-xs-6"> + Shipping address :<br/> + <div t-if="o.dest_address_id"> + <div t-field="o.dest_address_id" + t-field-options='{"widget": "contact", "fields": ["address", "name", "phone", "fax"], "no_marker": true}'/> + <p t-if="o.partner_id.vat">VAT: <span t-field="o.partner_id.vat"/></p> + </div> + + <div t-if="o.warehouse_id"> + <span t-field="o.warehouse_id.name"/> + <div t-field="o.warehouse_id.partner_id" + t-field-options='{"widget": "contact", "fields": ["address", "name", "phone", "fax"], "no_marker": true}'/> + <p t-if="o.partner_id.vat">VAT: <span t-field="o.partner_id.vat"/></p> + </div> + </div> + <div class="col-xs-4 col-xs-offset-2"> + <div t-field="o.partner_id" + t-field-options='{"widget": "contact", "fields": ["address", "name", "phone", "fax"], "no_marker": true}'/> + </div> + </div> + + <h2 t-if="o.state != 'draft'">Purchase Order Confirmation N°<span t-field="o.name"/></h2> + <h2 t-if="o.state == 'draft'">Request for Quotation N°<span t-field="o.name"/></h2> + + <div class="row mt32 mb32"> + <div t-if="o.name" class="col-xs-3"> + <strong>Our Order Reference:</strong> + <p t-field="o.name"/> + </div> + <div t-if="o.partner_ref" class="col-xs-3"> + <strong>Your Order Reference</strong> + <p t-field="o.partner_ref"/> + </div> + <div t-if="o.date_order" class="col-xs-3"> + <strong>Order Date:</strong> + <p t-field="o.date_order"/> + </div> + <div t-if="o.validator" class="col-xs-3"> + <strong>Validated By:</strong> + <p t-field="o.validator"/> + </div> + </div> + + <table class="table table-condensed"> + <thead> + <tr> + <th><strong>Description</strong></th> + <th><strong>Taxes</strong></th> + <th class="text-center"><strong>Date Req.</strong></th> + <th class="text-right"><strong>Qty</strong></th> + <th class="text-right"><strong>Unit Price</strong></th> + <th class="text-right"><strong>Net Price</strong></th> + </tr> + </thead> + <tbody> + <tr t-foreach="o.order_line" t-as="line"> + <td> + <span t-field="line.name"/> + </td> + <td> + <span t-esc="', '.join(map(lambda x: x.name, line.taxes_id))"/> + </td> + <td class="text-center"> + <span t-field="line.date_planned"/> + </td> + <td class="text-right"> + <span t-field="line.product_qty"/> + <span t-field="line.product_uom.name" groups="product.group_uom"/> + </td> + <td class="text-right"> + <span t-field="line.price_unit"/> + </td> + <td class="text-right"> + <span t-field="line.price_subtotal" + t-field-options='{"widget": "monetary", "display_currency": "o.pricelist_id.currency_id"}'/> + </td> + </tr> + </tbody> + </table> + + <div class="row"> + <div class="col-xs-4 pull-right"> + <table class="table table-condensed"> + <tr class="border-black"> + <td><strong>Total Without Taxes</strong></td> + <td class="text-right"> + <span t-field="o.amount_untaxed" + t-field-options='{"widget": "monetary", "display_currency": "o.pricelist_id.currency_id"}'/> + </td> + </tr> + <tr> + <td>Taxes</td> + <td class="text-right"> + <span t-field="o.amount_tax" + t-field-options='{"widget": "monetary", "display_currency": "o.pricelist_id.currency_id"}'/> + </td> + </tr> + <tr class="border-black"> + <td><strong>Total</strong></td> + <td class="text-right"> + <span t-field="o.amount_total" + t-field-options='{"widget": "monetary", "display_currency": "o.pricelist_id.currency_id"}'/> + </td> + </tr> + </table> + </div> + </div> + + <p t-field="o.notes"/> + <div class="oe_structure"/> + </div> + </t> + </t> + </t> +</template> +</data> +</openerp> diff --git a/addons/purchase/views/report_purchasequotation.xml b/addons/purchase/views/report_purchasequotation.xml new file mode 100644 index 00000000000..68e8995ddd8 --- /dev/null +++ b/addons/purchase/views/report_purchasequotation.xml @@ -0,0 +1,70 @@ +<?xml version="1.0" encoding="utf-8"?> +<openerp> +<data> +<template id="report_purchasequotation"> + <t t-call="report.html_container"> + <t t-foreach="docs" t-as="o"> + <t t-call="report.external_layout"> + <div class="page"> + <div class="oe_structure"/> + + <div class="row mt32 mb32"> + <div class="col-xs-6"> + Shipping address :<br/> + <div t-if="o.dest_address_id"> + <div t-field="o.dest_address_id" + t-field-options='{"widget": "contact", "fields": ["address", "name", "phone", "fax"], "no_marker": true}'/> + <p t-if="o.partner_id.vat">VAT: <span t-field="o.partner_id.vat"/></p> + </div> + <div t-if="o.warehouse_id"> + <span t-field="o.warehouse_id.name"/> + <div t-field="o.warehouse_id.partner_id" + t-field-options='{"widget": "contact", "fields": ["address", "name", "phone", "fax"], "no_marker": true}'/> + <p t-if="o.partner_id.vat">VAT: <span t-field="o.partner_id.vat"/></p> + </div> + </div> + <div class="col-xs-4 col-xs-offset-2"> + <div t-field="o.partner_id" + t-field-options='{"widget": "contact", "fields": ["address", "name", "phone", "fax"], "no_marker": true}'/> + </div> + </div> + + <h2>Request for Quotation <span t-field="o.name"/></h2> + + <table class="table table-condensed"> + <thead> + <tr> + <th><strong>Description</strong></th> + <th class="text-center"><strong>Expected Date</strong></th> + <th class="text-right"><strong>Qty</strong></th> + </tr> + </thead> + <tbody> + <tr t-foreach="o.order_line" t-as="order_line"> + <td> + <span t-field="order_line.name"/> + </td> + <td class="text-center"> + <span t-field="order_line.date_planned"/> + </td> + <td class="text-right"> + <span t-field="order_line.product_qty"/> + <span t-field="order_line.product_uom" groups="product.group_uom"/> + </td> + </tr> + </tbody> + </table> + + <p t-field="o.notes"/> + <span>Regards,</span> + <span t-field="user.signature"/> + + <div class="oe_structure"/> + </div> + </t> + </t> + </t> +</template> +</data> +</openerp> + diff --git a/addons/purchase_requisition/__init__.py b/addons/purchase_requisition/__init__.py index 0c1aab5b6e7..587ce369afb 100644 --- a/addons/purchase_requisition/__init__.py +++ b/addons/purchase_requisition/__init__.py @@ -20,6 +20,4 @@ import purchase_requisition import wizard -import report # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: - diff --git a/addons/purchase_requisition/__openerp__.py b/addons/purchase_requisition/__openerp__.py index 3f5fce3e8cc..483ea4a0d56 100644 --- a/addons/purchase_requisition/__openerp__.py +++ b/addons/purchase_requisition/__openerp__.py @@ -39,7 +39,9 @@ keep track and order all your purchase orders. 'purchase_requisition_data.xml', 'purchase_requisition_view.xml', 'purchase_requisition_report.xml', - 'security/ir.model.access.csv','purchase_requisition_sequence.xml' + 'security/ir.model.access.csv','purchase_requisition_sequence.xml', + + 'views/report_purchaserequisition.xml', ], 'auto_install': False, 'test': [ diff --git a/addons/purchase_requisition/purchase_requisition_report.xml b/addons/purchase_requisition/purchase_requisition_report.xml index 97d510fe752..64cbc1e7ea1 100644 --- a/addons/purchase_requisition/purchase_requisition_report.xml +++ b/addons/purchase_requisition/purchase_requisition_report.xml @@ -1,6 +1,13 @@ <?xml version="1.0" encoding="utf-8"?> <openerp> <data> - <report auto="False" id="report_purchase_requisition" model="purchase.requisition" name="purchase.requisition" rml="purchase_requisition/report/purchase_requisition.rml" string="Purchase Requisition"/> + <report + string="Purchase Requisition" + id="action_report_purchase_requisitions" + model="purchase.requisition" + report_type="qweb-pdf" + name="purchase_requisition.report_purchaserequisitions" + file="purchase_requisition.report_purchaserequisitions" + /> </data> </openerp> diff --git a/addons/purchase_requisition/report/__init__.py b/addons/purchase_requisition/report/__init__.py deleted file mode 100644 index a2d5684cd1d..00000000000 --- a/addons/purchase_requisition/report/__init__.py +++ /dev/null @@ -1,24 +0,0 @@ -# -*- coding: utf-8 -*- -############################################################################## -# -# OpenERP, Open Source Management Solution -# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>). -# -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU Affero General Public License as -# published by the Free Software Foundation, either version 3 of the -# License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Affero General Public License for more details. -# -# You should have received a copy of the GNU Affero General Public License -# along with this program. If not, see <http://www.gnu.org/licenses/>. -# -############################################################################## -import requisition - -# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: - diff --git a/addons/purchase_requisition/report/purchase_requisition.rml b/addons/purchase_requisition/report/purchase_requisition.rml deleted file mode 100644 index 95c5d19ba31..00000000000 --- a/addons/purchase_requisition/report/purchase_requisition.rml +++ /dev/null @@ -1,239 +0,0 @@ -<?xml version="1.0"?> -<document filename="Purchase for Requisitions.pdf"> - <template title="Purchase for Requisitions" author="OpenERP S.A.(sales@openerp.com)" allowSplitting="20"> - <pageTemplate id="first"> - <frame id="first" x1="34.0" y1="28.0" width="530" height="786"/> - </pageTemplate> - </template> - <stylesheet> - <blockTableStyle id="Standard_Outline"> - <blockAlignment value="LEFT"/> - <blockValign value="TOP"/> - </blockTableStyle> - <blockTableStyle id="Table2"> - <blockAlignment value="LEFT"/> - <blockValign value="TOP"/> - <lineStyle kind="LINEBEFORE" colorName="#e6e6e6" start="0,0" stop="0,-1"/> - <lineStyle kind="LINEABOVE" colorName="#e6e6e6" start="0,0" stop="0,0"/> - <lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="0,-1" stop="0,-1"/> - <lineStyle kind="LINEBEFORE" colorName="#e6e6e6" start="1,0" stop="1,-1"/> - <lineStyle kind="LINEABOVE" colorName="#e6e6e6" start="1,0" stop="1,0"/> - <lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="1,-1" stop="1,-1"/> - <lineStyle kind="LINEBEFORE" colorName="#e6e6e6" start="2,0" stop="2,-1"/> - <lineStyle kind="LINEABOVE" colorName="#e6e6e6" start="2,0" stop="2,0"/> - <lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="2,-1" stop="2,-1"/> - <lineStyle kind="LINEBEFORE" colorName="#e6e6e6" start="3,0" stop="3,-1"/> - <lineStyle kind="LINEAFTER" colorName="#e6e6e6" start="3,0" stop="3,-1"/> - <lineStyle kind="LINEABOVE" colorName="#e6e6e6" start="3,0" stop="3,0"/> - <lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="3,-1" stop="3,-1"/> - </blockTableStyle> - <blockTableStyle id="Table1"> - <blockAlignment value="LEFT"/> - <blockValign value="TOP"/> - <lineStyle kind="LINEBEFORE" colorName="#e6e6e6" start="0,0" stop="0,-1"/> - <lineStyle kind="LINEABOVE" colorName="#e6e6e6" start="0,0" stop="0,0"/> - <lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="0,-1" stop="0,-1"/> - <lineStyle kind="LINEBEFORE" colorName="#e6e6e6" start="1,0" stop="1,-1"/> - <lineStyle kind="LINEABOVE" colorName="#e6e6e6" start="1,0" stop="1,0"/> - <lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="1,-1" stop="1,-1"/> - <lineStyle kind="LINEBEFORE" colorName="#e6e6e6" start="2,0" stop="2,-1"/> - <lineStyle kind="LINEABOVE" colorName="#e6e6e6" start="2,0" stop="2,0"/> - <lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="2,-1" stop="2,-1"/> - <lineStyle kind="LINEBEFORE" colorName="#e6e6e6" start="3,0" stop="3,-1"/> - <lineStyle kind="LINEAFTER" colorName="#e6e6e6" start="3,0" stop="3,-1"/> - <lineStyle kind="LINEABOVE" colorName="#e6e6e6" start="3,0" stop="3,0"/> - <lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="3,-1" stop="3,-1"/> - </blockTableStyle> - <blockTableStyle id="Table4"> - <blockAlignment value="LEFT"/> - <blockValign value="TOP"/> - <lineStyle kind="LINEBELOW" colorName="#000000" start="0,-1" stop="0,-1"/> - <lineStyle kind="LINEBELOW" colorName="#000000" start="1,-1" stop="1,-1"/> - <lineStyle kind="LINEBELOW" colorName="#000000" start="2,-1" stop="2,-1"/> - </blockTableStyle> - <blockTableStyle id="Table5"> - <blockAlignment value="LEFT"/> - <blockValign value="TOP"/> - <lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="0,-1" stop="0,-1"/> - <lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="1,-1" stop="1,-1"/> - <lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="2,-1" stop="2,-1"/> - </blockTableStyle> - <blockTableStyle id="Table6"> - <blockAlignment value="LEFT"/> - <blockValign value="TOP"/> - <lineStyle kind="LINEBELOW" colorName="#000000" start="0,-1" stop="0,-1"/> - <lineStyle kind="LINEBELOW" colorName="#000000" start="1,-1" stop="1,-1"/> - <lineStyle kind="LINEBELOW" colorName="#000000" start="2,-1" stop="2,-1"/> - </blockTableStyle> - <blockTableStyle id="Table7"> - <blockAlignment value="LEFT"/> - <blockValign value="TOP"/> - <lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="0,-1" stop="0,-1"/> - <lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="1,-1" stop="1,-1"/> - <lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="2,-1" stop="2,-1"/> - </blockTableStyle> - <initialize> - <paraStyle name="all" alignment="justify"/> - </initialize> - <paraStyle name="Standard" fontName="Helvetica"/> - <paraStyle name="Text body" fontName="Helvetica" spaceBefore="0.0" spaceAfter="6.0"/> - <paraStyle name="List" fontName="Helvetica" spaceBefore="0.0" spaceAfter="6.0"/> - <paraStyle name="Table Contents" fontName="Helvetica" spaceBefore="0.0" spaceAfter="6.0"/> - <paraStyle name="Table Heading" fontName="Helvetica" alignment="CENTER" spaceBefore="0.0" spaceAfter="6.0"/> - <paraStyle name="Caption" fontName="Helvetica" fontSize="10.0" leading="13" spaceBefore="6.0" spaceAfter="6.0"/> - <paraStyle name="Index" fontName="Helvetica"/> - <paraStyle name="Heading" fontName="Helvetica" fontSize="15.0" leading="19" spaceBefore="12.0" spaceAfter="6.0"/> - <paraStyle name="terp_header" fontName="Helvetica-Bold" fontSize="12.0" leading="15" alignment="LEFT" spaceBefore="12.0" spaceAfter="6.0"/> - <paraStyle name="terp_default_8" rightIndent="0.0" leftIndent="0.0" fontName="Helvetica" fontSize="8.0" leading="10" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/> - <paraStyle name="Footer" fontName="Helvetica"/> - <paraStyle name="Horizontal Line" fontName="Helvetica" fontSize="6.0" leading="8" spaceBefore="0.0" spaceAfter="14.0"/> - <paraStyle name="Heading 9" fontName="Helvetica-Bold" fontSize="75%" leading="NaN" spaceBefore="12.0" spaceAfter="6.0"/> - <paraStyle name="terp_tblheader_General" fontName="Helvetica-Bold" fontSize="8.0" leading="10" alignment="LEFT" spaceBefore="6.0" spaceAfter="6.0"/> - <paraStyle name="terp_tblheader_Details" fontName="Helvetica-Bold" fontSize="9.0" leading="11" alignment="LEFT" spaceBefore="6.0" spaceAfter="6.0"/> - <paraStyle name="terp_default_Bold_8" rightIndent="0.0" leftIndent="0.0" fontName="Helvetica-Bold" fontSize="8.0" leading="10" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/> - <paraStyle name="terp_tblheader_General_Centre" fontName="Helvetica-Bold" fontSize="8.0" leading="10" alignment="CENTER" spaceBefore="6.0" spaceAfter="6.0"/> - <paraStyle name="terp_tblheader_General_Right" fontName="Helvetica-Bold" fontSize="8.0" leading="10" alignment="RIGHT" spaceBefore="6.0" spaceAfter="6.0"/> - <paraStyle name="terp_tblheader_Details_Centre" fontName="Helvetica-Bold" fontSize="9.0" leading="11" alignment="CENTER" spaceBefore="6.0" spaceAfter="6.0"/> - <paraStyle name="terp_tblheader_Details_Right" fontName="Helvetica-Bold" fontSize="9.0" leading="11" alignment="RIGHT" spaceBefore="6.0" spaceAfter="6.0"/> - <paraStyle name="terp_default_Right_8" rightIndent="0.0" leftIndent="0.0" fontName="Helvetica" fontSize="8.0" leading="10" alignment="RIGHT" spaceBefore="0.0" spaceAfter="0.0"/> - <paraStyle name="terp_default_Centre_8" rightIndent="0.0" leftIndent="0.0" fontName="Helvetica" fontSize="8.0" leading="10" alignment="CENTER" spaceBefore="0.0" spaceAfter="0.0"/> - <paraStyle name="terp_header_Right" fontName="Helvetica-Bold" fontSize="15.0" leading="19" alignment="LEFT" spaceBefore="12.0" spaceAfter="6.0"/> - <paraStyle name="terp_header_Centre" fontName="Helvetica-Bold" fontSize="12.0" leading="15" alignment="CENTER" spaceBefore="0.0" spaceAfter="6.0"/> - <paraStyle name="terp_default_address" rightIndent="0.0" leftIndent="0.0" fontName="Helvetica" fontSize="10.0" leading="13" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/> - <paraStyle name="terp_default_9" rightIndent="0.0" leftIndent="0.0" fontName="Helvetica" fontSize="9.0" leading="11" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/> - <paraStyle name="terp_default_Bold_9" rightIndent="0.0" leftIndent="0.0" fontName="Helvetica-Bold" fontSize="9.0" leading="11" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/> - <paraStyle name="terp_default_Centre_9" rightIndent="0.0" leftIndent="0.0" fontName="Helvetica" fontSize="9.0" leading="11" alignment="CENTER" spaceBefore="0.0" spaceAfter="0.0"/> - <paraStyle name="terp_default_Right_9" rightIndent="0.0" leftIndent="0.0" fontName="Helvetica" fontSize="9.0" leading="11" alignment="RIGHT" spaceBefore="0.0" spaceAfter="0.0"/> - <paraStyle name="terp_default_Bold_Right_9" rightIndent="0.0" leftIndent="0.0" fontName="Helvetica-Bold" fontSize="9.0" leading="11" alignment="RIGHT" spaceBefore="0.0" spaceAfter="0.0"/> - <paraStyle name="terp_default_2" rightIndent="0.0" leftIndent="0.0" fontName="Helvetica" fontSize="2.0" leading="3" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/> - <paraStyle name="terp_default_White_2" rightIndent="0.0" leftIndent="0.0" fontName="Helvetica" fontSize="2.0" leading="3" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0" textColor="#ffffff"/> - <paraStyle name="terp_default_Note" rightIndent="0.0" leftIndent="9.0" fontName="Helvetica-Oblique" fontSize="8.0" leading="10" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/> - <paraStyle name="Table" fontName="Helvetica" fontSize="10.0" leading="13" spaceBefore="6.0" spaceAfter="6.0"/> - <images/> - </stylesheet> - <story> - <pto> - <pto_header> - <blockTable colWidths="375.0,71.0,84.0" style="Table4"> - <tr> - <td> - <para style="terp_tblheader_Details">Description [[ requisition.line_ids==[] and removeParentNode('blockTable') ]]</para> - </td> - <td> - <para style="terp_tblheader_Details_Centre">Qty</para> - </td> - <td> - <para style="terp_tblheader_Details_Centre">Product UoM</para> - </td> - </tr> - </blockTable> - </pto_header> - <para style="terp_default_8">[[ repeatIn(objects,'requisition') ]]</para> - <para style="terp_default_8"> - <font color="white"> </font> - </para> - <para style="terp_header">Purchase for Requisitions [[ requisition.name ]]</para> - <para style="terp_default_8"> - <font color="white"> </font> - </para> - <blockTable colWidths="159.0,159.0,106.0,106.0" style="Table2"> - <tr> - <td> - <para style="terp_tblheader_General_Centre">Requisition Reference</para> - </td> - <td> - <para style="terp_tblheader_General_Centre">Requisition Date</para> - </td> - <td> - <para style="terp_tblheader_General_Centre">Type</para> - </td> - <td> - <para style="terp_tblheader_General_Centre">Source</para> - </td> - </tr> - </blockTable> - <blockTable colWidths="159.0,159.0,106.0,106.0" style="Table1"> - <tr> - <td> - <para style="terp_default_Centre_8">[[ requisition.name ]]</para> - </td> - <td> - <para style="terp_default_Centre_8">[[ formatLang(requisition.date_start,date_time='True') ]]</para> - </td> - <td> - <para style="terp_default_Centre_8">[[ requisition.exclusive=='multiple' and 'Multiple Requisitions' or requisition.exclusive=='exclusive' and 'Purchase Requisitions (exclusive)' ]]</para> - </td> - <td> - <para style="terp_default_Centre_8">[[ requisition.origin ]]</para> - </td> - </tr> - </blockTable> - <para style="terp_default_8"> - <font color="white"> </font> - </para> - <para style="terp_tblheader_Details">Product Detail [[ requisition.line_ids==[] and removeParentNode('para') ]]</para> - <blockTable colWidths="375.0,71.0,84.0" style="Table4"> - <tr> - <td> - <para style="terp_tblheader_Details">Description [[ requisition.line_ids==[] and removeParentNode('blockTable') ]]</para> - </td> - <td> - <para style="terp_tblheader_Details_Centre">Qty</para> - </td> - <td> - <para style="terp_tblheader_Details_Centre">Product UoM</para> - </td> - </tr> - </blockTable> - <section> - <para style="terp_default_2">[[ requisition.line_ids==[] and removeParentNode('section') ]] [[ repeatIn(requisition.line_ids,'line_ids') ]]</para> - <blockTable colWidths="375.0,71.0,84.0" style="Table5"> - <tr> - <td> - <para style="terp_default_9">[ [[ (line_ids.product_id and line_ids.product_id.code) or '' ]] ] [[ (line_ids.product_id and line_ids.product_id.name) or '' ]]</para> - </td> - <td> - <para style="terp_default_Centre_9">[[ formatLang(line_ids.product_qty) ]]</para> - </td> - <td> - <para style="terp_default_Centre_9">[[ (line_ids.product_uom_id and line_ids.product_uom_id.category_id and line_ids.product_uom_id.category_id.name) or '' ]]</para> - </td> - </tr> - </blockTable> - </section> - <para style="terp_default_8"> - <font color="white"> </font> - </para> - <para style="terp_tblheader_Details">Quotation Detail [[ requisition.purchase_ids ==[] and removeParentNode('para') ]]</para> - <blockTable colWidths="337.0,96.0,97.0" style="Table6"> - <tr> - <td> - <para style="terp_tblheader_Details">Supplier [[ requisition.purchase_ids ==[] and removeParentNode('blockTable') ]]</para> - </td> - <td> - <para style="terp_tblheader_Details_Centre">Date Ordered</para> - </td> - <td> - <para style="terp_tblheader_Details_Centre">Order Reference</para> - </td> - </tr> - </blockTable> - <section> - <para style="terp_default_2">[[ requisition.purchase_ids ==[] and removeParentNode('section') ]] [[ repeatIn(requisition.purchase_ids,'purchase_ids') ]]</para> - <blockTable colWidths="338.0,96.0,96.0" style="Table7"> - <tr> - <td> - <para style="terp_default_9">[[ (purchase_ids.partner_id and purchase_ids.partner_id.name) or '' ]]</para> - </td> - <td> - <para style="terp_default_Centre_9">[[ formatLang(purchase_ids.date_order,date='True') ]]</para> - </td> - <td> - <para style="terp_default_Centre_9">[[ purchase_ids.name ]]</para> - </td> - </tr> - </blockTable> - </section> - </pto> - </story> -</document>
\ No newline at end of file diff --git a/addons/purchase_requisition/report/requisition.py b/addons/purchase_requisition/report/requisition.py deleted file mode 100644 index d7d38f2114e..00000000000 --- a/addons/purchase_requisition/report/requisition.py +++ /dev/null @@ -1,35 +0,0 @@ -# -*- coding: utf-8 -*- -############################################################################## -# -# OpenERP, Open Source Management Solution -# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>). -# -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU Affero General Public License as -# published by the Free Software Foundation, either version 3 of the -# License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Affero General Public License for more details. -# -# You should have received a copy of the GNU Affero General Public License -# along with this program. If not, see <http://www.gnu.org/licenses/>. -# -############################################################################## - -import time -from openerp.report import report_sxw - -class requisition(report_sxw.rml_parse): - def __init__(self, cr, uid, name, context): - super(requisition, self).__init__(cr, uid, name, context=context) - self.localcontext.update({ - 'time': time, - }) - -report_sxw.report_sxw('report.purchase.requisition','purchase.requisition','addons/purchase_requisition/report/purchase_requisition.rml',parser=requisition) - -# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: - diff --git a/addons/purchase_requisition/test/purchase_requisition.yml b/addons/purchase_requisition/test/purchase_requisition.yml index ffea3c2a8ce..579febe64ea 100644 --- a/addons/purchase_requisition/test/purchase_requisition.yml +++ b/addons/purchase_requisition/test/purchase_requisition.yml @@ -84,13 +84,3 @@ !python {model: purchase.requisition}: | requisition = self.browse(cr, uid, ref('requisition1'), context=context) requisition.state == 'done', "Requisition should be closed." -- - I print a Requisition report -- - !python {model: purchase.requisition}: | - import os - import openerp.report - from openerp import tools - data, format = openerp.report.render_report(cr, uid, [ref('purchase_requisition.requisition1')], 'purchase.requisition', {}, {}) - if tools.config['test_report_directory']: - file(os.path.join(tools.config['test_report_directory'], 'purchase_requisition-purchase_requisition_report.'+format), 'wb+').write(data) diff --git a/addons/purchase_requisition/views/report_purchaserequisition.xml b/addons/purchase_requisition/views/report_purchaserequisition.xml new file mode 100644 index 00000000000..249558fbdb6 --- /dev/null +++ b/addons/purchase_requisition/views/report_purchaserequisition.xml @@ -0,0 +1,97 @@ +<?xml version="1.0" encoding="utf-8"?> +<openerp> +<data> +<template id="report_purchaserequisitions"> + <t t-call="report.html_container"> + <t t-foreach="docs" t-as="o"> + <t t-call="report.external_layout"> + <div class="page"> + <div class="oe_structure"/> + + <h2>Purchase for Requisitions <span t-field="o.name"/></h2> + + <div class="row mt32 mb32"> + <div class="col-xs-3"> + <strong>Requisition Reference:</strong><br/> + <span t-field="o.name"/> + </div> + <div class="col-xs-3"> + <strong>Requisition Date:</strong><br/> + <span t-field="o.date_start"/> + </div> + <div class="col-xs-3"> + <strong>Type:</strong><br/> + <span t-if="o.exclusive=='exclusive'">Purchase Requisitions (exclusive)</span> + <span t-if="o.exclusive=='multiple'">Multiple Requisitions</span> + </div> + <div class="col-xs-3"> + <strong>Source:</strong><br/> + <span t-field="o.origin"/> + </div> + </div> + + <t t-if="o.line_ids"> + <h3>Product Detail</h3> + <table class="table table-condensed"> + <thead> + <tr> + <th><strong>Description</strong></th> + <th class="text-right"><strong>Qty</strong></th> + <th class="text-center" groups="product.group_uom"> + <strong>Product UoM</strong> + </th> + </tr> + </thead> + <tbody> + <tr t-foreach="o.line_ids" t-as="line_ids"> + <td> + [ <span t-field="line_ids.product_id.code"/> ] + <span t-field="line_ids.product_id.name"/> + </td> + <td class="text-right"> + <span t-field="line_ids.product_qty"/> + </td> + <t> + <td class="text-center" groups="product.group_uom"> + <span t-field="line_ids.product_uom_id.category_id.name"/> + </td> + </t> + </tr> + </tbody> + </table> + </t> + + <t t-if="o.purchase_ids"> + <h3>Quotation Detail</h3> + <table class="table table-condensed"> + <thead> + <tr> + <th><strong>Supplier </strong></th> + <th><strong>Date Ordered </strong></th> + <th class="text-right"><strong>Order Reference </strong></th> + </tr> + </thead> + <tbody> + <tr t-foreach="o.purchase_ids" t-as="purchase_ids"> + <td> + <span t-field="purchase_ids.partner_id.name"/> + </td> + <td class="text-center"> + <span t-field="purchase_ids.date_order"/> + </td> + <td class="text-right"> + <span t-field="purchase_ids.name"/> + </td> + </tr> + </tbody> + </table> + </t> + + <div class="oe_structure"/> + </div> + </t> + </t> + </t> +</template> +</data> +</openerp> diff --git a/addons/report/__init__.py b/addons/report/__init__.py new file mode 100644 index 00000000000..d08c9d29951 --- /dev/null +++ b/addons/report/__init__.py @@ -0,0 +1,3 @@ +import controllers +import models + diff --git a/addons/report/__openerp__.py b/addons/report/__openerp__.py new file mode 100644 index 00000000000..8ce4e46991c --- /dev/null +++ b/addons/report/__openerp__.py @@ -0,0 +1,23 @@ +{ + 'name': 'Report', + 'category': 'Base', + 'summary': 'Report', + 'version': '1.0', + 'description': """ +Report + """, + 'author': 'OpenERP SA', + 'depends': ['base'], + 'data': [ + 'views/layouts.xml', + 'views/paperformat_view.xml', + 'views/res_company_view.xml', + 'data/report_paperformat.xml', + 'security/ir.model.access.csv', + ], + 'js': [ + 'static/src/js/qwebactionmanager.js', + ], + 'installable': True, + 'auto_install': True, +} diff --git a/addons/report/controllers/__init__.py b/addons/report/controllers/__init__.py new file mode 100644 index 00000000000..cbcfe6fc8a0 --- /dev/null +++ b/addons/report/controllers/__init__.py @@ -0,0 +1,2 @@ +import main + diff --git a/addons/report/controllers/main.py b/addons/report/controllers/main.py new file mode 100644 index 00000000000..f71d4ea7d8b --- /dev/null +++ b/addons/report/controllers/main.py @@ -0,0 +1,537 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# OpenERP, Open Source Management Solution +# Copyright (C) 2014-Today OpenERP SA (<http://www.openerp.com>). +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as +# published by the Free Software Foundation, either version 3 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see <http://www.gnu.org/licenses/>. +# +############################################################################## + +from openerp.osv.osv import except_osv +from openerp.addons.web import http +from openerp.tools.translate import _ +from openerp.addons.web.http import request +import openerp.tools.config as config + +import time +import base64 +import logging +import tempfile +import lxml.html +import subprocess +import simplejson +try: + import cStringIO as StringIO +except ImportError: + import StringIO +import psutil +import signal +import os +from distutils.version import LooseVersion + + +from pyPdf import PdfFileWriter, PdfFileReader +from werkzeug import exceptions +from werkzeug.test import Client +from werkzeug.wrappers import BaseResponse +from werkzeug.datastructures import Headers +from reportlab.graphics.barcode import createBarcodeDrawing + + +_logger = logging.getLogger(__name__) + + +class Report(http.Controller): + + @http.route(['/report/<reportname>/<docids>'], type='http', auth='user', website=True, multilang=True) + def report_html(self, reportname, docids, **kwargs): + """This is the generic route for QWeb reports. It is used for reports + which do not need to preprocess the data (i.e. reports that just display + fields of a record). + + It is given a ~fully qualified report name, for instance 'account.report_invoice'. + Based on it, we know the module concerned and the name of the template. With the + name of the template, we will make a search on the ir.actions.reports.xml table and + get the record associated to finally know the model this template refers to. + + There is a way to declare the report (in module_report(s).xml) that you must respect: + id="action_report_model" + model="module.model" # To know which model the report refers to + string="Invoices" + report_type="qweb-pdf" # or qweb-html + name="module.template_name" + file="module.template_name" + + If you don't want your report listed under the print button, just add + 'menu=False'. + """ + ids = [int(i) for i in docids.split(',')] + ids = list(set(ids)) + report = self._get_report_from_name(reportname) + report_obj = request.registry[report.model] + docs = report_obj.browse(request.cr, request.uid, ids, context=request.context) + + docargs = { + 'doc_ids': ids, + 'doc_model': report.model, + 'docs': docs, + } + + return request.registry['report'].render(request.cr, request.uid, [], report.report_name, + docargs, context=request.context) + + @http.route(['/report/pdf/<path:path>'], type='http', auth="user", website=True) + def report_pdf(self, path=None, landscape=False, **post): + """Route converting any reports to pdf. It will get the html-rendered report, extract + header, page and footer in order to prepare minimal html pages that will be further passed + to wkhtmltopdf. + + :param path: URL of the report (e.g. /report/account.report_invoice/1) + :returns: a response with 'application/pdf' headers and the pdf as content + """ + cr, uid, context = request.cr, request.uid, request.context + + # Get the report we are working on. + # Pattern is /report/module.reportname(?a=1) + reportname_in_path = path.split('/')[1].split('?')[0] + report = self._get_report_from_name(reportname_in_path) + + # Check attachment_use field. If set to true and an existing pdf is already saved, load + # this one now. If not, mark save it. + save_in_attachment = {} + + if report.attachment_use is True: + # Get the record ids we are working on. + path_ids = [int(i) for i in path.split('/')[2].split('?')[0].split(',')] + + save_in_attachment['model'] = report.model + save_in_attachment['loaded_documents'] = {} + + for path_id in path_ids: + obj = request.registry[report.model].browse(cr, uid, path_id) + filename = eval(report.attachment, {'object': obj, 'time': time}) + + if filename is False: # May be false if, for instance, the record is in draft state + continue + else: + alreadyindb = [('datas_fname', '=', filename), + ('res_model', '=', report.model), + ('res_id', '=', path_id)] + + attach_ids = request.registry['ir.attachment'].search(cr, uid, alreadyindb) + if attach_ids: + # Add the loaded pdf in the loaded_documents list + pdf = request.registry['ir.attachment'].browse(cr, uid, attach_ids[0]).datas + pdf = base64.decodestring(pdf) + save_in_attachment['loaded_documents'][path_id] = pdf + _logger.info('The PDF document %s was loaded from the database' % filename) + else: + # Mark current document to be saved + save_in_attachment[path_id] = filename + + # Get the paperformat associated to the report. If there is not, get the one associated to + # the company. + if not report.paperformat_id: + user = request.registry['res.users'].browse(cr, uid, uid, context=context) + paperformat = user.company_id.paperformat_id + else: + paperformat = report.paperformat_id + + # Get the html report. + html = self._get_url_content('/' + path, post)[0] + subst = self._get_url_content('/report/static/src/js/subst.js')[0] # Used in age numbering + css = '' # Local css + + headerhtml = [] + contenthtml = [] + footerhtml = [] + base_url = request.registry['ir.config_parameter'].get_param(cr, uid, 'web.base.url') + + minimalhtml = """ +<base href="{3}"> +<!DOCTYPE html> +<html style="height: 0;"> + <head> + <link href="/report/static/src/css/reset.min.css" rel="stylesheet"/> + <link href="/web/static/lib/bootstrap/css/bootstrap.css" rel="stylesheet"/> + <link href="/website/static/src/css/website.css" rel="stylesheet"/> + <link href="/web/static/lib/fontawesome/css/font-awesome.css" rel="stylesheet"/> + + <style type='text/css'>{0}</style> + + <script type='text/javascript'>{1}</script> + </head> + <body class="container" onload='subst()'> + {2} + </body> +</html>""" + + # The retrieved html report must be simplified. We convert it into a xml tree + # via lxml in order to extract headers, footers and content. + try: + root = lxml.html.fromstring(html) + + for node in root.xpath("//html/head/style"): + css += node.text + + for node in root.xpath("//div[@class='header']"): + body = lxml.html.tostring(node) + header = minimalhtml.format(css, subst, body, base_url) + headerhtml.append(header) + + for node in root.xpath("//div[@class='footer']"): + body = lxml.html.tostring(node) + footer = minimalhtml.format(css, subst, body, base_url) + footerhtml.append(footer) + + for node in root.xpath("//div[@class='page']"): + # Previously, we marked some reports to be saved in attachment via their ids, so we + # must set a relation between report ids and report's content. We use the QWeb + # branding in order to do so: searching after a node having a data-oe-model + # attribute with the value of the current report model and read its oe-id attribute + oemodelnode = node.find(".//*[@data-oe-model='" + report.model + "']") + if oemodelnode is not None: + reportid = oemodelnode.get('data-oe-id', False) + if reportid is not False: + reportid = int(reportid) + else: + reportid = False + + body = lxml.html.tostring(node) + reportcontent = minimalhtml.format(css, '', body, base_url) + contenthtml.append(tuple([reportid, reportcontent])) + + except lxml.etree.XMLSyntaxError: + contenthtml = [] + contenthtml.append(html) + save_in_attachment = {} # Don't save this potentially malformed document + + # Get paperformat arguments set in the root html tag. They are prioritized over + # paperformat-record arguments. + specific_paperformat_args = {} + for attribute in root.items(): + if attribute[0].startswith('data-report-'): + specific_paperformat_args[attribute[0]] = attribute[1] + + # Execute wkhtmltopdf process. + pdf = self._generate_wkhtml_pdf(headerhtml, footerhtml, contenthtml, landscape, + paperformat, specific_paperformat_args, save_in_attachment) + + return self._make_pdf_response(pdf) + + def _get_url_content(self, url, post=None): + """Resolve an internal webpage url and return its content with the help of + werkzeug.test.client. + + :param url: string representing the url to resolve + :param post: a dict representing the query string + :returns: a tuple str(html), int(statuscode) + """ + # Rebuilding the query string. + if post: + url += '?' + url += '&'.join('%s=%s' % (k, v) for (k, v) in post.iteritems()) + + # We have to pass the current headers in order to see the report. + reqheaders = Headers(request.httprequest.headers) + response = Client(request.httprequest.app, BaseResponse).get(url, headers=reqheaders, + follow_redirects=True) + content = response.data + + try: + content = content.decode('utf-8') + except UnicodeDecodeError: + pass + + return tuple([content, response.headers]) + + def _generate_wkhtml_pdf(self, headers, footers, bodies, landscape, + paperformat, spec_paperformat_args=None, save_in_attachment=None): + """Execute wkhtmltopdf as a subprocess in order to convert html given in input into a pdf + document. + + :param header: list of string containing the headers + :param footer: list of string containing the footers + :param bodies: list of string containing the reports + :param landscape: boolean to force the pdf to be rendered under a landscape format + :param paperformat: ir.actions.report.paperformat to generate the wkhtmltopf arguments + :param specific_paperformat_args: dict of prioritized paperformat arguments + :param save_in_attachment: dict of reports to save/load in/from the db + :returns: Content of the pdf as a string + """ + command = ['wkhtmltopdf'] + tmp_dir = tempfile.gettempdir() + + command_args = [] + # Passing the cookie in order to resolve URL. + command_args.extend(['--cookie', 'session_id', request.httprequest.cookies['session_id']]) + + # Display arguments + if paperformat: + command_args.extend(self._build_wkhtmltopdf_args(paperformat, spec_paperformat_args)) + + if landscape and '--orientation' in command_args: + command_args_copy = list(command_args) + for index, elem in enumerate(command_args_copy): + if elem == '--orientation': + del command_args[index] + del command_args[index] + command_args.extend(['--orientation', 'landscape']) + elif landscape and not '--orientation' in command_args: + command_args.extend(['--orientation', 'landscape']) + + pdfdocuments = [] + # HTML to PDF thanks to WKhtmltopdf + for index, reporthtml in enumerate(bodies): + command_arg_local = [] + pdfreport = tempfile.NamedTemporaryFile(suffix='.pdf', prefix='report.tmp.', + mode='w+b') + # Directly load the document if we have it + if save_in_attachment and save_in_attachment['loaded_documents'].get(reporthtml[0]): + pdfreport.write(save_in_attachment['loaded_documents'].get(reporthtml[0])) + pdfreport.seek(0) + pdfdocuments.append(pdfreport) + continue + + # Header stuff + if headers: + head_file = tempfile.NamedTemporaryFile(suffix='.html', prefix='report.header.tmp.', + dir=tmp_dir, mode='w+') + head_file.write(headers[index]) + head_file.seek(0) + command_arg_local.extend(['--header-html', head_file.name]) + + # Footer stuff + if footers: + foot_file = tempfile.NamedTemporaryFile(suffix='.html', prefix='report.footer.tmp.', + dir=tmp_dir, mode='w+') + foot_file.write(footers[index]) + foot_file.seek(0) + command_arg_local.extend(['--footer-html', foot_file.name]) + + # Body stuff + content_file = tempfile.NamedTemporaryFile(suffix='.html', prefix='report.body.tmp.', + dir=tmp_dir, mode='w+') + content_file.write(reporthtml[1]) + content_file.seek(0) + + try: + # If the server is running with only one worker, increase it to two to be able + # to serve the http request from wkhtmltopdf. + if config['workers'] == 1: + ppid = psutil.Process(os.getpid()).ppid + os.kill(ppid, signal.SIGTTIN) + + wkhtmltopdf = command + command_args + command_arg_local + wkhtmltopdf += [content_file.name] + [pdfreport.name] + + process = subprocess.Popen(wkhtmltopdf, stdout=subprocess.PIPE, + stderr=subprocess.PIPE) + out, err = process.communicate() + + if config['workers'] == 1: + os.kill(ppid, signal.SIGTTOU) + + if process.returncode != 0: + raise except_osv(_('Report (PDF)'), + _('wkhtmltopdf failed with error code = %s. ' + 'Message: %s') % (str(process.returncode), err)) + + # Save the pdf in attachment if marked + if reporthtml[0] is not False and save_in_attachment.get(reporthtml[0]): + attachment = { + 'name': save_in_attachment.get(reporthtml[0]), + 'datas': base64.encodestring(pdfreport.read()), + 'datas_fname': save_in_attachment.get(reporthtml[0]), + 'res_model': save_in_attachment.get('model'), + 'res_id': reporthtml[0], + } + request.registry['ir.attachment'].create(request.cr, request.uid, attachment) + _logger.info('The PDF document %s is now saved in the ' + 'database' % attachment['name']) + + pdfreport.seek(0) + pdfdocuments.append(pdfreport) + + if headers: + head_file.close() + if footers: + foot_file.close() + except: + raise + + # Get and return the full pdf + if len(pdfdocuments) == 1: + content = pdfdocuments[0].read() + pdfdocuments[0].close() + else: + content = self._merge_pdf(pdfdocuments) + + return content + + def _build_wkhtmltopdf_args(self, paperformat, specific_paperformat_args=None): + """Build arguments understandable by wkhtmltopdf from an ir.actions.report.paperformat + record. + + :paperformat: ir.actions.report.paperformat record associated to a document + :specific_paperformat_args: a dict containing prioritized wkhtmltopdf arguments + :returns: list of string containing the wkhtmltopdf arguments + """ + command_args = [] + if paperformat.format and paperformat.format != 'custom': + command_args.extend(['--page-size', paperformat.format]) + + if paperformat.page_height and paperformat.page_width and paperformat.format == 'custom': + command_args.extend(['--page-width', str(paperformat.page_width) + 'in']) + command_args.extend(['--page-height', str(paperformat.page_height) + 'in']) + + if specific_paperformat_args and specific_paperformat_args['data-report-margin-top']: + command_args.extend(['--margin-top', + str(specific_paperformat_args['data-report-margin-top'])]) + elif paperformat.margin_top: + command_args.extend(['--margin-top', str(paperformat.margin_top)]) + + if paperformat.margin_left: + command_args.extend(['--margin-left', str(paperformat.margin_left)]) + if paperformat.margin_bottom: + command_args.extend(['--margin-bottom', str(paperformat.margin_bottom)]) + if paperformat.margin_right: + command_args.extend(['--margin-right', str(paperformat.margin_right)]) + if paperformat.orientation: + command_args.extend(['--orientation', str(paperformat.orientation)]) + if paperformat.header_spacing: + command_args.extend(['--header-spacing', str(paperformat.header_spacing)]) + if paperformat.header_line: + command_args.extend(['--header-line']) + if paperformat.dpi: + command_args.extend(['--dpi', str(paperformat.dpi)]) + + return command_args + + def _get_report_from_name(self, report_name): + """Get the first record of ir.actions.report.xml having the argument as value for + the field report_name. + """ + report_obj = request.registry['ir.actions.report.xml'] + qwebtypes = ['qweb-pdf', 'qweb-html'] + + idreport = report_obj.search(request.cr, request.uid, + [('report_type', 'in', qwebtypes), + ('report_name', '=', report_name)]) + + report = report_obj.browse(request.cr, request.uid, idreport[0], + context=request.context) + return report + + def _make_pdf_response(self, pdf): + """Make a request response for a PDF file with correct http headers. + + :param pdf: content of a pdf in a string + :returns: request response for a pdf document + """ + pdfhttpheaders = [('Content-Type', 'application/pdf'), + ('Content-Length', len(pdf))] + return request.make_response(pdf, headers=pdfhttpheaders) + + def _merge_pdf(self, documents): + """Merge PDF files into one. + + :param documents: list of pdf files + :returns: string containing the merged pdf + """ + writer = PdfFileWriter() + for document in documents: + reader = PdfFileReader(file(document.name, "rb")) + for page in range(0, reader.getNumPages()): + writer.addPage(reader.getPage(page)) + document.close() + merged = StringIO.StringIO() + writer.write(merged) + merged.seek(0) + content = merged.read() + merged.close() + return content + + @http.route(['/report/barcode', '/report/barcode/<type>/<path:value>'], type='http', auth="user") + def barcode(self, type, value, width=300, height=50): + """Contoller able to render barcode images thanks to reportlab. + Samples: + <img t-att-src="'/report/barcode/QR/%s' % o.name"/> + <img t-att-src="'/report/barcode/?type=%s&value=%s&width=%s&height=%s' % ('QR', o.name, 200, 200)"/> + + :param type: Accepted types: 'Codabar', 'Code11', 'Code128', 'EAN13', 'EAN8', 'Extended39', + 'Extended93', 'FIM', 'I2of5', 'MSI', 'POSTNET', 'QR', 'Standard39', 'Standard93', + 'UPCA', 'USPS_4State' + """ + try: + width, height = int(width), int(height) + barcode = createBarcodeDrawing( + type, value=value, format='png', width=width, height=height + ) + barcode = barcode.asString('png') + except (ValueError, AttributeError): + raise exceptions.HTTPException(description='Cannot convert into barcode.') + + return request.make_response(barcode, headers=[('Content-Type', 'image/png')]) + + @http.route('/report/download/', type='http', auth="user") + def report_attachment(self, data, token): + """This function is used by 'qwebactionmanager.js' in order to trigger the download of + a report of any type. + + :param data: a javasscript array JSON.stringified containg report internal url ([0]) and + type [1] + :returns: Response with a filetoken cookie and an attachment header + """ + requestcontent = simplejson.loads(data) + url, type = requestcontent[0], requestcontent[1] + file, fileheaders = self._get_url_content(url) + + if type == 'qweb-pdf': + response = self._make_pdf_response(file) + response.headers.add('Content-Disposition', 'attachment; filename=report.pdf;') + elif type == 'controller': + response = request.make_response(file) + response.headers.add('Content-Disposition', fileheaders['Content-Disposition']) + response.headers.add('Content-Type', fileheaders['Content-Type']) + else: + return + + response.headers.add('Content-Length', len(file)) + response.set_cookie('fileToken', token) + return response + + @http.route('/report/check_wkhtmltopdf/', type='json', auth="user") + def check_wkhtmltopdf(self): + """Check the presence of wkhtmltopdf and return its version. If wkhtmltopdf + cannot be found, return False. + """ + try: + process = subprocess.Popen(['wkhtmltopdf', '--version'], stdout=subprocess.PIPE, stderr=subprocess.PIPE) + out, err = process.communicate() + if err: + raise + + version = out.splitlines()[1].strip() + version = version.split(' ')[1] + + if LooseVersion(version) < LooseVersion('0.12.0'): + _logger.warning('Upgrade WKHTMLTOPDF to (at least) 0.12.0') + return 'upgrade' + + return True + except: + _logger.error('You need WKHTMLTOPDF to print a pdf version of this report.') + return False diff --git a/addons/report/data/report_paperformat.xml b/addons/report/data/report_paperformat.xml new file mode 100644 index 00000000000..6b37c07d3b0 --- /dev/null +++ b/addons/report/data/report_paperformat.xml @@ -0,0 +1,40 @@ +<?xml version="1.0" encoding="utf-8"?> +<openerp> + <data> + <record id="paperformat_euro" model="report.paperformat"> + <field name="name">European A4</field> + <field name="default" eval="True" /> + <field name="format">A4</field> + <field name="page_height">0</field> + <field name="page_width">0</field> + <field name="orientation">Portrait</field> + <field name="margin_top">40</field> + <field name="margin_bottom">20</field> + <field name="margin_left">7</field> + <field name="margin_right">7</field> + <field name="header_line" eval="False" /> + <field name="header_spacing">35</field> + <field name="dpi">90</field> + </record> + + <record id="paperformat_us" model="report.paperformat"> + <field name="name">US Letter</field> + <field name="default" eval="True" /> + <field name="format">Letter</field> + <field name="page_height">0</field> + <field name="page_width">0</field> + <field name="orientation">Portrait</field> + <field name="margin_top">40</field> + <field name="margin_bottom">20</field> + <field name="margin_left">7</field> + <field name="margin_right">7</field> + <field name="header_line" eval="False" /> + <field name="header_spacing">35</field> + <field name="dpi">90</field> + </record> + + <record id="base.main_company" model="res.company"> + <field name="paperformat_id" ref="paperformat_euro"></field> + </record> + </data> +</openerp>
\ No newline at end of file diff --git a/addons/report/models/__init__.py b/addons/report/models/__init__.py new file mode 100644 index 00000000000..e048e10eb91 --- /dev/null +++ b/addons/report/models/__init__.py @@ -0,0 +1,2 @@ +import report +import report_paperformat diff --git a/addons/report/models/report.py b/addons/report/models/report.py new file mode 100644 index 00000000000..8a2bc21b3b0 --- /dev/null +++ b/addons/report/models/report.py @@ -0,0 +1,274 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# OpenERP, Open Source Management Solution +# Copyright (C) 2014-Today OpenERP SA (<http://www.openerp.com>). +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as +# published by the Free Software Foundation, either version 3 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see <http://www.gnu.org/licenses/>. +# +############################################################################## + +from openerp.addons.web.http import request +from openerp.osv import osv +from openerp.osv.fields import float as float_field, function as function_field, datetime as datetime_field +from openerp.tools import DEFAULT_SERVER_DATE_FORMAT, DEFAULT_SERVER_DATETIME_FORMAT +from openerp.tools.translate import _ + +import time +from datetime import datetime + +from werkzeug.datastructures import Headers +from werkzeug.wrappers import BaseResponse +from werkzeug.test import Client + + +def get_date_length(date_format=DEFAULT_SERVER_DATE_FORMAT): + return len((datetime.now()).strftime(date_format)) + + +class report(osv.Model): + _name = "report" + _description = "Report" + + public_user = None + + def get_digits(self, obj=None, f=None, dp=None): + d = DEFAULT_DIGITS = 2 + if dp: + decimal_precision_obj = self.pool['decimal.precision'] + ids = decimal_precision_obj.search(request.cr, request.uid, [('name', '=', dp)]) + if ids: + d = decimal_precision_obj.browse(request.cr, request.uid, ids)[0].digits + elif obj and f: + res_digits = getattr(obj._columns[f], 'digits', lambda x: ((16, DEFAULT_DIGITS))) + if isinstance(res_digits, tuple): + d = res_digits[1] + else: + d = res_digits(request.cr)[1] + elif (hasattr(obj, '_field') and + isinstance(obj._field, (float_field, function_field)) and + obj._field.digits): + d = obj._field.digits[1] or DEFAULT_DIGITS + 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): + """ + Assuming 'Account' decimal.precision=3: + formatLang(value) -> digits=2 (default) + formatLang(value, digits=4) -> digits=4 + formatLang(value, dp='Account') -> digits=3 + formatLang(value, digits=5, dp='Account') -> digits=5 + """ + if digits is None: + if dp: + digits = self.get_digits(dp=dp) + else: + digits = self.get_digits(value) + + if isinstance(value, (str, unicode)) and not value: + return '' + + if not self.lang_dict_called: + self._get_lang_dict() + self.lang_dict_called = True + + if date or date_time: + if not str(value): + return '' + + date_format = self.lang_dict['date_format'] + parse_format = DEFAULT_SERVER_DATE_FORMAT + if date_time: + value = value.split('.')[0] + date_format = date_format + " " + self.lang_dict['time_format'] + parse_format = DEFAULT_SERVER_DATETIME_FORMAT + if isinstance(value, basestring): + # FIXME: the trimming is probably unreliable if format includes day/month names + # and those would need to be translated anyway. + date = datetime.strptime(value[:get_date_length(parse_format)], parse_format) + elif isinstance(value, time.struct_time): + date = datetime(*value[:6]) + else: + date = datetime(*value.timetuple()[:6]) + if date_time: + # Convert datetime values to the expected client/context timezone + date = datetime_field.context_timestamp(request.cr, request.uid, + timestamp=date, + context=self.localcontext) + return date.strftime(date_format.encode('utf-8')) + + res = self.lang_dict['lang_obj'].format('%.' + str(digits) + 'f', value, grouping=grouping, monetary=monetary) + if currency_obj: + if currency_obj.position == 'after': + res = '%s %s' % (res, currency_obj.symbol) + elif currency_obj and currency_obj.position == 'before': + res = '%s %s' % (currency_obj.symbol, res) + return res + + def render(self, cr, uid, ids, template, values=None, context=None): + """Allow to render a QWeb template python-side. This function returns the 'ir.ui.view' + render but embellish it with some variables/methods used in reports. + + :param values: additionnal methods/variables used in the rendering + :returns: html representation of the template + """ + if values is None: + values = {} + + if context is None: + context = {} + + self.lang_dict = self.default_lang = {} + self.lang_dict_called = False + self.localcontext = { + 'lang': context.get('lang'), + 'tz': context.get('tz'), + 'uid': context.get('uid'), + } + self._get_lang_dict() + + view_obj = self.pool['ir.ui.view'] + + def render_doc(doc_id, model, template): + """Helper used when a report should be translated into the associated + partner's lang. + + <t t-foreach="doc_ids" t-as="doc_id"> + <t t-raw="render_doc(doc_id, doc_model, 'module.templatetocall')"/> + </t> + + :param doc_id: id of the record to translate + :param model: model of the record to translate + :param template: name of the template to translate into the partner's lang + """ + ctx = context.copy() + doc = self.pool[model].browse(cr, uid, doc_id, context=ctx) + qcontext = values.copy() + # Do not force-translate if we chose to display the report in a specific lang + if ctx.get('translatable') is True: + qcontext['o'] = doc + else: + ctx['lang'] = doc.partner_id.lang + qcontext['o'] = self.pool[model].browse(cr, uid, doc_id, context=ctx) + return view_obj.render(cr, uid, template, qcontext, context=ctx) + + current_user = self.pool['res.users'].browse(cr, uid, uid, context=context) + + # Website independance code + website = False + res_company = current_user.company_id + + try: + website = request.website + res_company = request.website.company_id + except: + pass + + values.update({ + 'time': time, + 'user': current_user, + 'user_id': current_user.id, + 'formatLang': self.formatLang, + 'get_digits': self.get_digits, + 'render_doc': render_doc, + 'website': website, + 'res_company': res_company, + }) + + return view_obj.render(cr, uid, template, values, context=context) + + def get_pdf(self, report, record_id, context=None): + """Used to return the content of a generated PDF. + + :returns: pdf + """ + url = '/report/pdf/report/' + report.report_file + '/' + str(record_id) + reqheaders = Headers(request.httprequest.headers) + reqheaders.pop('Accept') + reqheaders.add('Accept', 'application/pdf') + reqheaders.pop('Content-Type') + reqheaders.add('Content-Type', 'text/plain') + response = Client(request.httprequest.app, BaseResponse).get(url, headers=reqheaders, + follow_redirects=True) + return response.data + + def get_action(self, cr, uid, ids, report_name, datas=None, context=None): + """Used to return an action of type ir.actions.report.xml. + + :param report_name: Name of the template to generate an action for + """ + if context is None: + context = {} + + if datas is None: + datas = {} + + report_obj = self.pool.get('ir.actions.report.xml') + idreport = report_obj.search(cr, uid, [('report_name', '=', report_name)], context=context) + + try: + report = report_obj.browse(cr, uid, idreport[0], context=context) + except IndexError: + raise osv.except_osv(_('Bad Report'), + _('This report is not loaded into the database.')) + + action = { + 'type': 'ir.actions.report.xml', + 'report_name': report.report_name, + 'report_type': report.report_type, + 'report_file': report.report_file, + } + + if datas: + action['datas'] = datas + + return action + + def eval_params(self, dict_param): + """Parse a dictionary generated by the webclient (javascript) into a dictionary + understandable by a wizard controller (python). + """ + for key, value in dict_param.iteritems(): + if value.lower() == 'false': + dict_param[key] = False + elif value.lower() == 'true': + dict_param[key] = True + elif ',' in value: + dict_param[key] = [int(i) for i in value.split(',')] + elif '%2C' in value: + dict_param[key] = [int(i) for i in value.split('%2C')] + else: + try: + i = int(value) + dict_param[key] = i + except (ValueError, TypeError): + pass + + data = {} + data['form'] = dict_param + return data diff --git a/addons/report/models/report_paperformat.py b/addons/report/models/report_paperformat.py new file mode 100644 index 00000000000..e3e747b81a4 --- /dev/null +++ b/addons/report/models/report_paperformat.py @@ -0,0 +1,137 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# OpenERP, Open Source Management Solution +# Copyright (C) 2014-Today OpenERP SA (<http://www.openerp.com>). +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as +# published by the Free Software Foundation, either version 3 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see <http://www.gnu.org/licenses/>. +# +############################################################################## + +from openerp.osv import osv, fields + + +class report_paperformat(osv.Model): + _name = "report.paperformat" + _description = "Allows customization of a report." + + _columns = {'name': fields.char('Name', required=True), + 'default': fields.boolean('Default paper format ?'), + 'format': fields.selection([('A0', 'A0 5 841 x 1189 mm'), + ('A1', 'A1 6 594 x 841 mm'), + ('A2', 'A2 7 420 x 594 mm'), + ('A3', 'A3 8 297 x 420 mm'), + ('A4', 'A4 0 210 x 297 mm, 8.26 x 11.69 inches'), + ('A5', 'A5 9 148 x 210 mm'), + ('A6', 'A6 10 105 x 148 mm'), + ('A7', 'A7 11 74 x 105 mm'), + ('A8', 'A8 12 52 x 74 mm'), + ('A9', 'A9 13 37 x 52 mm'), + ('B0', 'B0 14 1000 x 1414 mm'), + ('B1', 'B1 15 707 x 1000 mm'), + ('B2', 'B2 17 500 x 707 mm'), + ('B3', 'B3 18 353 x 500 mm'), + ('B4', 'B4 19 250 x 353 mm'), + ('B5', 'B5 1 176 x 250 mm, 6.93 x 9.84 inches'), + ('B6', 'B6 20 125 x 176 mm'), + ('B7', 'B7 21 88 x 125 mm'), + ('B8', 'B8 22 62 x 88 mm'), + ('B9', 'B9 23 33 x 62 mm'), + ('B10', ':B10 16 31 x 44 mm'), + ('C5E', 'C5E 24 163 x 229 mm'), + ('Comm10E', 'Comm10E 25 105 x 241 mm, U.S. ' + 'Common 10 Envelope'), + ('DLE', 'DLE 26 110 x 220 mm'), + ('Executive', 'Executive 4 7.5 x 10 inches, ' + '190.5 x 254 mm'), + ('Folio', 'Folio 27 210 x 330 mm'), + ('Ledger', 'Ledger 28 431.8 x 279.4 mm'), + ('Legal', 'Legal 3 8.5 x 14 inches, ' + '215.9 x 355.6 mm'), + ('Letter', 'Letter 2 8.5 x 11 inches, ' + '215.9 x 279.4 mm'), + ('Tabloid', 'Tabloid 29 279.4 x 431.8 mm'), + ('custom', 'Custom')], + 'Paper size', + help="Select Proper Paper size"), + 'margin_top': fields.integer('Top Margin (mm)'), + 'margin_bottom': fields.integer('Bottom Margin (mm)'), + 'margin_left': fields.integer('Left Margin (mm)'), + 'margin_right': fields.integer('Right Margin (mm)'), + 'page_height': fields.integer('Page height (in)'), + 'page_width': fields.integer('Page width (in)'), + 'orientation': fields.selection([('Landscape', 'Landscape'), + ('Portrait', 'Portrait')], + 'Orientation'), + 'header_line': fields.boolean('Display a header line'), + 'header_spacing': fields.integer('Header spacing'), + 'dpi': fields.integer('Output DPI', required=True), + 'report_ids': fields.one2many('ir.actions.report.xml', + 'paperformat_id', + 'Associated reports', + help="Explicitly associated reports") + } + + def _check_format_or_page(self, cr, uid, ids, context=None): + for paperformat in self.browse(cr, uid, ids, context=context): + if paperformat.format != 'custom' and (paperformat.page_width or paperformat.page_height): + return False + return True + + _constraints = [ + (_check_format_or_page, 'Error ! You cannot select a format AND speficic ' + 'page width/height.', ['format']), + ] + + _defaults = { + 'format': 'A4', + 'margin_top': 40, + 'margin_bottom': 20, + 'margin_left': 7, + 'margin_right': 7, + 'page_height': False, + 'page_width': False, + 'orientation': 'Landscape', + 'header_line': False, + 'header_spacing': 35, + 'dpi': 90, + } + + +class res_company(osv.Model): + _inherit = 'res.company' + + _columns = {'paperformat_id': fields.many2one('report.paperformat', 'Paper format')} + + +class ir_actions_report(osv.Model): + _inherit = 'ir.actions.report.xml' + + def associated_view(self, cr, uid, ids, context): + """Used in the ir.actions.report.xml form view in order to search naively after the view(s) + used in the rendering. + """ + if context is None: + context = {} + try: + report_name = self.browse(cr, uid, ids[0], context).report_name + act_window_obj = self.pool.get('ir.actions.act_window') + view_action = act_window_obj.for_xml_id(cr, uid, 'base', 'action_ui_view', context=context) + view_action['context'] = context + view_action['domain'] = [('name', 'ilike', report_name.split('.')[1]), ('type', '=', 'qweb')] + return view_action + except: + return False + + _columns = {'paperformat_id': fields.many2one('report.paperformat', 'Paper format')} diff --git a/addons/report/security/ir.model.access.csv b/addons/report/security/ir.model.access.csv new file mode 100644 index 00000000000..3e46d58154c --- /dev/null +++ b/addons/report/security/ir.model.access.csv @@ -0,0 +1,4 @@ +"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_report_paperformat",,1,0,0,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 diff --git a/addons/report/static/src/css/reset.min.css b/addons/report/static/src/css/reset.min.css new file mode 100644 index 00000000000..cc7842e37ef --- /dev/null +++ b/addons/report/static/src/css/reset.min.css @@ -0,0 +1,2 @@ +/* reset5 2011 opensource.736cs.com MIT - https://code.google.com/p/reset5 */ +html,body,div,span,applet,object,iframe,h1,h2,h3,h4,h5,h6,p,blockquote,pre,a,abbr,acronym,address,big,cite,code,del,dfn,em,font,img,ins,kbd,q,s,samp,small,strike,strong,sub,sup,tt,var,b,i,center,dl,dt,dd,ol,ul,li,fieldset,form,label,legend,table,caption,tbody,tfoot,thead,tr,th,td,article,aside,audio,canvas,details,figcaption,figure,footer,header,hgroup,mark,menu,meter,nav,output,progress,section,summary,time,video{border:0;outline:0;font-size:100%;vertical-align:baseline;background:transparent;margin:0;padding:0;}body{line-height:1;}article,aside,dialog,figure,footer,header,hgroup,nav,section,blockquote{display:block;}nav ul{list-style:none;}ol{list-style:decimal;}ul{list-style:disc;}ul ul{list-style:circle;}blockquote,q{quotes:none;}blockquote:before,blockquote:after,q:before,q:after{content:none;}ins{text-decoration:underline;}del{text-decoration:line-through;}mark{background:none;}abbr[title],dfn[title]{border-bottom:1px dotted #000;cursor:help;}table{border-collapse:collapse;border-spacing:0;}hr{display:block;height:1px;border:0;border-top:1px solid #ccc;margin:1em 0;padding:0;}input[type=submit],input[type=button],button{margin:0!important;padding:0!important;}input,select,a img{vertical-align:middle;} diff --git a/addons/report/static/src/js/qwebactionmanager.js b/addons/report/static/src/js/qwebactionmanager.js new file mode 100644 index 00000000000..8d1550a6e2c --- /dev/null +++ b/addons/report/static/src/js/qwebactionmanager.js @@ -0,0 +1,92 @@ +openerp.report = function(instance) { + + instance.web.ActionManager = instance.web.ActionManager.extend({ + ir_actions_report_xml: function(action, options) { + var self = this; + instance.web.blockUI(); + action = _.clone(action); + var eval_contexts = ([instance.session.user_context] || []).concat([action.context]); + action.context = instance.web.pyeval.eval('contexts',eval_contexts); + _t = instance.web._t; + + // QWeb reports + if ('report_type' in action && (action.report_type == 'qweb-html' || action.report_type == 'qweb-pdf' || action.report_type == 'controller')) { + + var report_url = '' + switch (action.report_type) { + case 'qweb-html': + report_url = '/report/' + action.report_name; + break; + case 'qweb-pdf': + report_url = '/report/pdf/report/' + action.report_name; + break; + case 'controller': + report_url = action.report_file; + break; + default: + report_url = '/report/' + action.report_name; + break; + } + + // single/multiple id(s): no query string + // wizard: query string of action.datas.form + if (!('datas' in action)) { + if ('active_ids' in action.context) { + report_url += "/" + action.context.active_ids.join(','); + } + } else { + _.each(action.datas.form, function(value, key) { + // will be erased when all wizards are rewritten + if (key.substring(0, 12) === 'used_context') { + delete action.datas.form[key]; + } + + if ($.type(value) === 'array') { + action.datas.form[key] = value.join(','); + } + }); + report_url += "?" + $.param(action.datas.form); + } + if (action.report_type == 'qweb-html') { + // Open the html report in a popup + window.open(report_url, '_blank', 'height=768,width=1024'); + instance.web.unblockUI(); + return; + } else { + // Trigger the download of the pdf/custom controller report + var c = openerp.webclient.crashmanager; + var response = new Array() + response[0] = report_url + response[1] = action.report_type + + openerp.session.rpc('/report/check_wkhtmltopdf').then(function (presence) { + // Fallback of qweb-pdf if wkhtmltopdf is not installed + if (!presence && action.report_type == 'qweb-pdf') { + self.do_notify(_t('Report'), _t('Unable to find Wkhtmltopdf on this \ +system. The report will be shown in html.<br><br><a href="http://wkhtmltopdf.org/" _target="blank">\ +wkhtmltopdf.org</a>'), true); + window.open(report_url.substring(12), '_blank', 'height=768,width=1024'); + instance.web.unblockUI(); + } + else { + if (presence == 'upgrade') { + self.do_notify(_t('Report'), _t('You should upgrade your version of\ + Wkhtmltopdf to at least 0.12.0 in order to get a correct display of headers and footers as well as\ + support for table-breaking between pages.<br><br><a href="http://wkhtmltopdf.org/" \ + target="_blank">wkhtmltopdf.org</a>'), true); + } + self.session.get_file({ + url: '/report/download', + data: {data: JSON.stringify(response)}, + complete: openerp.web.unblockUI, + error: c.rpc_error.bind(c) + }); + } + }); + } + } else { + return self._super(action, options); + } + } + }); +}; diff --git a/addons/report/static/src/js/subst.js b/addons/report/static/src/js/subst.js new file mode 100644 index 00000000000..076a5ff208a --- /dev/null +++ b/addons/report/static/src/js/subst.js @@ -0,0 +1,14 @@ +function subst() { + var vars = {}; + var x = document.location.search.substring(1).split('&'); + for (var i in x) { + var z = x[i].split('=', 2); + vars[z[0]] = unescape(z[1]); + } + var x=['frompage', 'topage', 'page', 'webpage', 'section', 'subsection', 'subsubsection']; + for (var i in x) { + var y = document.getElementsByClassName(x[i]); + for (var j=0; j<y.length; ++j) + y[j].textContent = vars[x[i]]; + } +} diff --git a/addons/report/views/layouts.xml b/addons/report/views/layouts.xml new file mode 100644 index 00000000000..73c5ce03244 --- /dev/null +++ b/addons/report/views/layouts.xml @@ -0,0 +1,164 @@ +<?xml version="1.0" encoding="utf-8"?> +<openerp> +<data> +<template id="html_container"> + <!DOCTYPE html> + <html t-att-lang="lang and lang.replace('_', '-')" + t-att-data-website-id="website.id if editable else None" + t-att-data-editable="'1' if editable else None" + t-att-data-translatable="'1' if translatable else None" + t-att-data-view-xmlid="xmlid if editable else None" + t-att-data-main-object="repr(main_object) if editable else None"> + <head> + <meta name="viewport" content="width=device-width, initial-scale=1"/> + + <t t-if="main_object and 'website_meta_title' in main_object"> + <t t-set="title" t-value="main_object.website_meta_title"/> + </t> + <t t-if="not title and main_object and 'name' in main_object"> + <t t-set="additional_title" t-value="main_object.name"/> + </t> + <meta name="openerp.company" t-att-value="res_company.name"/> + <meta name="description" t-att-value="main_object and 'website_meta_description' in main_object + and main_object.website_meta_description or website_meta_description"/> + <meta name="keywords" t-att-value="main_object and 'website_meta_keywords' in main_object + and main_object.website_meta_keywords or website_meta_keywords"/> + + <link id="bootstrap_css" rel='stylesheet' href='/web/static/lib/bootstrap/css/bootstrap.css' t-ignore="true"/> + <link rel="stylesheet" type="text/css" href='/website/static/src/css/website.css'/> + <style type="text/css"> + <t t-call="report.style"/> + </style> + + <link rel='stylesheet' href='/web/static/lib/fontawesome/css/font-awesome.css'/> + + <script type="text/javascript" src="/web/static/lib/es5-shim/es5-shim.min.js"></script> + <script type="text/javascript" src="/web/static/lib/underscore/underscore.js"></script> + <script type="text/javascript" src="/web/static/lib/underscore.string/lib/underscore.string.js"></script> + <script type="text/javascript" src="/web/static/lib/jquery/jquery.js"></script> + <script type="text/javascript" src="/web/static/lib/bootstrap/js/bootstrap.js"></script> + <script type="text/javascript"> + // Bootstrap and jQuery UI conflicts + $.fn.bstooltip = $.fn.tooltip; + $.fn.bsbutton = $.fn.button; + </script> + <script type="text/javascript" src="/web/static/lib/qweb/qweb2.js"></script> + <script type="text/javascript" src="/web/static/src/js/openerpframework.js"></script> + <script type="text/javascript" src="/website/static/src/js/website.js"></script> + <script t-if="not translatable" type="text/javascript" src="/website/static/src/js/website.snippets.animation.js"></script> + <t t-raw="head or ''" name='layout_head'/> + </head> + <body class="container"> + <div id="wrapwrap"> + <t t-raw="0"/> + </div> + </body> + </html> +</template> + +<template id="style"> + body { + color: #000 !important; + } + .border-black td { + border-top: 1px solid black !important; + } + .table-condensed > thead > tr > th { + border-bottom: 1px solid black !important; + } +</template> + +<template id="external_layout"> + <!-- Multicompany --> + <t t-if="o and 'company_id' in o"> + <t t-set="company" t-value="o.company_id"></t> + </t> + <t t-if="not o or not 'company_id' in o"> + <t t-set="company" t-value="res_company"></t> + </t> + + <t t-call="report.external_layout_header" /> + <t t-raw="0" /> + <t t-call="report.external_layout_footer" /> +</template> + +<template id="external_layout_header"> + <div class="header"> + <div class="row"> + <div class="col-xs-3"> + <img t-if="company.logo" t-att-src="'data:image/png;base64,%s' % company.logo"/> + </div> + <div class="col-xs-9 text-right" style="margin-top:20px;" t-field="company.rml_header1"/> + </div> + <div class="row"> + <div class="col-xs-12"> + <div style="border-bottom: 1px solid black;"></div> + </div> + </div> + <div class="row"> + <div class="col-xs-3"> + <div t-field="company.partner_id" + t-field-options='{"widget": "contact", "fields": ["address", "name"], "no_marker": true}' + style="border-bottom: 1px solid black;"/> + </div> + </div> + </div> +</template> + +<template id="external_layout_footer"> + <div class="footer"> + <div class="text-center" style="border-top: 1px solid black;"> + <ul class="list-inline"> + <li t-if="company.phone">Phone: <span t-field="company.phone"/></li> + + <li t-if="company.fax and company.phone">&bull;</li> + <li t-if="company.fax">Fax: <span t-field="company.fax"/></li> + + <li t-if="company.email">&bull;</li> + <li t-if="company.email">Email: <span t-field="company.email"/></li> + + <li t-if="website">&bull;</li> + <li t-if="website">Website: <span t-esc="website.name"/></li> + <br/> + <li><span t-field="company.rml_footer"/></li> + <li t-if="company.rml_footer">|</li> + <li>Page:</li> + <li><span class="page"/></li> + <li>/</li> + <li><span class="topage"/></li> + </ul> + </div> + </div> +</template> + +<template id="internal_layout"> + <!-- Multicompany --> + <t t-if="o and 'company_id' in o"> + <t t-set="company" t-value="o.company_id"></t> + </t> + <t t-if="not o or not 'company_id' in o"> + <t t-set="company" t-value="res_company"></t> + </t> + + <div class="header"> + <div class="row"> + <div class="col-xs-3"> + <span t-esc="time.strftime('%Y-%m-%d')"/> + <span t-esc="time.strftime('%H:%M')"/> + </div> + <div class="col-xs-2 col-xs-offset-2 text-center"> + <span t-esc="company.name"/> + </div> + <div class="col-xs-2 col-xs-offset-3 text-right"> + <ul class="list-inline"> + <li><span class="page"/></li> + <li>/</li> + <li><span class="topage"/></li> + </ul> + </div> + </div> + </div> + <t t-raw="0" /> +</template> +</data> +</openerp> diff --git a/addons/report/views/paperformat_view.xml b/addons/report/views/paperformat_view.xml new file mode 100644 index 00000000000..c885261416b --- /dev/null +++ b/addons/report/views/paperformat_view.xml @@ -0,0 +1,102 @@ +<?xml version="1.0" encoding="utf-8"?> +<openerp> + <data> + + <!-- Adding a paperformat field inside the report form view --> + <record id="act_report_xml_view_inherit" model="ir.ui.view"> + <field name="name">act_report_xml_view_inherit</field> + <field name="inherit_id" ref="base.act_report_xml_view" /> + <field name="model">ir.actions.report.xml</field> + <field name="arch" type="xml"> + <data> + <xpath expr="//field[@name='report_file']" position="after"> + <field name="paperformat_id"/> + <button + type="object" + class="oe_link" + string="Search associated QWeb views" + name="associated_view" + /> + </xpath> + </data> + </field> + </record> + + + <record id="paperformat_view_tree" model="ir.ui.view"> + <field name="name">paper_format_view_tree</field> + <field name="model">report.paperformat</field> + <field name="arch" type="xml"> + <tree string="Paper format configuration"> + <field name="name" /> + </tree> + </field> + </record> + + <record id="paperformat_view_form" model="ir.ui.view"> + <field name="name">paper_format_view_form</field> + <field name="model">report.paperformat</field> + <field name="arch" type="xml"> + <form string="Paper format configuration" version="7.0"> + <group> + <field name="name" /> + <field name="format" /> + <field name="page_height" attrs="{'invisible': [('format','!=','custom')]}" /> + <field name="page_width" attrs="{'invisible': [('format','!=','custom')]}" /> + <field name="orientation" /> + <field name="margin_top" /> + <field name="margin_bottom" /> + <field name="margin_left" /> + <field name="margin_right" /> + <field name="header_line" /> + <field name="header_spacing" /> + <field name="dpi" /> + <field name="report_ids" widget="many2many_tags"/> + </group> + </form> + </field> + </record> + + + <record id="paper_format_action" model="ir.actions.act_window"> + <field name="name">Paper Format General Configuration</field> + <field name="res_model">report.paperformat</field> + <field name="view_type">form</field> + <field name="view_mode">tree,form</field> + </record> + + <record id='reports_action' model='ir.actions.act_window'> + <field name="name">Reports</field> + <field name="res_model">ir.actions.report.xml</field> + <field name="view_type">form</field> + <field name="view_mode">tree,form</field> + </record> + + + <menuitem + id="reporting_menuitem" + name="Reporting" + parent="base.menu_custom" + sequence="0" + groups="base.group_no_one" + /> + + <menuitem + id="paper_format_menuitem" + name="Paper Format" + parent="reporting_menuitem" + action="paper_format_action" + sequence="2" + groups="base.group_no_one" + /> + + <menuitem + id="reports_menuitem" + name="Reports" + parent="reporting_menuitem" + action="reports_action" + sequence="3" + groups="base.group_no_one" + /> + </data> +</openerp>
\ No newline at end of file diff --git a/addons/report/views/res_company_view.xml b/addons/report/views/res_company_view.xml new file mode 100644 index 00000000000..97abd9f5cae --- /dev/null +++ b/addons/report/views/res_company_view.xml @@ -0,0 +1,19 @@ +<?xml version="1.0" encoding="utf-8"?> +<openerp> + <data> + <record id="reporting_settings_form_inherited" model="ir.ui.view"> + <field name="name">view_company_form_inherited</field> + <field name="inherit_id" ref="base.view_company_form" /> + <field name="model">res.company</field> + <field name="arch" type="xml"> + <data> + <xpath expr="//group[@string='Footer Configuration']" position="after"> + <group string="QWeb PDF Configuration"> + <field name="paperformat_id" /> + </group> + </xpath> + </data> + </field> + </record> + </data> +</openerp>
\ No newline at end of file diff --git a/addons/sale/__openerp__.py b/addons/sale/__openerp__.py index 2bea86b41af..bb5bac89e46 100644 --- a/addons/sale/__openerp__.py +++ b/addons/sale/__openerp__.py @@ -77,6 +77,7 @@ The Dashboard for the Sales Manager will include 'board_sale_view.xml', 'edi/sale_order_action_data.xml', 'res_config_view.xml', + 'views/report_saleorder.xml', ], 'demo': ['sale_demo.xml'], 'test': [ diff --git a/addons/sale/report/__init__.py b/addons/sale/report/__init__.py index 6986639d942..12d484c3e25 100644 --- a/addons/sale/report/__init__.py +++ b/addons/sale/report/__init__.py @@ -19,7 +19,6 @@ # ############################################################################## -import sale_order import sale_report # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/addons/sale/report/sale_order.py b/addons/sale/report/sale_order.py deleted file mode 100644 index 134e87a0c2e..00000000000 --- a/addons/sale/report/sale_order.py +++ /dev/null @@ -1,45 +0,0 @@ -# -*- coding: utf-8 -*- -############################################################################## -# -# OpenERP, Open Source Management Solution -# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>). -# -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU Affero General Public License as -# published by the Free Software Foundation, either version 3 of the -# License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Affero General Public License for more details. -# -# You should have received a copy of the GNU Affero General Public License -# along with this program. If not, see <http://www.gnu.org/licenses/>. -# -############################################################################## - -import time - -from openerp.report import report_sxw - -class order(report_sxw.rml_parse): - def __init__(self, cr, uid, name, context=None): - super(order, self).__init__(cr, uid, name, context=context) - self.localcontext.update({ - 'time': time, - 'show_discount':self._show_discount, - }) - - def _show_discount(self, uid, context=None): - cr = self.cr - try: - group_id = self.pool.get('ir.model.data').get_object_reference(cr, uid, 'sale', 'group_discount_per_so_line')[1] - except: - return False - return group_id in [x.id for x in self.pool.get('res.users').browse(cr, uid, uid, context=context).groups_id] - -report_sxw.report_sxw('report.sale.order', 'sale.order', 'addons/sale/report/sale_order.rml', parser=order, header="external") - -# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: - diff --git a/addons/sale/report/sale_order.rml b/addons/sale/report/sale_order.rml deleted file mode 100644 index 3bddf81ade8..00000000000 --- a/addons/sale/report/sale_order.rml +++ /dev/null @@ -1,322 +0,0 @@ -<?xml version="1.0"?> -<document filename="Sales Order.pdf"> - <template title="Sales Order" author="OpenERP S.A.(sales@openerp.com)" allowSplitting="20"> - <pageTemplate id="first"> - <frame id="first" x1="15.0" y1="42.0" width="539" height="758"/> - </pageTemplate> - </template> - <stylesheet> - <blockTableStyle id="Standard_Outline"> - <blockAlignment value="LEFT"/> - <blockValign value="TOP"/> - </blockTableStyle> - <blockTableStyle id="Table1"> - <blockAlignment value="LEFT"/> - <blockValign value="TOP"/> - </blockTableStyle> - <blockTableStyle id="Table2"> - <blockAlignment value="LEFT"/> - <blockValign value="TOP"/> - <lineStyle kind="LINEBEFORE" colorName="#e6e6e6" start="0,0" stop="0,-1"/> - <lineStyle kind="LINEABOVE" colorName="#e6e6e6" start="0,0" stop="0,0"/> - <lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="0,-1" stop="0,-1"/> - <lineStyle kind="LINEBEFORE" colorName="#e6e6e6" start="1,0" stop="1,-1"/> - <lineStyle kind="LINEABOVE" colorName="#e6e6e6" start="1,0" stop="1,0"/> - <lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="1,-1" stop="1,-1"/> - <lineStyle kind="LINEBEFORE" colorName="#e6e6e6" start="2,0" stop="2,-1"/> - <lineStyle kind="LINEABOVE" colorName="#e6e6e6" start="2,0" stop="2,0"/> - <lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="2,-1" stop="2,-1"/> - <lineStyle kind="LINEBEFORE" colorName="#e6e6e6" start="3,0" stop="3,-1"/> - <lineStyle kind="LINEAFTER" colorName="#e6e6e6" start="3,0" stop="3,-1"/> - <lineStyle kind="LINEABOVE" colorName="#e6e6e6" start="3,0" stop="3,0"/> - <lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="3,-1" stop="3,-1"/> - </blockTableStyle> - <blockTableStyle id="Table3"> - <blockAlignment value="LEFT"/> - <blockValign value="TOP"/> - <lineStyle kind="LINEBEFORE" colorName="#e6e6e6" start="0,0" stop="0,-1"/> - <lineStyle kind="LINEABOVE" colorName="#e6e6e6" start="0,0" stop="0,0"/> - <lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="0,-1" stop="0,-1"/> - <lineStyle kind="LINEBEFORE" colorName="#e6e6e6" start="1,0" stop="1,-1"/> - <lineStyle kind="LINEABOVE" colorName="#e6e6e6" start="1,0" stop="1,0"/> - <lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="1,-1" stop="1,-1"/> - <lineStyle kind="LINEBEFORE" colorName="#e6e6e6" start="2,0" stop="2,-1"/> - <lineStyle kind="LINEABOVE" colorName="#e6e6e6" start="2,0" stop="2,0"/> - <lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="2,-1" stop="2,-1"/> - <lineStyle kind="LINEBEFORE" colorName="#e6e6e6" start="3,0" stop="3,-1"/> - <lineStyle kind="LINEAFTER" colorName="#e6e6e6" start="3,0" stop="3,-1"/> - <lineStyle kind="LINEABOVE" colorName="#e6e6e6" start="3,0" stop="3,0"/> - <lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="3,-1" stop="3,-1"/> - </blockTableStyle> - <blockTableStyle id="Table4"> - <blockAlignment value="LEFT"/> - <blockValign value="TOP"/> - <lineStyle kind="LINEBELOW" colorName="#000000" start="0,-1" stop="0,-1"/> - <lineStyle kind="LINEBELOW" colorName="#000000" start="1,-1" stop="1,-1"/> - <lineStyle kind="LINEBELOW" colorName="#000000" start="2,-1" stop="2,-1"/> - <lineStyle kind="LINEBELOW" colorName="#000000" start="3,-1" stop="3,-1"/> - <lineStyle kind="LINEBELOW" colorName="#000000" start="4,-1" stop="4,-1"/> - <lineStyle kind="LINEBELOW" colorName="#000000" start="5,-1" stop="5,-1"/> - </blockTableStyle> - <blockTableStyle id="Table5"> - <blockAlignment value="LEFT"/> - <blockValign value="TOP"/> - <lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="0,-1" stop="0,-1"/> - <lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="1,-1" stop="1,-1"/> - <lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="2,-1" stop="2,-1"/> - <lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="3,-1" stop="3,-1"/> - <lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="4,-1" stop="4,-1"/> - <lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="5,-1" stop="5,-1"/> - <lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="6,-1" stop="6,-1"/> - </blockTableStyle> - <blockTableStyle id="Table6"> - <blockAlignment value="LEFT"/> - <blockValign value="TOP"/> - <lineStyle kind="LINEABOVE" colorName="#ffffff" start="0,0" stop="0,0"/> - <lineStyle kind="LINEABOVE" colorName="#000000" start="1,0" stop="1,0"/> - <lineStyle kind="LINEABOVE" colorName="#000000" start="2,0" stop="2,0"/> - <lineStyle kind="LINEBEFORE" colorName="#ffffff" start="0,1" stop="0,-1"/> - <lineStyle kind="LINEBELOW" colorName="#ffffff" start="0,-1" stop="0,-1"/> - <lineStyle kind="LINEBEFORE" colorName="#ffffff" start="0,2" stop="0,-1"/> - <lineStyle kind="LINEBELOW" colorName="#ffffff" start="0,-1" stop="0,-1"/> - <lineStyle kind="LINEABOVE" colorName="#000000" start="1,2" stop="1,2"/> - <lineStyle kind="LINEABOVE" colorName="#000000" start="2,2" stop="2,2"/> - </blockTableStyle> - <blockTableStyle id="Table7"> - <blockAlignment value="LEFT"/> - <blockValign value="TOP"/> - </blockTableStyle> - <initialize> - <paraStyle name="all" alignment="justify"/> - </initialize> - <paraStyle name="terp_header" fontSize="15.0" leading="19" alignment="LEFT" spaceBefore="12.0" spaceAfter="6.0"/> - <paraStyle name="terp_default_8" fontSize="8.0" leading="10" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/> - <paraStyle name="terp_default_Bold_9" fontSize="9.0" leading="11" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/> - <paraStyle name="terp_default_9" fontSize="9.0" leading="11" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/> - <paraStyle name="terp_tblheader_General_Centre" fontSize="8.0" leading="10" alignment="CENTER" spaceBefore="6.0" spaceAfter="6.0"/> - <paraStyle name="terp_default_Centre_8" fontSize="8.0" leading="10" alignment="CENTER" spaceBefore="0.0" spaceAfter="0.0"/> - <paraStyle name="terp_tblheader_Details" fontSize="9.0" leading="11" alignment="LEFT" spaceBefore="6.0" spaceAfter="6.0"/> - <paraStyle name="terp_tblheader_Details_Centre" fontSize="9.0" leading="11" alignment="CENTER" spaceBefore="6.0" spaceAfter="6.0"/> - <paraStyle name="terp_tblheader_Details_Right" fontSize="9.0" leading="11" alignment="RIGHT" spaceBefore="6.0" spaceAfter="6.0"/> - <paraStyle name="terp_default_Centre_9" fontSize="9.0" leading="11" alignment="CENTER" spaceBefore="0.0" spaceAfter="0.0"/> - <paraStyle name="terp_default_Right_9" fontSize="9.0" leading="11" alignment="RIGHT" spaceBefore="0.0" spaceAfter="0.0"/> - <paraStyle name="terp_default_1" fontSize="2.0" leading="3" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/> - <paraStyle name="terp_default_Right_9_Bold" fontSize="9.0" leading="11" alignment="RIGHT" spaceBefore="0.0" spaceAfter="0.0"/> - <images/> - </stylesheet> - <story> - <pto> - <para style="terp_default_8">[[repeatIn(objects,'o')]]</para> - <para style="terp_default_8">[[ setLang(o.partner_id.lang) ]]</para> - <pto_header> - <blockTable colWidths="181.0,70.0,80.0,70.0,50.0,85.0" repeatRows="1" style="Table4"> - <tr> - <td> - <para style="terp_tblheader_Details"><b>Description</b></para> - </td> - <td> - <para style="terp_tblheader_Details_Centre"><b>Tax</b></para> - </td> - <td> - <para style="terp_tblheader_Details_Right"><b>Quantity</b></para> - </td> - <td> - <para style="terp_tblheader_Details_Right"><b>Unit Price</b></para> - </td> - <td> - <para style="terp_tblheader_Details_Centre"><b>Disc.(%)</b></para> - </td> - <td> - <para style="terp_tblheader_Details_Right"><b>Price</b></para> - </td> - </tr> - </blockTable> - </pto_header> - <para style="terp_default_8"> - <font color="white"> </font> - </para> - <para style="terp_default_8"> - <font color="white"> </font> - </para> - <blockTable colWidths="265.0,51.0,225.0" style="Table1"> - <tr> - <td> - <para style="terp_default_Bold_9"><b>Shipping address :</b></para> - <para style="terp_default_9">[[ (o.partner_shipping_id and o.partner_id.title and o.partner_shipping_id.title.name) or '' ]] [[ (o.partner_shipping_id and o.partner_shipping_id.name) or '' ]]</para> - <para style="terp_default_9">[[ o.partner_shipping_id and display_address(o.partner_shipping_id) ]]</para> - <para style="terp_default_9"> - <font color="white"> </font> - </para> - <para style="terp_default_Bold_9"><b>Invoice address :</b></para> - <para style="terp_default_9">[[ (o.partner_invoice_id and o.partner_invoice_id.title and o.partner_invoice_id.title.name) or '' ]] [[ (o.partner_invoice_id and o.partner_invoice_id.name) or '' ]]</para> - <para style="terp_default_9">[[ o.partner_invoice_id and display_address(o.partner_invoice_id) ]] </para> - </td> - <td> - <para style="terp_default_8"> - <font color="white"> </font> - </para> - </td> - <td> - <para style="terp_default_9">[[ (o.partner_id and o.partner_id.title and o.partner_id.title.name) or '' ]] [[ (o.partner_id and o.partner_id.name) or '' ]]</para> - <para style="terp_default_9">[[ o.partner_id and display_address(o.partner_id) ]] </para> - <para style="terp_default_9"> - <font color="white"> </font> - </para> - <para style="terp_default_9">Tel. : [[ (o.partner_id.phone) or removeParentNode('para') ]]</para> - <para style="terp_default_9">Fax : [[ (o.partner_id.fax) or removeParentNode('para') ]]</para> - <para style="terp_default_9">TVA : [[ (o.partner_id.vat) or removeParentNode('para') ]]</para> - <para style="terp_default_9"> - <font color="white"> </font> - </para> - </td> - </tr> - </blockTable> - <para style="terp_default_8"> - <font color="white"> </font> - </para> - <para style="terp_header"><b>[[ o.state not in ['draft','sent'] and removeParentNode('para') ]] Quotation N° [[ o.name ]]</b></para> - <para style="terp_header"><b>[[ o.state in ['draft','sent'] and removeParentNode('para') ]] Order N° [[ o.name ]]</b></para> - <para style="terp_default_8"> - <font color="white"> </font> - </para> - <blockTable colWidths="132.0,134.0,135.0,135.0" style="Table2"> - <tr> - <td> - <para style="terp_tblheader_General_Centre"><b>Your Reference </b></para> - </td> - <td> - <para style="terp_tblheader_General_Centre"><b>[[ o.state in ['draft','sent'] and removeParentNode('para') ]] Date Ordered</b></para> - <para style="terp_tblheader_General_Centre"><b>[[ o.state not in ['draft','sent'] and removeParentNode('para') ]] Quotation Date</b></para> - </td> - <td> - <para style="terp_tblheader_General_Centre"><b>Salesperson</b></para> - </td> - <td> - <para style="terp_tblheader_General_Centre"><b>Payment Term</b></para> - </td> - </tr> - </blockTable> - <blockTable colWidths="132.0,134.0,135.0,135.0" style="Table3"> - <tr> - <td> - <para style="terp_default_Centre_8">[[ o.client_order_ref ]]</para> - </td> - <td> - <para style="terp_default_Centre_8">[[ formatLang(o.date_order,date = True) ]]</para> - </td> - <td> - <para style="terp_default_Centre_8">[[ (o.user_id and o.user_id.name) or '' ]]</para> - </td> - <td> - <para style="terp_default_Centre_8">[[ (o.payment_term and o.payment_term.name) or '' ]]</para> - </td> - </tr> - </blockTable> - <para style="terp_default_8"> - <font color="white"> </font> - </para> - <blockTable colWidths="181.0,70.0,80.0,70.0,50.0,85.0" repeatRows="1" style="Table4"> - <tr> - <td> - <para style="terp_tblheader_Details"><b>Description</b></para> - </td> - <td> - <para style="terp_tblheader_Details_Centre"><b>Tax</b></para> - </td> - <td> - <para style="terp_tblheader_Details_Right"><b>Quantity</b></para> - </td> - <td> - <para style="terp_tblheader_Details_Right"><b>Unit Price</b></para> - </td> - <td> - <para style="terp_tblheader_Details_Centre"><b>[[not show_discount(user.id) and removeParentNode('para') ]]Disc.(%)</b></para> - </td> - <td> - <para style="terp_tblheader_Details_Right"><b>Price</b></para> - </td> - </tr> - </blockTable> - <section> - <para style="terp_default_1">[[repeatIn(o.order_line,'line')]]</para> - <blockTable colWidths="180.0,70.0,80.0,70.0,50.0,85.0" style="Table5"> - <tr> - <td> - <para style="terp_default_9">[[ format(line.name) ]] </para> - </td> - <td> - <para style="terp_default_Centre_9">[[ ', '.join(map(lambda x: x.name, line.tax_id)) ]]</para> - </td> - <td> - <para style="terp_default_Right_9">[[ formatLang(line.product_uos and line.product_uos_qty or line.product_uom_qty) ]] [[ line.product_uos and line.product_uos.name or line.product_uom.name ]]</para> - </td> - <td> - <para style="terp_default_Right_9">[[ formatLang(line.price_unit , digits=get_digits(dp='Product Price'))]]</para> - </td> - <td> - <para style="terp_default_Centre_9">[[show_discount(user.id) and formatLang(line.discount, digits=get_digits(dp='Discount')) or '']]</para> - </td> - <td> - <para style="terp_default_Right_9">[[ formatLang(line.price_subtotal, digits=get_digits(dp='Account'), currency_obj=o.pricelist_id.currency_id) ]] </para> - </td> - </tr> - </blockTable> - </section> - <blockTable colWidths="381.0,60.0,93.0" style="Table6"> - <tr> - <td> - <para style="terp_default_9"> - <font color="white"> </font> - </para> - </td> - <td> - <para style="terp_default_9">Net Total :</para> - </td> - <td> - <para style="terp_default_Right_9">[[ formatLang(o.amount_untaxed, dp='Account', currency_obj=o.pricelist_id.currency_id) ]]</para> - </td> - </tr> - <tr> - <td> - <para style="terp_default_9"> - <font color="white"> </font> - </para> - </td> - <td> - <para style="terp_default_9">Taxes :</para> - </td> - <td> - <para style="terp_default_Right_9">[[ formatLang(o.amount_tax, dp='Account', currency_obj=o.pricelist_id.currency_id) ]]</para> - </td> - </tr> - <tr> - <td> - <para style="terp_default_9"> - <font color="white"> </font> - </para> - </td> - <td> - <para style="terp_default_Bold_9"><b>Total :</b></para> - </td> - <td> - <para style="terp_default_Right_9_Bold"><b>[[ formatLang(o.amount_total, dp='Account', currency_obj=o.pricelist_id.currency_id) ]]</b></para> - </td> - </tr> - </blockTable> - <para style="terp_default_8"> - <font color="white"> </font> - </para> - <para style="terp_default_9">[[ format(o.note or '') ]]</para> - <blockTable colWidths="533.0" style="Table7"> - <tr> - <td> - <para style="terp_default_9">[[ format(o.payment_term and o.payment_term.note or (o.partner_id.property_payment_term and o.partner_id.property_payment_term.note or '')) ]]</para> - </td> - </tr> - </blockTable> - <para style="terp_default_8"> - <font color="white"> </font> - </para> - </pto> - </story> -</document> diff --git a/addons/sale/sale.py b/addons/sale/sale.py index a8851c654f8..667f15a375d 100644 --- a/addons/sale/sale.py +++ b/addons/sale/sale.py @@ -409,12 +409,7 @@ class sale_order(osv.osv): ''' assert len(ids) == 1, 'This option should only be used for a single id at a time' self.signal_quotation_sent(cr, uid, ids) - datas = { - 'model': 'sale.order', - 'ids': ids, - 'form': self.read(cr, uid, ids[0], context=context), - } - return {'type': 'ir.actions.report.xml', 'report_name': 'sale.order', 'datas': datas, 'nodestroy': True} + return self.pool['report'].get_action(cr, uid, ids, 'sale.report_saleorder', context=context) def manual_invoice(self, cr, uid, ids, context=None): """ create invoices for the given sales orders (ids), and open the form diff --git a/addons/sale/sale_report.xml b/addons/sale/sale_report.xml index 0f77913a3c9..7a8614b139b 100644 --- a/addons/sale/sale_report.xml +++ b/addons/sale/sale_report.xml @@ -1,10 +1,13 @@ <?xml version="1.0" encoding="utf-8"?> <openerp> <data> - - <report auto="False" id="report_sale_order" model="sale.order" name="sale.order" - rml="sale/report/sale_order.rml" string="Quotation / Order" - usage="default"/> - + <report + id="report_sale_order" + string="Quotation / Order" + model="sale.order" + report_type="qweb-pdf" + file="sale.report_saleorder" + name="sale.report_saleorder" + /> </data> </openerp> diff --git a/addons/sale/views/report_saleorder.xml b/addons/sale/views/report_saleorder.xml new file mode 100644 index 00000000000..c6f237e3ac3 --- /dev/null +++ b/addons/sale/views/report_saleorder.xml @@ -0,0 +1,133 @@ +<?xml version="1.0" encoding="utf-8"?> +<openerp> +<data> +<template id="report_saleorder"> + <t t-call="report.html_container"> + <t t-foreach="docs" t-as="o"> + <t t-call="report.external_layout"> + <div class="page"> + <div class="oe_structure"/> + <div class="row"> + <div class="col-xs-6"> + <p t-if="o.partner_shipping_id == o.partner_invoice_id">Invoice and shipping address:</p> + <p t-if="o.partner_shipping_id != o.partner_invoice_id">Invoice address: </p> + <div t-field="o.partner_invoice_id" + t-field-options='{"widget": "contact", "fields": ["address", "name", "phone", "fax"], "no_marker": true}'/> + <p t-if="o.partner_id.vat">VAT: <span t-field="o.partner_id.vat"/></p> + <div t-if="o.partner_shipping_id != o.partner_invoice_id"> + <p>Shipping address :</p> + <div t-field="o.partner_shipping_id" + t-field-options='{"widget": "contact", "fields": ["address", "name", "phone", "fax"], "no_marker": true}'/> + <p t-if="o.partner_id.vat">VAT: <span t-field="o.partner_id.vat"/></p> + </div> + </div> + <div class="col-xs-4 col-xs-offset-2"> + <div t-field="o.partner_id" + t-field-options='{"widget": "contact", "fields": ["address", "name"], "no_marker": true}' /> + </div> + </div> + + <h2> + <span t-if="o.state not in ['draft','sent']">Order N° </span> + <span t-if="o.state in ['draft','sent']">Quotation N° </span> + <span t-field="o.name"/> + </h2> + + <div class="row mt32 mb32"> + <div t-if="o.client_order_ref" class="col-xs-3"> + <strong>Your Reference:</strong> + <p t-field="o.client_order_ref"/> + </div> + <div t-if="o.date_order" class="col-xs-3"> + <strong t-if="o.state not in ['draft','sent']">Date Ordered:</strong> + <strong t-if="o.state in ['draft','sent']">Quotation Date:</strong> + <p t-field="o.date_order"/> + </div> + <div t-if="o.user_id.name" class="col-xs-3"> + <strong>Salesperson:</strong> + <p t-field="o.user_id.name"/> + </div> + <div t-if="o.payment_term" class="col-xs-3"> + <strong>Payment Term:</strong> + <p t-field="o.payment_term"/> + </div> + </div> + + <table class="table table-condensed"> + <thead> + <tr> + <th>Description</th> + <th>Taxes</th> + <th class="text-right">Quantity</th> + <th class="text-right">Unit Price</th> + <th groups="sale.group_discount_per_so_line">Disc.(%)</th> + <th class="text-right">Price</th> + </tr> + </thead> + <tbody> + <tr t-foreach="o.order_line" t-as="l"> + <td> + <span t-field="l.name"/> + </td> + <td> + <span t-esc="', '.join(map(lambda x: x.name, l.tax_id))"/> + </td> + <td class="text-right"> + <span t-field="l.product_uom_qty"/> + <span groups="product.group_uom" t-field="l.product_uom"/> + </td> + <td class="text-right"> + <span t-field="l.price_unit"/> + </td> + <td groups="sale.group_discount_per_so_line"> + <span t-field="l.discount"/> + </td> + <td class="text-right"> + <span t-field="l.price_subtotal" + t-field-options='{"widget": "monetary", "display_currency": "o.pricelist_id.currency_id"}'/> + </td> + </tr> + </tbody> + </table> + + <div class="row"> + <div class="col-xs-4 pull-right"> + <table class="table table-condensed"> + <tr class="border-black"> + <td><strong>Total Without Taxes</strong></td> + <td class="text-right"> + <span t-field="o.amount_untaxed" + t-field-options='{"widget": "monetary", "display_currency": "o.pricelist_id.currency_id"}'/> + </td> + </tr> + <tr> + <td>Taxes</td> + <td class="text-right"> + <span t-field="o.amount_tax" + t-field-options='{"widget": "monetary", "display_currency": "o.pricelist_id.currency_id"}'/> + </td> + </tr> + <tr class="border-black"> + <td><strong>Total</strong></td> + <td class="text-right"> + <span t-field="o.amount_total" + t-field-options='{"widget": "monetary", "display_currency": "o.pricelist_id.currency_id"}'/> + </td> + </tr> + </table> + </div> + </div> + + <p t-field="o.note" /> + <p t-if="o.payment_term"> + <strong>Payment Term:</strong> + <span t-field="o.payment_term"/> + </p> + <div class="oe_structure"/> + </div> + </t> + </t> + </t> +</template> +</data> +</openerp> diff --git a/addons/sale_stock/test/picking_order_policy.yml b/addons/sale_stock/test/picking_order_policy.yml index 83610bdd043..b192c750330 100644 --- a/addons/sale_stock/test/picking_order_policy.yml +++ b/addons/sale_stock/test/picking_order_policy.yml @@ -198,14 +198,3 @@ assert order.invoiced == True, "Sale order is not invoiced." assert order.invoiced_rate == 100, "Invoiced progress is not 100%." assert order.state == 'done', 'Order should be in closed.' -- - I print a sale order report. -- - !python {model: sale.order}: | - import os - import openerp.report - from openerp import tools - data, format = openerp.report.render_report(cr, uid, [ref('sale.sale_order_6')], 'sale.order', {}, {}) - if tools.config['test_report_directory']: - file(os.path.join(tools.config['test_report_directory'], 'sale-sale_order.'+format), 'wb+').write(data) - diff --git a/addons/website/controllers/main.py b/addons/website/controllers/main.py index 6eb9ebc591e..95c7ad82e2b 100644 --- a/addons/website/controllers/main.py +++ b/addons/website/controllers/main.py @@ -45,9 +45,8 @@ class Website(openerp.addons.web.controllers.main.Home): @http.route(website=True, auth="public", multilang=True) def web_login(self, *args, **kw): - response = super(Website, self).web_login(*args, **kw) - response.qcontext['disable_footer'] = True - return response + # TODO: can't we just put auth=public, ... in web client ? + return super(Website, self).web_login(*args, **kw) @http.route('/page/<page:page>', type='http', auth="public", website=True, multilang=True) def page(self, page, **opt): @@ -383,7 +382,6 @@ class Website(openerp.addons.web.controllers.main.Home): #------------------------------------------------------ # Server actions #------------------------------------------------------ - @http.route('/website/action/<path_or_xml_id_or_id>', type='http', auth="public", website=True) def actions_server(self, path_or_xml_id_or_id, **post): cr, uid, context = request.cr, request.uid, request.context diff --git a/addons/website/views/website_templates.xml b/addons/website/views/website_templates.xml index aaabe75a8d2..a465266f707 100644 --- a/addons/website/views/website_templates.xml +++ b/addons/website/views/website_templates.xml @@ -764,15 +764,15 @@ Sitemap: <t t-esc="url_root"/>sitemap.xml <div t-att-class="'name' not in fields and 'css_non_editable_mode_hidden'"><span itemprop="name" t-esc="name"/></div> <div itemprop="address" itemscope="itemscope" itemtype="http://schema.org/PostalAddress"> <div t-if="address and 'address' in fields" class='css_editable_mode_hidden'> - <i class='fa fa-map-marker'/> <span itemprop="streetAddress" t-raw="address.replace('\n', options.get('no_tag_br') and ', ' or '<br/> &nbsp; &nbsp; ')"/> + <i t-if="not options.get('no_marker')" class='fa fa-map-marker'/> <span itemprop="streetAddress" t-raw="address.replace('\n', options.get('no_tag_br') and ', ' or ('<br/>%s' % ('' if options.get('no_marker') else '&nbsp; &nbsp; ')))"/> </div> <div t-if="city and 'city' in fields" class='css_editable_mode_hidden'> - <i class='fa fa-map-marker'/> <span itemprop="addressLocality" t-raw="city"/>, <span itemprop="addressCountry" t-raw="country_id"/> + <i t-if="not options.get('no_marker')" class='fa fa-map-marker'/> <span itemprop="addressLocality" t-raw="city"/>, <span itemprop="addressCountry" t-raw="country_id"/> </div> - <div t-if="phone and 'phone' in fields" class='css_editable_mode_hidden'><i class='fa fa-phone'/> <span itemprop="telephone" t-esc="phone"/></div> - <div t-if="mobile and 'mobile' in fields" class='css_editable_mode_hidden'><i class='fa fa-mobile-phone'/> <span itemprop="telephone" t-esc="mobile"/></div> - <div t-if="fax and 'fax' in fields" class='css_editable_mode_hidden'><i class='fa fa-file-text-o'/> <span itemprop="faxNumber" t-esc="fax"/></div> - <div t-if="email and 'email' in fields" class='css_editable_mode_hidden'><i class='fa fa-envelope'/> <span itemprop="email" t-esc="email"/></div> + <div t-if="phone and 'phone' in fields" class='css_editable_mode_hidden'><i t-if="not options.get('no_marker')" class='fa fa-phone'/> <span itemprop="telephone" t-esc="phone"/></div> + <div t-if="mobile and 'mobile' in fields" class='css_editable_mode_hidden'><i t-if="not options.get('no_marker')" class='fa fa-mobile-phone'/> <span itemprop="telephone" t-esc="mobile"/></div> + <div t-if="fax and 'fax' in fields" class='css_editable_mode_hidden'><i t-if="not options.get('no_marker')" class='fa fa-file-text-o'/> <span itemprop="faxNumber" t-esc="fax"/></div> + <div t-if="email and 'email' in fields" class='css_editable_mode_hidden'><i t-if="not options.get('no_marker')" class='fa fa-envelope'/> <span itemprop="email" t-esc="email"/></div> </div> </address> </template> diff --git a/addons/website_event/controllers/main.py b/addons/website_event/controllers/main.py index 2a6e1d134e3..af7f77d080f 100644 --- a/addons/website_event/controllers/main.py +++ b/addons/website_event/controllers/main.py @@ -187,18 +187,6 @@ class website_event(http.Controller): } return request.website.render("website_event.event_description_full", values) - @http.route(['/event/publish'], type='json', auth="public", website=True) - def publish(self, id, object): - # if a user publish an event, he publish all linked res.partner - event = request.registry[object].browse(request.cr, request.uid, int(id)) - if not event.website_published: - if event.organizer_id and not event.organizer_id.website_published: - event.organizer_id.write({'website_published': True}) - if event.address_id and not event.address_id.website_published: - event.address_id.write({'website_published': True}) - - return controllers.publish(id, object) - @http.route('/event/add_event/', type='http', auth="user", multilang=True, methods=['POST'], website=True) def add_event(self, event_name="New Event", **kwargs): return self._add_event(event_name, request.context, **kwargs) diff --git a/addons/website_event/views/website_event.xml b/addons/website_event/views/website_event.xml index d002521b021..b057aaa7c5d 100644 --- a/addons/website_event/views/website_event.xml +++ b/addons/website_event/views/website_event.xml @@ -189,11 +189,6 @@ </ol> </div> <div class="col-sm-5" groups="event.group_event_manager"> - <t t-call="website.publish_management"> - <t t-set="object" t-value="event"/> - <t t-set="publish_edit" t-value="True"/> - <t t-set="publish_controller">/event/publish</t> - </t> </div> </div> </div> @@ -266,7 +261,6 @@ <t t-call="website.publish_management"> <t t-set="object" t-value="comment"/> <t t-set="publish_edit" t-value="True"/> - <t t-set="publish_controller">/event/publish</t> </t> <t t-raw="comment.body"/> <small class="pull-right muted text-right"> diff --git a/addons/website_event_track/views/website_event.xml b/addons/website_event_track/views/website_event.xml index 14ed725ba5b..b9db5aaa2f0 100644 --- a/addons/website_event_track/views/website_event.xml +++ b/addons/website_event_track/views/website_event.xml @@ -194,6 +194,12 @@ <template id="track_view"> <t t-call="website_event.layout"> <div class="container"> + <t t-call="website.publish_management"> + <t t-set="object" t-value="track"/> + <t t-set="publish_edit" t-value="True"/> + </t> + <div class="clearfix"/> + <h2 t-field="track.name" class="text-center"/> <h3 t-field="event.name" class="text-center text-muted"/> <ul t-if="track.tag_ids" class="text-center text-muted list-inline"> diff --git a/addons/website_report/__init__.py b/addons/website_report/__init__.py new file mode 100644 index 00000000000..e69de29bb2d --- /dev/null +++ b/addons/website_report/__init__.py diff --git a/addons/website_report/__openerp__.py b/addons/website_report/__openerp__.py new file mode 100644 index 00000000000..f35b5032c57 --- /dev/null +++ b/addons/website_report/__openerp__.py @@ -0,0 +1,16 @@ +{ + 'name': 'Website Report', + 'category': 'Website', + 'summary': 'Website Editor on reports', + 'version': '1.0', + 'description': """ +Use the website editor to customize your reports. + """, + 'author': 'OpenERP SA', + 'depends': ['base', 'website', 'report'], + 'data': [ + 'views/layouts.xml', + ], + 'installable': True, + 'auto_install': True, +} diff --git a/addons/website_report/views/layouts.xml b/addons/website_report/views/layouts.xml new file mode 100644 index 00000000000..091bb8dd3db --- /dev/null +++ b/addons/website_report/views/layouts.xml @@ -0,0 +1,80 @@ +<?xml version="1.0" encoding="utf-8"?> +<openerp> +<data> +<template id="editor_head" inherit_id="report.html_container" name="Editor" groups="base.group_website_publisher"> + <xpath expr="//body" position="attributes"> + <attribute name="style">padding-top: 51px;</attribute> + </xpath> + <xpath expr="//body" position="inside"> + <div id="website-top-navbar-placeholder" class="navbar navbar-inverse navbar-fixed-top hidden-xs"> + <div class="navbar-header"> + <form class="navbar-form navbar-left"> + <button type="button" class="btn btn-primary">Edit</button> + </form> + </div> + <div class="collapse navbar-collapse navbar-edit-collapse"> + <ul class="nav navbar-nav navbar-right"> + <li><a href="#" onclick="return false;"><i class="fa fa-mobile" title="Mobile preview"/></a></li> + <li class="divider-vertical"/> + <li><a href="#" onclick="return false;"><span title="Promote page on the web">Promote</span></a></li> + <li class="dropdown"> + <a href="#" onclick="return false;">Content <span class="caret"/></a> + </li> + <li class="dropdown"> + <a href="#" onclick="return false;">Customize <span class="caret"/></a> + </li> + <li class="dropdown"> + <a href="#" onclick="return false;">Help <span class="caret"/></a> + </li> + </ul> + </div> + </div> + </xpath> + <xpath expr='//t[@name="layout_head"]' position="before"> + <link rel='stylesheet' href='/website/static/src/css/snippets.css'/> + <link rel='stylesheet' href='/website/static/src/css/editor.css'/> + <link rel='stylesheet' href='/website/static/lib/bootstrap-tour/bootstrap-tour.css'/> + + + <link rel="stylesheet" href="/web/static/lib/select2/select2.css"/> + <link rel="stylesheet" href="/website/static/lib/select2-bootstrap-css/select2-bootstrap.css"/> + <link rel='stylesheet' href="/web/static/lib/jquery.ui/css/smoothness/jquery-ui-1.9.1.custom.css"/> + + <script type="text/javascript" src="/web/static/lib/select2/select2.js"></script> + <script type="text/javascript" src="/web/static/lib/ckeditor/ckeditor.js"></script> + <script type="text/javascript" src="/website/static/lib/bootstrap-tour/bootstrap-tour.js"></script> + <script t-if="not translatable" type="text/javascript" src="/website/static/lib/ace/ace.js"></script> + <script type="text/javascript" src="/website/static/lib/vkbeautify/vkbeautify.0.99.00.beta.js"></script> + <script type="text/javascript" src="/web/static/lib/jquery.ui/js/jquery-ui-1.9.1.custom.js"></script> + <!-- mutation observers shim backed by mutation events (8 < IE < 11, Safari < 6, FF < 14, Chrome < 17) --> + <script type="text/javascript" src="/website/static/lib//jquery.mjs.nestedSortable/jquery.mjs.nestedSortable.js"></script> + <script type="text/javascript" src="/website/static/lib/MutationObservers/test/sidetable.js"></script> + <script type="text/javascript" src='/website/static/lib/nearest/jquery.nearest.js'></script> + <script type="text/javascript" src="/website/static/lib/MutationObservers/MutationObserver.js"></script> + + <script type="text/javascript" src="/website/static/src/js/website.editor.js"></script> + <script type="text/javascript" src="/website/static/src/js/website.editor.newpage.js" groups="base.group_website_designer"></script> + <script type="text/javascript" src="/website/static/src/js/website.menu.js" groups="base.group_website_designer"></script> + <script type="text/javascript" src="/website/static/src/js/website.mobile.js"></script> + <script type="text/javascript" src="/website/static/src/js/website.seo.js"></script> + <script type="text/javascript" id="website_tour_js" src="/website/static/src/js/website.tour.js"></script> + <script type="text/javascript" src="/website/static/src/js/website.tour.banner.js" groups="base.group_website_designer"></script> + <script t-if="not translatable" type="text/javascript" src="/website/static/src/js/website.snippets.editor.js"></script> + <script t-if="not translatable" type="text/javascript" src="/website/static/src/js/website.ace.js"></script> + <script t-if="translatable" type="text/javascript" src="/website/static/src/js/website.translator.js"></script> + </xpath> + + <xpath expr='//body[@class="container"]/div[@id="wrapwrap"]' position="before"> + <t t-set="languages" t-value="website.get_languages()"/> + <ul class="list-inline js_language_selector mt16" t-if="(len(languages) > 1 or editable)"> + <li t-foreach="languages" t-as="lg"> + <a t-att-href="url_for('', lang=lg[0]) + '?' + keep_query()" + t-att-data-default-lang="editable and 'true' if lg[0] == website.default_lang_code else None"> + <t t-esc="lg[1].split('/').pop()"/> + </a> + </li> + </ul> + </xpath> +</template> +</data> +</openerp> |
