I've been trying to create a new UOM but it keeps failing. This is the core code:
unit_category = request.env['uom.category'].sudo().search([('name', '=', 'Units')], limit=1)
if unit_category:
new_uom = request.env['uom.uom'].sudo().create({
'name': 'MyDozen',
'category_id': unit_category.id,
'uom_type': 'smaller',
'factor': 12.0,
'rounding': 1.0,
})
I've tried replacing factor with factor_inv and even relative_factor, but it still doesn't work. It might create the UOM, sometimes, but with a unit of only 1 and not 12.
Where is my mistake?
Hello, my dear Kunjan. Your help is tireless.
That did the trick. Thank you!
My forum account is still too new to upvote, but let's mark yours as the solution.