1
votes

I'm wasting time to find out how to getting field from Bill of Materials (BOM) in Manufacturing module odoo for use it on Product categories form in odoo's Inventory module.

here is the detail

Wanna get this field

look at the Components page in Bill of Materials Form I want to make detail form like that (same with that) in product category form using custom module (addons)

then show it on this form here i want to put the form on Bill of Materials

so product category form will be like this enter image description here

I've tried with this code

.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>

but when I install the custom module, im getting error

this in an error

Thanks in advance, I would be appreciated for your response.

Regards, Odoo Beginner

***FYI : I'm using odoo v.10

1
The error seems to be on the 4th line of your xml. You should check that product.product_category_form_view exists/is written without typo.Unatiel
@Unatiel : thanks for your response, but I'm sure product.product_category_form_view exists and written without typoKode Kite

1 Answers

0
votes

in the fourth line, change "type" by "view_type"

it can resolve the problem.