如何创建报告销售订单白色部分

时间:2017-11-08 12:32:47

标签: openerp odoo-8 odoo-9 odoo-10 odoo-view

我想创建报告白色部分,我已在销售线中创建了一个字段部分(见图片)。 [field section[1]

问题是如何使用以下结构创建pdf报告:

structure report

我已经攻击了一个解决方案,但阻止了我的解决方案覆盖功能order_lines_layouted只显示最后一部分(B3,第3节)并继承报告销售订单:

    @api.multi
def order_lines_layouted(self):
    res  = super(SaleOrder, self).order_lines_layouted()
    """
    Returns this order lines classified by sale_layout_category and separated in
    pages according to the category pagebreaks. Used to render the report.
    """
    self.ensure_one()
    report_pages = [[]]
    for category, lines in groupby(self.order_line, lambda l: l.layout_category_id):
        # If last added category induced a pagebreak, this one will be on a new page
        if report_pages[-1] and report_pages[-1][-1]['pagebreak']:
            report_pages.append([])
        # Append category to current report page
        report_pages[-1].append({
            'name': category and category.name or 'Uncategorized',
            'subtotal': category and category.subtotal,
            'pagebreak': category and category.pagebreak,
            'lines': list(lines)
        })
    print "=========report=========",report_pages[0][0]['name']


    return report_pages

QWeb XML继承:

    <?xml version="1.0" encoding="utf-8"?>
<odoo>
    <data>
    <template id="es_sale_layout" inherit_id="sale.report_saleorder_document">
            <xpath expr="//tbody[@class='sale_tbody']//tr/td" position="replace">
                <td colspan="7" style="font-weight: bold; border-bottom: 1px solid black;">&amp;bull;
                    <t t-esc="layout_category['name']"/><br/>
                </td>
            </xpath>
    </template>
    </data>
</odoo>

这是我的解决方案的结果: enter image description here

0 个答案:

没有答案