Openerp 我想修改上下文帐户发票

Openerp 我想修改上下文帐户发票,openerp,odoo-8,odoo-9,odoo-10,odoo-view,Openerp,Odoo 8,Odoo 9,Odoo 10,Odoo View,我想准确地修改上下文帐户发票,我不想填充图片中的字段,我想删除上下文分析帐户和分析标记 谢谢我认为您需要避免自动填写账户字段。它是通过在字段定义中调用类似于\u default\u account的default函数来实现的 原始代码: account_id = fields.Many2one('account.account', string='Account', required=True, domain=[('deprecated', '=', False)], defa

我想准确地修改上下文帐户发票,我不想填充图片中的字段,我想删除上下文分析帐户和分析标记
谢谢

我认为您需要避免自动填写
账户
字段。它是通过在字段定义中调用类似于
\u default\u account
default
函数来实现的

原始代码:

 account_id = fields.Many2one('account.account', string='Account',
    required=True, domain=[('deprecated', '=', False)],
    default=_default_account,
    help="The income or expense account related to the selected product.")
要避免这种情况,请继承account.invoice.line模型,并在不使用默认函数的情况下重新定义该字段

试试这个:

_inherit = 'account.invoice.line'

account_id = fields.Many2one('account.account', string='Account',
    required=True, domain=[('deprecated', '=', False)],
    help="The income or expense account related to the selected product.")

希望对您有所帮助。

您可以将此表以xml格式继承到模块中

 <record id="accountinginvisible name " model="ir.ui.view">
                <field name="name">account.inginvisible</field>
                <field name="model">account.invoice.line</field>
                <field name="inherit_id" ref="accounting(module name).reference from tree or form view id"/>
                <field name="arch" type="xml">
                    <xpath expr="//field[@name='field name']" position="replace" invisible="1">               </xpath>
                </field>
  </record> 

你可以试试这个,我希望它对你有帮助。

你好,我不明白你的问题。你能准确地解释一下你想要什么吗?因为有很多字段都是你填写的。我只想避免2字段分析帐户和分析标记你好,你想隐藏字段分析帐户和分析标记。你为什么要激活(会计/设置)“分析会计”?如果您不想使用此功能,请停用它,字段应消失。我只想避免使用2字段分析帐户和分析标签
classname(models.Model):
_inherit = 'account.invoice.line'