Skip to Content
Meniu
Trebuie să fiți înregistrat pentru a interacționa cu comunitatea.
Această întrebare a fost marcată
1 Răspunde
2059 Vizualizări

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!

Imagine profil
Abandonează
Cel mai bun răspuns

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

Imagine profil
Abandonează
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

Related Posts Răspunsuri Vizualizări Activitate
1
ian. 21
2153
0
iun. 23
1907
0
sept. 21
2386
1
aug. 25
4310
2
iun. 23
8217