Use the update method to edit cost price of a product instead of

setValue that does not run triggers.
This commit is contained in:
Laurent Destailleur 2016-04-09 10:41:39 +02:00
parent cd13c942ed
commit e869ed51e4

View File

@ -100,11 +100,12 @@ if (empty($reshook))
if ($id) if ($id)
{ {
$result=$object->fetch($id); $result=$object->fetch($id);
$result=$object->setValueFrom('cost_price', price2num($cost_price)); $object->cost_price = price2num($cost_price);
$result=$object->update($object->id, $user);
if ($result > 0) if ($result > 0)
{ {
$object->cost_price = price2num($cost_price);
setEventMessages($langs->trans("RecordSaved"), null, 'mesgs'); setEventMessages($langs->trans("RecordSaved"), null, 'mesgs');
$action='';
} }
else else
{ {
@ -112,7 +113,6 @@ if (empty($reshook))
setEventMessages($object->error, $object->errors, 'errors'); setEventMessages($object->error, $object->errors, 'errors');
} }
} }
$action='';
} }
if ($action == 'remove_pf') if ($action == 'remove_pf')