【问题标题】:Get field from module then put it to another modul (custom module) odoo 10从模块获取字段,然后将其放入另一个模块(自定义模块)odoo 10
【发布时间】:2017-09-15 06:45:47
【问题描述】:

我正在浪费时间了解如何从制造模块 odoo 中的物料清单 (BOM) 中获取字段,以便在 odoo 库存模块中的产品类别表单中使用它。

这里是细节

查看物料清单表单中的组件页面 我想使用自定义模块(插件)在产品类别表单中制作这样的详细表单(与此相同)

然后在此表单上显示

所以产品类别表格将是这样的

我已尝试使用此代码

.py

 from odoo import api, fields, models, _

class CategoryBom(models.Model):
    _name = 'category_bom.sub_bom'
    _inherit = "mrp.bom"

    bom_line_ids = fields.One2many('mrp.bom.line', 'bom_id', 'BoM Lines', copy=True)

.xml

<odoo>
    <data>
        <!-- Add BoM input in category form -->
            <record id="bom_form_in_category_form" model="ir.ui.view">
                <field name="name">mrp.bom.form.inherit_category</field>
                <field name="model">category_bom.sub_bom</field>
                <field name="inherit_id" ref="product.product_category_form_view"></field>
                <field name="type">form</field>
                <field name="arch" type="xml">
                    <group name="first" position="after">
                        <group string="Bill Of Materials">
                            <form string="Bill of Material">
                                <notebook>
                                    <page string="Components">
                                        <field name="bom_line_ids" widget="one2many_list">
                                            <tree string="Components" editable="bottom">
                                                <field name="sequence" widget="handle"/>
                                                <field name="product_id" context="{'default_type': 'product'}"/>
                                                <field name="has_attachments" invisible="1"/>
                                                <button name="action_see_attachments" type="object" icon="fa-files-o" attrs="{'invisible': [('has_attachments', '=', False)]}"/>
                                                <button name="action_see_attachments" type="object" icon="fa-file" attrs="{'invisible': [('has_attachments', '=', True)]}"/>
                                                <field name="product_qty"/>
                                                <field name="product_uom_id" options="{'no_open':True,'no_create':True}" groups="product.group_uom"/>
                                                <field name="attribute_value_ids" widget="many2many_tags" domain="[('product_ids.product_tmpl_id', '=', parent.product_tmpl_id)]" groups="product.group_product_variant"/>
                                                <field name="operation_id" groups="mrp.group_mrp_routings" domain="[('routing_id', '=', parent.routing_id)]" options="{'no_quick_create':True,'no_create_edit':True}"/>
                                            </tree>
                                        </field>
                                    </page>
                                    <page string="Miscellaneous">
                                        <group>
                                            <group>
                                                <field name="sequence"/>
                                            </group>
                                            <group>
                                                <field name="ready_to_produce" string="Manufacturing Readiness"/>
                                                <field name="picking_type_id" string="Operation"/>
                                            </group>
                                        </group>
                                    </page>
                            </notebook>
                            </form>
                        </group>
                    </group>
                </field>
            </record>
    </data>
</odoo>

但是当我安装自定义模块时,我得到了错误

在此先感谢您的回复。

问候, Odoo 初学者

***仅供参考:我正在使用 odoo v.10

【问题讨论】:

  • 错误似乎在您的 xml 的第 4 行。您应该检查product.product_category_form_view 是否存在/没有错字。
  • @Unatiel :感谢您的回复,但我确定 product.product_category_form_view 存在并且没有错别字

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


【解决方案1】:

在第四行, 将“类型”更改为“view_type”

它可以解决问题。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-09-30
    • 1970-01-01
    • 1970-01-01
    • 2023-03-19
    相关资源
    最近更新 更多