[MERGE] Sync with trunk

bzr revid: rim@openerp.com-20140303131137-2shoyv0ywvgp5fx3
This commit is contained in:
Richard Mathot (OpenERP) 2014-03-03 14:11:37 +01:00
commit dbd02d734b
125 changed files with 2845 additions and 3819 deletions

View File

@ -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',

View File

@ -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"

View File

@ -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

View File

@ -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'])&lt;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'])&lt;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']&lt;&gt;'view' and removeParentNode('font') ]][[ formatLang(o['debit']) ]]</font></para></td>
<td><para style="P6"><font>[[ len(o['level'])&lt;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']&lt;&gt;'view' and removeParentNode('font') ]][[ formatLang(o['credit'])]]</font></para></td>
<td><para style="P6"><font>[[ len(o['level'])&lt;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']&lt;&gt;'view' and removeParentNode('font') ]][[ formatLang(o['tax_amount'], currency_obj=company.currency_id) ]]</font> </para></td>
</tr>
</blockTable>
</story>
</document>

View File

@ -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(report_sxw.rml_parse, common_report_header):
_name = 'report.account.vat.declaration'
def set_context(self, objects, data, ids, report_type=None):
new_ids = ids
class tax_report(http.Controller, common_report_header):
@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)
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:

View File

@ -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>

View File

@ -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:

View File

@ -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',

View File

@ -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')

View File

@ -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>

View File

@ -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

View File

@ -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,
}

View File

@ -1,3 +0,0 @@
import main
# vim:expandtab:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -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:

View File

@ -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 "المستخدمين"

View File

@ -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 ""

View File

@ -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é"

View File

@ -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"

View File

@ -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"

View File

@ -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"

View File

@ -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"

View File

@ -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"

View File

@ -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"

View File

@ -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"

View File

@ -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"

View File

@ -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"

View File

@ -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"

View File

@ -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"

View File

@ -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 "Корисници"

View File

@ -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 "Хэрэглэгчид"

View File

@ -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"

View File

@ -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"

View File

@ -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"

View File

@ -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"

View File

@ -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"

View File

@ -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"

View File

@ -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 "Пользователи"

View File

@ -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"

View File

@ -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"

View File

@ -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"

View File

@ -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"

View File

@ -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 "用户"

View File

@ -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 "使用者"

View File

@ -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

View File

@ -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>

View File

@ -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,
}

View File

@ -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:

View File

@ -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

View File

@ -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];
},
});
};

View File

@ -5,85 +5,95 @@
<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">
<template id="auth_signup.fields" name="Auth Signup/ResetPassword form fields">
<t t-call="web.database_select"/>
<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-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-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">
<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>
<form class="oe_signup_form" role="form" t-attf-action="/web/signup{{ '?debug' if debug else '' }}" method="post" t-if="not message">
<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>
<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-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-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>
<t t-call="auth_signup.fields"/>
<p class="alert alert-danger" t-if="error">
<t t-esc="error"/>
</p>
<p class="alert alert-success" t-if="message">
<t t-esc="message"/>
</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">Sign up</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>
</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="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">Reset password</button>
</div>
</form>
</t>
</template>

View File

@ -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

View File

@ -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',],

View File

@ -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>

View File

@ -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:

View File

@ -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>

View File

@ -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>

View File

@ -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

View File

@ -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>

View File

@ -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:

View File

@ -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:

View File

@ -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>

View File

@ -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:

View File

@ -1,7 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
</data>
</openerp>

View File

@ -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:

View File

@ -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>

View File

@ -224,30 +224,6 @@
assert line.journal_id.id == wc.costs_journal_id.id, "Account Journal is not correspond."
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".
-

View File

@ -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>

View File

@ -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>

View File

@ -21,7 +21,5 @@
import mrp_repair
import wizard
import report
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -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,

View File

@ -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>

View File

@ -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:

View File

@ -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:

View File

@ -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&lt;&gt;'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>

View File

@ -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)

View File

@ -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>

View File

@ -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',
],

View File

@ -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>

View File

@ -19,8 +19,6 @@
#
##############################################################################
import order
import request_quotation
import purchase_report
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -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:

View File

@ -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&lt;&gt;'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>

View File

@ -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:

View File

@ -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>

View File

@ -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)

View File

@ -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>

View File

@ -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>

View File

@ -20,6 +20,4 @@
import purchase_requisition
import wizard
import report
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -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': [

View File

@ -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>

View File

@ -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:

View File

@ -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>

View File

@ -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:

View File

@ -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)

View File

@ -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>

View File

@ -0,0 +1,3 @@
import controllers
import models

View File

@ -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,
}

View File

@ -0,0 +1,2 @@
import main

View File

@ -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&amp;value=%s&amp;width=%s&amp;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

View File

@ -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>

View File

@ -0,0 +1,2 @@
import report
import report_paperformat

Some files were not shown because too many files have changed in this diff Show More