Openerp Odoo 10-帐户移动行导入

Openerp Odoo 10-帐户移动行导入,openerp,odoo-10,Openerp,Odoo 10,在ODOO8中,我们可以为“账户移动”和“账户移动行”导入CSV数据 我正在迁移到Odoo 10:我发现了如何导入“帐户移动”,但我可以在哪里导入移动行(帐户移动行视图上没有“导入”按钮) 塔克斯 Christophe在account.move.line中设置默认树视图create='false' 如果在树状视图中设置了create='false',则odoo将隐藏create和Import按钮 以下是odoo默认视图 <record id="view_move_line_tree

在ODOO8中,我们可以为“账户移动”和“账户移动行”导入CSV数据

我正在迁移到Odoo 10:我发现了如何导入“帐户移动”,但我可以在哪里导入移动行(帐户移动行视图上没有“导入”按钮)

塔克斯


Christophe

account.move.line中设置默认树视图create='false'

如果在树状视图中设置了create='false',则odoo将隐藏createImport按钮

以下是odoo默认视图

    <record id="view_move_line_tree" model="ir.ui.view">
        <field name="name">account.move.line.tree</field>
        <field name="model">account.move.line</field>
        <field eval="1" name="priority"/>
        <field name="arch" type="xml">
            <tree string="Journal Items" create="false">
                <field name="date"/>
                <field name="move_id" required="0"/>
                <field name="journal_id" options='{"no_open":True}'/>
                <field name="name"/>
                <field name="ref"/>
                <field name="statement_id" invisible="1"/>
                <field name="partner_id"/>
                <field name="account_id" options='{"no_open":True}' domain="[('company_id', '=', company_id)]"/>
                <field name="analytic_account_id" groups="analytic.group_analytic_accounting"/>
                <field name="reconciled" invisible="1"/>
                <field name="full_reconcile_id"/>
                <field name="debit" sum="Total Debit"/>
                <field name="credit" sum="Total Credit"/>
                <field name="amount_currency" readonly="True" groups="base.group_multi_currency"/>
                <field name="currency_id" readonly="True" invisible="1" />
                <field name="date_maturity"/>
                <field name="company_currency_id" invisible="1"/>
                <field name="company_id" invisible="1"/>
            </tree>
        </field>
    </record>
    <record id="account.view_move_line_tree" model="ir.ui.view">
        <field name="name">account.move.line.tree</field>
        <field name="model">account.move.line</field>
        <field eval="1" name="priority"/>
        <field name="arch" type="xml">
            <tree string="Journal Items">
                <field name="date"/>
                <field name="move_id" required="0"/>
                <field name="journal_id" options='{"no_open":True}'/>
                <field name="name"/>
                <field name="ref"/>
                <field name="statement_id" invisible="1"/>
                <field name="partner_id"/>
                <field name="account_id" options='{"no_open":True}' domain="[('company_id', '=', company_id)]"/>
                <field name="analytic_account_id" groups="analytic.group_analytic_accounting"/>
                <field name="reconciled" invisible="1"/>
                <field name="full_reconcile_id"/>
                <field name="debit" sum="Total Debit"/>
                <field name="credit" sum="Total Credit"/>
                <field name="amount_currency" readonly="True" groups="base.group_multi_currency"/>
                <field name="currency_id" readonly="True" invisible="1" />
                <field name="date_maturity"/>
                <field name="company_currency_id" invisible="1"/>
                <field name="company_id" invisible="1"/>
            </tree>
        </field>
    </record>
上述条件是odoo基本模块account.move.line创建方法条件。当account.move.line创建时,系统正在检查check\u move\u validity是否为False,则系统不会尝试协调单个移动行

在完成逐行导入工作之后,还需要在自定义模块中继承create和write方法

@api.model
def create(self, vals):
    move_line = super(AccountMoveLine, self.with_context(check_move_validity=False)).create(vals)
    return move_line

@api.multi
def write(self, vals):
    move_line = super(AccountMoveLine, self.with_context(check_move_validity=False)).write(vals)
    return move_line

这可能会对您有所帮助。

有关信息,请访问odoov11.0c 所有这些都是基于ID的,当您导入数据时,请记住account_account_move和account_move_line是链接的,请参见模型类中直接使用的术语

从xls文件中,您可以使用以下第一行单元格名称从标准菜单“帐户移动”和“帐户移动”行导入: 杂志 日期 身份证件 生产线标识/合作伙伴标识 数 参考 行/借项 行标识/信用 叙述 行标识/匹配号/编号 行\ ID/到期日
行标识/对应项
行id/帐户id 地位


希望有此帮助

我尝试了此解决方案,是的,我很高兴看到“导入”按钮出现!但不幸的是,当我想导入一些移动行(平衡良好)时,奥多说它无法导入第一行,因为它是不平衡的!(显然,Odoo是逐行检查,而不是只检查一个动作的所有行)。我已编辑了我的答案,您可以尝试使用不同的方式。非常感谢您提供此解决方案!
@api.model
def create(self, vals):
    move_line = super(AccountMoveLine, self.with_context(check_move_validity=False)).create(vals)
    return move_line

@api.multi
def write(self, vals):
    move_line = super(AccountMoveLine, self.with_context(check_move_validity=False)).write(vals)
    return move_line