-
Notifications
You must be signed in to change notification settings - Fork 9.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Two invoices to the entire order #1464
Labels
bug report
Fixed in 2.4.x
The issue has been fixed in 2.4-develop branch
Issue: Format is not valid
Gate 1 Failed. Automatic verification of issue format is failed
Issue: Ready for Work
Gate 4. Acknowledged. Issue is added to backlog and ready for development
Comments
vpelipenko
added
Issue: Ready for Work
Gate 4. Acknowledged. Issue is added to backlog and ready for development
CS
bug report
labels
Jul 10, 2015
We can call it a bug. But could you describe here business case? When can we face with such behavior? |
Sorry, I was calling it in the wrong way, need to Code for future reference: protected function invoice(\Magento\Sales\Api\Data\OrderInterface $order)
{
if (!$order->canInvoice()) {
throw new \Magento\Framework\Exception\LocalizedException(
__('The order does not allow an invoice to be created.')
);
}
/** @var \Magento\Sales\Model\Order\Invoice $invoice */
$invoice = $this->_objectManager->create('Magento\Sales\Model\Service\Order', ['order' => $order])->prepareInvoice();
if (!$invoice) {
throw new \Magento\Framework\Exception\LocalizedException(__('We can\'t save the invoice right now.'));
}
if (!$invoice->getTotalQty()) {
throw new \Magento\Framework\Exception\LocalizedException(
__('You can\'t create an invoice without products.')
);
}
$invoice->register();
$invoice->getOrder()->setCustomerNoteNotify(true);
$invoice->getOrder()->setIsInProcess(true);
$transactionSave = $this->_objectManager->create('Magento\Framework\DB\Transaction')
->addObject($invoice)
->addObject($invoice->getOrder());
$transactionSave->save();
} Thanks! |
magento-team
pushed a commit
that referenced
this issue
Sep 6, 2017
[EngCom] Public Pull Requests - MAGETWO-72350: Fix: Use all columns when running tests #10784 - MAGETWO-72349: Fix: Move GitHub-specific documents into .github #10778 - MAGETWO-72344: Enhancement: Configure preferred installation source in composer.json #10774 - MAGETWO-72279: Always use https for Vimeo video's. #10768
magento-engcom-team
added
the
Fixed in 2.4.x
The issue has been fixed in 2.4-develop branch
label
Jul 21, 2020
magento-engcom-team
added
the
Issue: Format is not valid
Gate 1 Failed. Automatic verification of issue format is failed
label
Jul 21, 2020
This was referenced Dec 2, 2022
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
bug report
Fixed in 2.4.x
The issue has been fixed in 2.4-develop branch
Issue: Format is not valid
Gate 1 Failed. Automatic verification of issue format is failed
Issue: Ready for Work
Gate 4. Acknowledged. Issue is added to backlog and ready for development
Trying a simple snippet:
In such case,
prepareInvoice
generates an invoice with all items from the order. In the second run, the invoice is generated again with all items (even those that already were invoiced). The shipping amount is invoiced only in the first time.Is this an expected behavior? I guess it should not allow to invoice more items than were ordered.
The text was updated successfully, but these errors were encountered: