Ir al contenido
Menú
Se marcó esta pregunta
1 Responder
2048 Vistas

Good morning,

I made a module that, when installed, adds the categories and subcategories recorded in it. Now I want to understand how, in addition to categories, to set the "Costing Method - FIFO" for the category or subcategory that I add through the module. Please tell me which way to move.

And if possible - I would like to know how to install "Inventory valuation - Automation" in the same place.


Example of adding a category through a module:

<?xml version="1.0" encoding="utf-8"?>
<odoo>
    <data noupdate="1">
        <record id="product_category_7" model="product.category">
            <field name="parent_id" ref="product.product_category_all"/>
            <field name="name">Category name</field>
        </record>
    </data>
</odoo>

Thanks!

Avatar
Descartar
Mejor respuesta

Hi,

You can set it like this,

<record id="product_category_7" model="product.category">
<field name="parent_id" ref="product.product_category_all"/>
<field name="name">Category name</field>
<field name="property_cost_method">fifo</field>
</record>

Thanks

Avatar
Descartar
Autor

Hi, Niyas,

Thanks for your answer!

I have already tried to set property_cost_method in this way, but Odoo did give an error like this:

The above exception was the direct cause of the following exception:

Traceback (most recent call last):

File "/usr/lib/python3/dist-packages/odoo/http.py", line 638, in _handle_exception

return super(JsonRequest, self)._handle_exception(exception)

File "/usr/lib/python3/dist-packages/odoo/http.py", line 314, in _handle_exception

raise exception.with_traceback(None) from new_cause

odoo.tools.convert.ParseError: while parsing /mnt/extra-addons/auto_filling_product_categories/data/filled_product_data.xml:15, near

<record id="product_category_9" model="product.category">

<field name="parent_id" ref="product_category_all"/>

<field name="name">Blockchain!</field>

<field name="property_cost_method">fifo</field>

</record>

Maybe I incorrectly indicated something in the module files, for example, __manifest__.py or another - could you tell me?

Thanks

Publicaciones relacionadas Respuestas Vistas Actividad
1
ene 21
2145
0
jun 23
1896
0
sept 21
2378
1
ago 25
4305
2
jun 23
8201