Dev*_*eja 0 php magento magento-1.7
if (!$this->_current_order->canInvoice()) {
$this->Msg[] = 'Can not create Invoice';
return false;
}
Run Code Online (Sandbox Code Playgroud)
这总是返回 false。因此,我无法创建发票或运输。
也许订单被取消,处于完成/关闭状态。
也许它已暂停或仍在付款审核中。
可能有项目没有要开票的数量 > 0 或者项目被锁定到发票...
我建议在类中下面显示的方法中的每个 IF 语句中放置一个日志 Mage_Sales_Model_Order
/**
* Retrieve order invoice availability
*
* @return bool
*/
public function canInvoice()
{
if ($this->canUnhold() || $this->isPaymentReview()) {
return false;
}
$state = $this->getState();
if ($this->isCanceled() || $state === self::STATE_COMPLETE || $state === self::STATE_CLOSED) {
return false;
}
if ($this->getActionFlag(self::ACTION_FLAG_INVOICE) === false) {
return false;
}
foreach ($this->getAllItems() as $item) {
if ($item->getQtyToInvoice()>0 && !$item->getLockedDoInvoice()) {
return true;
}
}
return false;
}
Run Code Online (Sandbox Code Playgroud)