如何从odoo中的帐户模块继承合作伙伴分类帐报表模板?

时间:2016-01-14 07:14:56

标签: report odoo-8 openerp-8

我如何继承帐户模块中可用的合作伙伴分类帐报表模板,以便在我转到会计>客户>选择像agrolait这样的客户>点击打印按钮>点击合作伙伴分类帐>现在再次点击打印它显示了一些额外的内容,如帐户图表,fiscalyear,fiterby等,我不需要。

意味着我需要通过替换不需要的内容来重新设计模板。 任何人都可以帮我解决这个问题。 任何答案将不胜感激。提前谢谢。

3 个答案:

答案 0 :(得分:0)

我是Openerp 6/8用户,但希望您能够将我的答案翻译成Odoo。

首先,文档 - https://www.odoo.com/documentation/8.0/howtos/backend.html#inheritance

通常情况下,你需要做三件事 - 找一个你要继承的地方,继承Python模型然后最后继承视图。

如果您只需要更改视图而不访问已有的数据,那么通常您可以跳过Python继承部分。据我了解,情况确实如此。

来自文档:

<!-- improved idea categories list -->
    <record id="idea_category_list2" model="ir.ui.view">
        <field name="name">id.category.list2</field>
        <field name="model">idea.category</field>
        <field name="inherit_id" ref="id_category_list"/>
        <field name="arch" type="xml">
            <!-- find field description and add the field
                 idea_ids after it -->
            <xpath expr="//field[@name='description']" position="after">
              <field name="idea_ids" string="Number of ideas"/>
            </xpath>
        </field>
    </record>

您需要将数据添加到xml文件中(已存在或通过创建新文件)在其依赖项中具有继承模块的模块中。你问这个数据是什么?嗯,这是一个视图继承记录!基于上面的例子,让我解释一下所有领域:

  
      
  • record_id是视图继承的新的唯一名称(使用下划线,因为点暗示您正在覆盖另一个视图   模块,只要你不完全,你就不需要这样做   替换视图)。在record_id中,模型总是'ir.ui.view',因为你是   与视图合作。
  •   
  • model与继承视图中的相同。
  •   
  • name是视图继承的新唯一名称(主要使用点作为空格)
  •   
  • inherit_id - 这是重要部分。使用符号module_name.view_id,这里提供view_id   继承。
  •   

对于'arch'标记中的内容,您可以使用xpath查找要编辑或替换的区域。在上面的示例中,此继承查找字段'description'并在其后插入'idea_ids'字段。

如果您需要更多帮助,请查看我链接的文档或回到此处并提出要求!

至于报告继承,只是为了忏悔自己。

https://www.odoo.com/documentation/8.0/reference/reports.html#report-template

我认为您需要做的是通过在xml生命中创建新的<report>记录来覆盖报告记录,如下所示。继承的报告记录与您的新记录之间的差异通常仅在“id”和“file”值中。

   <report
        id="account_invoices"
        model="account.invoice"
        string="Invoices"
        report_type="qweb-pdf"
        name="account.report_invoice"
        file="account.report_invoice"
        attachment_use="True"
        attachment="(object.state in ('open','paid')) and
            ('INV'+(object.number or '').replace('/','')+'.pdf')"
    />

对于Odoo 6(希望是8),您可以通过将其ID更改为/module_name.inherited_id/来覆盖报告记录。例如,如果您从“account”模块继承account_invoice_summary报告,则id将为“account.account_invoice_summary”。第二件事是将“文件”值更改为与编辑模板对应的值。这取决于几个因素 - 您是否正在尝试创建打印报告(我假设您正在尝试这样做)或其他内容?

答案 1 :(得分:0)

嘿伙计们,我得到了这个问题的解决方案,请看看这个 转到Setting > Reports > Reports > filter partner进行搜索,然后打开partner > go to search associated qweb view > open report_partnerledger > select EXTERNAL ID;这是你的inherit_id。 最重要的是不要忘记升级基础模块,因为它依赖于res.partner,所以如果你只升级你的模块,那么它将显示未找到外部id的错误,所以在基础模块升级之后你现在可以改变或替换像我在下面做了改变:

<template id="report_partnerledger_inherit2" inherit_id="account.report_partnerledger">

        <xpath expr="//h2" position="replace">
            <h1>Ipshita Nandan</h1>
         </xpath>

         <xpath expr="//div[@class='col-xs-3']" position="replace">
            <strong>Change chart of account:</strong>
         </xpath>

         <xpath expr="//div[@class='col-xs-3']" position="replace">
            <strong>change fiscal year:</strong>
         </xpath>

         <xpath expr="//div[@class='col-xs-3']" position="replace">
            <strong>Change Journals:</strong>
         </xpath>

         <xpath expr="//div[@class='col-xs-3']" position="replace">
            <strong>Change partner's:</strong>
         </xpath>

</template>

答案 2 :(得分:0)

从报告下的设置中查找合作伙伴分类帐报表的继承ID,并在模板中使用它,如下所示,并升级基础模块。

<template id="report_partnerledger_inherit2" inherit_id="account.report_partnerledger">

        <xpath expr="//h2" position="replace">
            <h1>replace and add anythings  </h1>
         </xpath>

         <xpath expr="//div[@class='col-xs-3']" position="replace">
            <strong>Change chart of account:</strong>
         </xpath>

         <xpath expr="//div[@class='col-xs-3']" position="replace">
            <strong>change fiscal year:</strong>
         </xpath>

</template>
相关问题