İçereği Atla
Menü
Bu soru işaretlendi
1 Cevapla
12736 Görünümler

Dear all,

I have several products with a wrong unit of measure. They are registered as UN but they must be KG. Whe I try to change the unit of measure on the product form, I get an error when I try to save. The error is related to unit of measure categories mismatch. The error is:

"Unit of Measure categories Mismatch! New Unit of Measure 'kg' must belong to same Unit of Measure category 'Unit' as of old Unit of Measure 'Unit(s)'. If you need to change the unit of measure, you may deactivate this product from the 'Procurements' tab and create a new one. "

The proposed solution is usefull if we hava a small number of products to be changed or if the product has no stock moves. If we have lots of products to change and if some of them has some moves, this is not a solution because we will loose important information about the original product.

Is there any way to bypass the error message and change the unit of measure?

Thank you very much Paulo Matos

Avatar
Vazgeç
En İyi Yanıt

1) In addons\product\product.py File

Temporary uncomment the line and then restart the server after that change UOM

def write(self, cr, uid, ids, vals, context=None):
        if 'uom_po_id' in vals:
            new_uom = self.pool.get('product.uom').browse(cr, uid, vals['uom_po_id'], context=context)
            for product in self.browse(cr, uid, ids, context=context):
                old_uom = product.uom_po_id
                if old_uom.category_id.id != new_uom.category_id.id:
                    raise osv.except_osv(_('Unit of Measure categories Mismatch!'), _("New Unit of Measure '%s' must belong to same Unit of Measure category '%s' as of old Unit of Measure '%s'. If you need to change the unit of measure, you may deactivate this product from the 'Procurements' tab and create a new one.") % (new_uom.name, old_uom.category_id.name, old_uom.name,))
        return super(product_template, self).write(cr, uid, ids, vals, context=context)

OR

2) Change the Product UOM in database using SQL Update query

But it may be affect the functionality for the old product sale order done with uom units.

Avatar
Vazgeç
İlgili Gönderiler Cevaplar Görünümler Aktivite
2
Eyl 25
635
1
Eki 25
746
2
Haz 25
2289
0
Mar 25
2208
0
Şub 25
1638