[MERGE] forward port of branch 8.0 up to 6f29cbe

This commit is contained in:
Denis Ledoux
2015-11-23 17:40:15 +01:00
11 changed files with 95 additions and 102 deletions
+3 -1
View File
@@ -54,7 +54,9 @@ class publisher_warranty_contract(AbstractModel):
"web_base_url": web_base_url,
"apps": [app['name'] for app in apps],
}
msg.update(self.pool.get("res.company").read(cr, uid, [1], ["name", "email", "phone"])[0])
if user.partner_id.company_id:
company_id = user.partner_id.company_id.id
msg.update(self.pool.get("res.company").read(cr, uid, [company_id], ["name", "email", "phone"])[0])
return msg
def _get_sys_logs(self, cr, uid):
-1
View File
@@ -1228,7 +1228,6 @@
<field name="picking_id" string="Reference" invisible="1"/>
<field name="sequence" invisible="1"/>
<field name="origin"/>
<field name="partner_id" string="Supplier"/>
<field name="product_id"/>
<field name="product_uom_qty"/>
<field name="product_uom" string="Unit of Measure" groups="product.group_uom"/>
+2 -2
View File
@@ -317,10 +317,10 @@ var py = {};
} else if (token in symbols) {
var symbol;
// transform 'not in' and 'is not' in a single token
if (token === 'in' && tokens[tokens.length-1].id === 'not') {
if (token === 'in' && tokens.length > 1 && tokens[tokens.length-1].id === 'not') {
symbol = symbols['not in'];
tokens.pop();
} else if (token === 'not' && tokens.length > 0 && tokens[tokens.length-1].id === 'is') {
} else if (token === 'not' && tokens.length > 1 && tokens[tokens.length-1].id === 'is') {
symbol = symbols['is not'];
tokens.pop();
} else {
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<templates>
<t t-name="fixed-literal">
<Año t-att-falló="'agüero'"/>
</t>
<result id="fixed-literal"><![CDATA[<Año falló="agüero"></Año>]]></result>
</templates>
+13
View File
@@ -1,3 +1,16 @@
openerp.testing.section('eval.basics', {
dependencies: ['web.core'],
setup: function (instance) {
instance.session.uid = 42;
}
}, function (test) {
test('not prefix', function (instance) {
ok(py.eval('not False'));
ok(py.eval('not foo', {foo: false}));
ok(py.eval('not a in b', {a: 3, b: [1, 2, 4, 8]}));
});
});
openerp.testing.section('eval.types', {
dependencies: ['web.core'],
setup: function (instance) {
+5 -4
View File
@@ -195,10 +195,11 @@ class view(osv.osv):
qcontext.update(values)
# in edit mode ir.ui.view will tag nodes
if qcontext.get('editable'):
context = dict(context, inherit_branding=True)
elif request.registry['res.users'].has_group(cr, uid, 'base.group_website_publisher'):
context = dict(context, inherit_branding_auto=True)
if not qcontext.get('rendering_bundle'):
if qcontext.get('editable'):
context = dict(context, inherit_branding=True)
elif request.registry['res.users'].has_group(cr, uid, 'base.group_website_publisher'):
context = dict(context, inherit_branding_auto=True)
view_obj = request.website.get_template(id_or_xml_id)
if 'main_object' not in qcontext:
@@ -19,83 +19,6 @@
<!-- Mails & quote templates is done in a NOUPDATE block
so users can freely customize/delete them -->
<data noupdate="1">
<record id="sale.email_template_edi_sale" model="mail.template">
<field name="body_html"><![CDATA[
<div style="font-family: 'Lucica Grande', Ubuntu, Arial, Verdana, sans-serif; font-size: 12px; color: rgb(34, 34, 34); background-color: #FFF; ">
<p>Hello ${object.partner_id.name},</p>
<p>Here is your ${object.state in ('draft', 'sent') and 'quotation' or 'order confirmation'} from ${object.company_id.name}: </p>
<p style="border-left: 1px solid #8e0000; margin-left: 30px;">
&nbsp;&nbsp;<strong>REFERENCES</strong><br />
&nbsp;&nbsp;Order number: <strong>${object.name}</strong><br />
&nbsp;&nbsp;Order total: <strong>${object.amount_total} ${object.pricelist_id.currency_id.name}</strong><br />
&nbsp;&nbsp;Order date: ${object.date_order}<br />
% if object.origin:
&nbsp;&nbsp;Order reference: ${object.origin}<br />
% endif
% if object.client_order_ref:
&nbsp;&nbsp;Your reference: ${object.client_order_ref}<br />
% endif
% if object.user_id:
&nbsp;&nbsp;Your contact: <a href="mailto:${object.user_id.email or ''}?subject=Order%20${object.name}">${object.user_id.name}</a>
% endif
</p>
<p>
You can view your quotation online:
</p>
<a style="display:block; width: 150px; height:20px; margin-left: 120px; color: #DDD; font-family: 'Lucida Grande', Helvetica, Arial, sans-serif; font-size: 13px; font-weight: bold; text-align: center; text-decoration: none !important; line-height: 1; padding: 5px 0px 0px 0px; background-color: #8E0000; border-radius: 5px 5px; background-repeat: repeat no-repeat;"
href="/quote/${object.id}/${object.access_token}">View ${object.state in ('draft', 'sent') and 'Quotation' or 'Order'}</a>
% if object.paypal_url:
<br/>
<p>It is also possible to directly pay with Paypal:</p>
<a style="margin-left: 120px;" href="${object.paypal_url}">
<img class="oe_edi_paypal_button" src="/sale/static/img/btn_paynowcc_lg.gif"/>
</a>
% endif
<br/>
<p>If you have any question, do not hesitate to contact us.</p>
<p>Thank you for choosing ${object.company_id.name or 'us'}!</p>
<br/>
<br/>
<div style="width: 375px; margin: 0px; padding: 0px; background-color: #8E0000; border-top-left-radius: 5px 5px; border-top-right-radius: 5px 5px; background-repeat: repeat no-repeat;">
<h3 style="margin: 0px; padding: 2px 14px; font-size: 12px; color: #DDD;">
<strong style="text-transform:uppercase;">${object.company_id.name}</strong></h3>
</div>
<div style="width: 347px; margin: 0px; padding: 5px 14px; line-height: 16px; background-color: #F2F2F2;">
<span style="color: #222; margin-bottom: 5px; display: block; ">
% if object.company_id.street:
${object.company_id.street}<br/>
% endif
% if object.company_id.street2:
${object.company_id.street2}<br/>
% endif
% if object.company_id.city or object.company_id.zip:
${object.company_id.zip} ${object.company_id.city}<br/>
% endif
% if object.company_id.country_id:
${object.company_id.state_id and ('%s, ' % object.company_id.state_id.name) or ''} ${object.company_id.country_id.name or ''}<br/>
% endif
</span>
% if object.company_id.phone:
<div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; ">
Phone:&nbsp; ${object.company_id.phone}
</div>
% endif
% if object.company_id.website:
<div>
Web :&nbsp;<a href="${object.company_id.website}">${object.company_id.website}</a>
</div>
%endif
<p></p>
</div>
</div>
]]></field>
</record>
<record id="website_quote_template_default" model="sale.quote.template">
<field name="name">Default Template</field>
<field name="number_of_days">30</field>
@@ -200,15 +123,11 @@
&nbsp;&nbsp;Your contact: <a href="mailto:${object.user_id.email or ''}?subject=Order%20${object.name}">${object.user_id.name}</a>
% endif
</p>
% set signup_url = object.get_signup_url()
% if signup_url and object.amount_total:
<p>
You can access this document and pay online via our Customer Portal:
You can view your quotation online:
</p>
<a style="display:block; width: 150px; height:20px; margin-left: 120px; color: #DDD; font-family: 'Lucida Grande', Helvetica, Arial, sans-serif; font-size: 13px; font-weight: bold; text-align: center; text-decoration: none !important; line-height: 1; padding: 5px 0px 0px 0px; background-color: #8E0000; border-radius: 5px 5px; background-repeat: repeat no-repeat;"
href="${signup_url}">View ${object.state in ('draft', 'sent') and 'Quotation' or 'Order'}</a>
% endif
<a style="display:block; width: 150px; height:20px; margin-left: 120px; color: #DDD; font-family: 'Lucida Grande', Helvetica, Arial, sans-serif; font-size: 13px; font-weight: bold; text-align: center; text-decoration: none !important; line-height: 1; padding: 5px 0px 0px 0px; background-color: #8E0000; border-radius: 5px 5px; background-repeat: repeat no-repeat;"
href="/quote/${object.id}/${object.access_token}">View ${object.state in ('draft', 'sent') and 'Quotation' or 'Order'}</a>
% if object.paypal_url and object.amount_total:
<br/>
+24
View File
@@ -1622,6 +1622,30 @@ http://localhost:8069/report/html/account.report_invoice/1 (if ``account`` is
installed) and the PDF version through
http://localhost:8069/report/pdf/account.report_invoice/1.
.. _reference/backend/reporting/printed-reports/pdf-without-styles:
.. danger::
If it appears that your PDF report is missing the styles (i.e. the text
appears but the style/layout is different from the html version), probably
your wkhtmltopdf_ process cannot reach your web server to download them.
If you check your server logs and see that the CSS styles are not being
downloaded when generating a PDF report, most surely this is the problem.
The wkhtmltopdf_ process will use the ``web.base.url`` system parameter as
the *root path* to all linked files, but this parameter is automatically
updated each time the Administrator is logged in. If your server resides
behind some kind of proxy, that could not be reachable. You can fix this by
adding one of these system parameters:
- ``report.url``, pointing to an URL reachable from your server
(probably ``http://localhost:8069`` or something similar). It will be
used for this particular purpose only.
- ``web.base.url.freeze``, when set to ``True``, will stop the
automatic updates to ``web.base.url``.
.. exercise:: Create a report for the Session model
For each session, it should display session's name, its start and end,
+6 -5
View File
@@ -216,19 +216,20 @@ Useful Remarks
* Twitter Bootstrap and FontAwesome classes can be used in your report
template
* Local CSS can be put directly in the template
* Global CSS can be inserted in the main report layout by inheriting its
template and inserting your CSS::
<template id="report_saleorder_style" inherit_id="report.layout">
<xpath expr="//style" position="after">
<style type="text/css">
<template id="report_saleorder_style" inherit_id="report.style">
<xpath expr=".">
<t>
.example-css-class {
background-color: red;
}
</style>
</t>
</xpath>
</template>
* If it appears that your PDF report is missing the styles, please check
:ref:`these instructions <reference/backend/reporting/printed-reports/pdf-without-styles>`.
.. _reference/reports/paper_formats:
+7 -5
View File
@@ -136,8 +136,9 @@ class QWeb(orm.AbstractModel):
_name = 'ir.qweb'
_void_elements = frozenset([
'area', 'base', 'br', 'col', 'embed', 'hr', 'img', 'input', 'keygen',
'link', 'menuitem', 'meta', 'param', 'source', 'track', 'wbr'])
u'area', u'base', u'br', u'col', u'embed', u'hr', u'img', u'input',
u'keygen', u'link', u'menuitem', u'meta', u'param', u'source',
u'track', u'wbr'])
_format_regex = re.compile(
'(?:'
# ruby-style pattern
@@ -270,7 +271,7 @@ class QWeb(orm.AbstractModel):
_logger.warning("@t-debug in template '%s' is only available in --dev mode" % qwebcontext['__template__'])
for (attribute_name, attribute_value) in element.attrib.iteritems():
attribute_name = str(attribute_name)
attribute_name = unicode(attribute_name)
if attribute_name == "groups":
cr = qwebcontext.get('request') and qwebcontext['request'].cr or None
uid = qwebcontext.get('request') and qwebcontext['request'].uid or None
@@ -314,7 +315,7 @@ class QWeb(orm.AbstractModel):
# generated_attributes: generated attributes
# qwebcontext: values
# inner: optional innerXml
name = str(element.tag)
name = unicode(element.tag)
if inner:
g_inner = inner.encode('utf-8') if isinstance(inner, unicode) else inner
else:
@@ -346,7 +347,7 @@ class QWeb(orm.AbstractModel):
for qwebcontext in (name, generated_attributes, inner, name)
)
else:
return "<%s%s/>" % (name, generated_attributes)
return "<%s%s/>" % (name.encode("utf-8"), generated_attributes)
def render_attribute(self, element, name, value, qwebcontext):
return _build_attribute(name, value)
@@ -1109,6 +1110,7 @@ class AssetsBundle(object):
context = self.context.copy()
context['inherit_branding'] = False
context['inherit_branding_auto'] = False
context['rendering_bundle'] = True
self.html = self.registry['ir.ui.view'].render(self.cr, self.uid, xmlid, context=context)
self.parse()
+24
View File
@@ -5316,6 +5316,11 @@ class BaseModel(object):
""" Returns a new version of this recordset attached to the provided
environment
.. warning::
The new environment will not benefit from the current
environment's data cache, so later data access may incur extra
delays while re-fetching from the database.
:type env: :class:`~openerp.api.Environment`
"""
return self._browse(env, self._ids)
@@ -5325,6 +5330,25 @@ class BaseModel(object):
Returns a new version of this recordset attached to the provided
user.
By default this returns a `SUPERUSER` recordset, where access control
and record rules are bypassed.
.. note::
Using `sudo` could cause data access to cross the boundaries of
record rules, possibly mixing records that are meant to be
isolated (e.g. records from different companies in multi-company
environments).
It may lead to un-intuitive results in methods which select one
record among many - for example getting the default company, or
selecting a Bill of Materials.
.. note::
Because the record rules and access control will have to be
re-evaluated, the new recordset will not benefit from the current
environment's data cache, so later data access may incur extra
delays while re-fetching from the database.
"""
return self.with_env(self.env(user=user))