12968: fix product import update

This commit is contained in:
Ahmed Ejaz
2024-11-20 01:41:27 +05:00
parent 283706114e
commit 3a3d729dcb
2 changed files with 6 additions and 2 deletions

View File

@@ -161,7 +161,7 @@ module ProductImport
end
def unit_fields_validation(entry)
unit_types = ['g', 'oz', 'lb', 'kg', 't', 'ml', 'l', 'kl', '']
unit_types = ['mg', 'g', 'kg', 'oz', 'lb', 't', 'ml', 'cl', 'dl', 'l', 'kl', 'gal', '']
if entry.units.blank?
mark_as_invalid(entry, attribute: 'units',

View File

@@ -32,14 +32,18 @@ module ProductImport
def unit_scales
{
'mg' => { scale: 0.001, unit: 'weight' },
'g' => { scale: 1, unit: 'weight' },
'kg' => { scale: 1000, unit: 'weight' },
'oz' => { scale: 28.35, unit: 'weight' },
'lb' => { scale: 453.6, unit: 'weight' },
't' => { scale: 1_000_000, unit: 'weight' },
'ml' => { scale: 0.001, unit: 'volume' },
'cl' => { scale: 0.01, unit: 'volume' },
'dl' => { scale: 0.1, unit: 'volume' },
'l' => { scale: 1, unit: 'volume' },
'kl' => { scale: 1000, unit: 'volume' }
'kl' => { scale: 1000, unit: 'volume' },
'gal' => { scale: 4.54609, unit: 'volume' },
}
end