Skip to content

[Backport] Wrong currency on creditmemo_grid & sales_order_view > creditmemo grid #22114

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

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions app/code/Magento/Sales/Setup/UpgradeSchema.php
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,9 @@ public function upgrade(SchemaSetupInterface $setup, ModuleContextInterface $con
if (version_compare($context->getVersion(), '2.0.11', '<')) {
$this->expandLastTransIdField($installer);
}
if (version_compare($context->getVersion(), '2.0.12', '<')) {
$this->addColumnOrderCurrencyCode($installer);
}
}

/**
Expand Down Expand Up @@ -181,4 +184,18 @@ private function expandLastTransIdField(SchemaSetupInterface $installer)
]
);
}

private function addColumnOrderCurrencyCode(SchemaSetupInterface $installer)
{
$connection = $installer->getConnection(self::$connectionName);
$connection->addColumn(
$installer->getTable('sales_invoice_grid', self::$connectionName),
'order_currency_code',
[
'type' => \Magento\Framework\DB\Ddl\Table::TYPE_TEXT,
'length' => 3,
'comment' => 'Order Currency Code'
]
);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public function prepareDataSource(array $dataSource)
{
if (isset($dataSource['data']['items'])) {
foreach ($dataSource['data']['items'] as & $item) {
$currencyCode = isset($item['base_currency_code']) ? $item['base_currency_code'] : null;
$currencyCode = isset($item['order_currency_code']) ? $item['order_currency_code'] : null;
$item[$this->getData('name')] = $this->priceFormatter->format(
$item[$this->getData('name')],
false,
Expand Down
1 change: 1 addition & 0 deletions app/code/Magento/Sales/etc/di.xml
Original file line number Diff line number Diff line change
Expand Up @@ -641,6 +641,7 @@
<item name="adjustment_positive" xsi:type="string">sales_creditmemo.adjustment_positive</item>
<item name="adjustment_negative" xsi:type="string">sales_creditmemo.adjustment_negative</item>
<item name="order_base_grand_total" xsi:type="string">sales_order.base_grand_total</item>
<item name="order_currency_code" xsi:type="string">sales_order.order_currency_code</item>
</argument>
</arguments>
</virtualType>
Expand Down
2 changes: 1 addition & 1 deletion app/code/Magento/Sales/etc/module.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
*/
-->
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
<module name="Magento_Sales" setup_version="2.0.11">
<module name="Magento_Sales" setup_version="2.0.12">
<sequence>
<module name="Magento_Rule"/>
<module name="Magento_Catalog"/>
Expand Down