问题
I have to use the following custom UoM defined in the system:
id | create_uid | name | rounding | write_uid | uom_type | write_date | factor | active | create_date | category_id
----+------------+--------+----------+-----------+----------+----------------------------+--------+--------+----------------------------+-------------
20 | 1 | MILES | 0.001 | 1 | bigger | 2017-07-12 03:42:25.363007 | 0.001 | t | 2017-07-12 03:33:27.251635 | 1
Could someone provide an example on how to create it?
回答1:
There are two ways insert a new UoM :
Using xml file :
Go to addons/product/product_data.xml
<record id="product_uom_unit" model="product.uom">
<field name="category_id" ref="product_uom_categ_unit"/>
<field name="name">Unit(s)</field>
<field name="factor" eval="1.0"/>
<field name="rounding" eval="0.001"/>
</record>
Or using .csv file :
- Go to settings/configuration/warehouse, and check the 5th option in Location & Warehouse,
Manage different units of measure for products
- Go to warehouse/configuration/unite of mesure, in tree view export the data, then you can add a new UoM to this file
来源:https://stackoverflow.com/questions/45075701/odoo-10-create-a-record-in-product-uom-via-data-xml