[FIX] Report: usability fixes + use only custom footer if set, sale_layout: usability fixes + remove constraint on deletion

bzr revid: sle@openerp.com-20140423162614-wrofm5684shscyd3
This commit is contained in:
Simon Lejeune 2014-04-23 18:26:14 +02:00
commit 7edbd315da
6 changed files with 29 additions and 57 deletions

View File

@ -112,7 +112,7 @@
<template id="external_layout_footer">
<div class="footer">
<div class="text-center" style="border-top: 1px solid black;">
<ul class="list-inline">
<ul t-if="not company.custom_footer" class="list-inline">
<li t-if="company.phone">Phone: <span t-field="company.phone"/></li>
<li t-if="company.fax and company.phone">&amp;bull;</li>
@ -121,11 +121,15 @@
<li t-if="company.email">&amp;bull;</li>
<li t-if="company.email">Email: <span t-field="company.email"/></li>
<li t-if="website">&amp;bull;</li>
<li t-if="website">Website: <span t-esc="website.name"/></li>
<br/>
<li><span t-field="company.rml_footer"/></li>
<li t-if="company.rml_footer">|</li>
<li t-if="company.website">&amp;bull;</li>
<li t-if="company.website">Website: <span t-field="company.website"/></li>
</ul>
<t t-if="company.custom_footer">
<span t-raw="company.rml_footer"/>
</t>
<ul class="list-inline">
<li>Page:</li>
<li><span class="page"/></li>
<li>/</li>

View File

@ -99,10 +99,8 @@
<field name="model">res.company</field>
<field name="arch" type="xml">
<data>
<xpath expr="//group[@string='Footer Configuration']" position="after">
<group string="QWeb PDF Configuration">
<field name="paperformat_id" />
</group>
<xpath expr="//page[@string='Report Configuration']/group[@string='Configuration']" position="inside">
<field name="paperformat_id" />
</xpath>
</data>
</field>

View File

@ -5,14 +5,12 @@
<field name="model">res.company</field>
<field name="inherit_id" ref="base.view_company_form"/>
<field name="arch" type="xml">
<notebook position="inside">
<page string="Webkit">
<separator string="Images" colspan="4"/>
<field name="header_image" colspan="4" nolabel="1"/>
<separator string="Headers" colspan="4"/>
<field name="header_webkit" colspan="4" nolabel="1"/>
</page>
</notebook>
<xpath expr="//page[@string='Report Configuration']/group[@string='Configuration']" position="after">
<group string="Configuration (Webkit)" col="2">
<field name="header_image"/>
<field name="header_webkit"/>
</group>
</xpath>
</field>
</record>
</data>

View File

@ -48,7 +48,7 @@
<field name="view_type">form</field>
<field name="view_mode">tree,form</field>
</record>
<menuitem id="menu_webkit" name="Webkit" parent="base.menu_custom"/>
<menuitem id="menu_webkit" name="Webkit" parent="report.reporting_menuitem"/>
<menuitem action="action_header_img" id="menu_header_img" parent="menu_webkit" sequence="14"/>
<record id="action_header_webkit" model="ir.actions.act_window">

View File

@ -56,25 +56,6 @@ class SaleLayoutCategory(osv.Model):
'sequence': 10
}
# We want to forbid edit of a category if it is already linked to a report.
def _check(self, cr, uid, ids):
for cat in self.browse(cr, uid, ids):
invoice_obj = self.pool.get('account.invoice.line')
sale_obj = self.pool.get('sale.order.line')
ids = invoice_obj.search(cr, uid, [('sale_layout_cat_id', '=', cat.id)])
ids += sale_obj.search(cr, uid, [('sale_layout_cat_id', '=', cat.id)])
if len(ids) > 0:
return False
return True
_constraints = [(
_check,
'This category could not be modified nor deleted because it is still used in an invoice or'
' a sale report.', ['name']
)]
class AccountInvoice(osv.Model):
_inherit = 'account.invoice'
@ -98,7 +79,7 @@ class AccountInvoiceLine(osv.Model):
_inherit = 'account.invoice.line'
_columns = {
'sale_layout_cat_id': fields.many2one('sale_layout.category',
'Layout Category'),
string='Section'),
'categ_sequence': fields.related('sale_layout_cat_id',
'sequence', type='integer',
string='Layout Sequence', store=True)
@ -128,7 +109,7 @@ class SaleOrderLine(osv.Model):
_inherit = 'sale.order.line'
_columns = {
'sale_layout_cat_id': fields.many2one('sale_layout.category',
'Layout Category'),
string='Section'),
'categ_sequence': fields.related('sale_layout_cat_id',
'sequence', type='integer',
string='Layout Sequence', store=True)

View File

@ -8,20 +8,10 @@
<field name="inherit_id" ref="sale.view_order_form"/>
<field name="arch" type="xml">
<data>
<xpath expr="//notebook/page/field[@name='order_line']/tree" position="attributes">
<attribute name="editable"></attribute>
<xpath expr="//notebook/page/field[@name='order_line']/tree[@string='Sales Order Lines']/field[@name='product_id']" position="after">
<field name="sale_layout_cat_id"/>
</xpath>
</data>
</field>
</record>
<record model="ir.ui.view" id="view_order_form_inherit_2">
<field name="name">sale.order.line.form.inherit_2</field>
<field name="model">sale.order</field>
<field name="inherit_id" ref="sale.view_order_form"/>
<field name="arch" type="xml">
<data>
<xpath expr="//field[@name='order_line']/form/group/group/field[@name='product_id']" position="before">
<xpath expr="//field[@name='order_line']/form/group/group/field[@name='product_id']" position="after">
<field name="sale_layout_cat_id"/>
</xpath>
</data>
@ -35,9 +25,10 @@
<field name="inherit_id" ref="account.invoice_form"/>
<field name="arch" type="xml">
<data>
<xpath expr="//notebook/page/field[@name='invoice_line']/tree" position="attributes">
<attribute name="editable"></attribute>
</xpath>
<xpath expr="//page[@string='Invoice Lines']/field[@name='invoice_line']/tree/field[@name='product_id']" position="after">
<field name="sale_layout_cat_id"/>
</xpath>
</data>
</field>
</record>
@ -48,7 +39,7 @@
<field name="inherit_id" ref="account.view_invoice_line_form"/>
<field name="arch" type="xml">
<data>
<xpath expr="//group/group/field[@name='product_id']" position="before">
<xpath expr="//group/group/field[@name='product_id']" position="after">
<field name="sale_layout_cat_id"/>
</xpath>
</data>