Skip to content

Commit

Permalink
fix: when invoice is created by WORKFLOW_ORDER_AUTOCREATE_INVOICE on …
Browse files Browse the repository at this point in the history
…ORDER_CLOSE, the invoice must have the default bank account of the thirdparty is it's empty on order (Dolibarr#29462)

* fix: when invoice is created by WORKFLOW_ORDER_AUTOCREATE_INVOICE on ORDER_CLOSE, the invoice must have the default bank account of the thirdparty is it's empty on order

* fix: add control on back stattement
  • Loading branch information
FHenry authored Apr 27, 2024
1 parent c29a27d commit 7688461
Showing 1 changed file with 8 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,14 @@ public function runTrigger($action, $object, User $user, Translate $langs, Conf
if ($ret < 0) {
$this->error = $newobject->error;
$this->errors[] = $newobject->error;
} else {
if (empty($object->fk_account) && !empty($object->thirdparty->fk_account) && !getDolGlobalInt('BANK_ASK_PAYMENT_BANK_DURING_ORDER')) {
$res = $newobject->setBankAccount($object->thirdparty->fk_account, true, $user);
if ($ret < 0) {
$this->error = $newobject->error;
$this->errors[] = $newobject->error;
}
}
}

$object->clearObjectLinkedCache();
Expand Down

0 comments on commit 7688461

Please sign in to comment.