Use the update method to edit cost price of a product instead of
setValue that does not run triggers.
This commit is contained in:
parent
cd13c942ed
commit
e869ed51e4
@ -100,11 +100,12 @@ if (empty($reshook))
|
||||
if ($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)
|
||||
{
|
||||
$object->cost_price = price2num($cost_price);
|
||||
setEventMessages($langs->trans("RecordSaved"), null, 'mesgs');
|
||||
$action='';
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -112,7 +113,6 @@ if (empty($reshook))
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
}
|
||||
}
|
||||
$action='';
|
||||
}
|
||||
|
||||
if ($action == 'remove_pf')
|
||||
|
||||
Loading…
Reference in New Issue
Block a user