FIX: supplier invoice: autoatically calculate payment term when modifying payment condition
This commit is contained in:
parent
f2fafe04b6
commit
1795ec6a9d
@ -325,7 +325,18 @@ if (empty($reshook))
|
||||
// payments conditions
|
||||
if ($action == 'setconditions' && $user->rights->fournisseur->facture->creer)
|
||||
{
|
||||
$result=$object->setPaymentTerms(GETPOST('cond_reglement_id', 'int'));
|
||||
$object->fetch($id);
|
||||
$object->cond_reglement_code = 0; // To clean property
|
||||
$object->cond_reglement_id = 0; // To clean property
|
||||
$result = $object->setPaymentTerms(GETPOST('cond_reglement_id', 'int'));
|
||||
if ($result < 0) dol_print_error($db, $object->error);
|
||||
|
||||
$old_date_echeance = $object->date_echeance;
|
||||
$new_date_echeance = $object->calculate_date_lim_reglement();
|
||||
if ($new_date_echeance > $old_date_echeance) $object->date_echeance = $new_date_echeance;
|
||||
if ($object->date_echeance < $object->date) $object->date_echeance = $object->date;
|
||||
$result = $object->update($user);
|
||||
if ($result < 0) dol_print_error($db, $object->error);
|
||||
}
|
||||
|
||||
// Set incoterm
|
||||
|
||||
Loading…
Reference in New Issue
Block a user