I have created a custom module in magento 2 and its layout file is located in
app/code/Learning/RewriteSales/view/adminhtml/layout/sales_order_view.xml but the system loads the layout from
vendor/magento/module-sales/view/adminhtml/layout/sales_order_view.xml instead of my custom layout file.
How can i override this vendor layout file with my custom layout file?
the complete code of sales_order_view.xml file is
<?xml version="1.0"?> <page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" layout="admin-2columns-left" xsi:noNamespaceSchemaLocation="../../../../../../../lib/internal/Magento/Framework/View/Layout/etc/page_configuration.xsd"> <body> <referenceBlock name="order_info"> <action method="setTemplate"> <argument name="template" translate="true" xsi:type="string">Learning_RewriteSales::order/view/info.phtml</argument> </action> </referenceBlock> <referenceBlock name="order_info"> <block class="Learning\RewriteSales\Block\Adminhtml\Order\View\Custom" name="sales_order_view_custom" template="order/view/custom.phtml" /> </referenceBlock> <referenceBlock name="order_item"> <action method="setTemplate"> <argument name="template" translate="true" xsi:type="string">Learning_RewriteSales::order/view/items.phtml</argument> </action> <arguments> <argument name="columns" xsi:type="array"> <item name="product" xsi:type="string" translate="true">Producthhhh</item> <item name="status" xsi:type="string" translate="true">Item Status</item> <item name="price-original" xsi:type="string" translate="true">Original Price</item> <item name="price" xsi:type="string" translate="true">Price</item> <item name="ordered-qty" xsi:type="string" translate="true">Qty</item> <item name="subtotal" xsi:type="string" translate="true">Subtotal</item> <item name="tax-amount" xsi:type="string" translate="true">Tax Amount</item> <item name="tax-percent" xsi:type="string" translate="true">Tax Percent</item> <item name="discont" xsi:type="string" translate="true">Discount Amount</item> <item name="total" xsi:type="string" translate="true">Row Total</item> <item name="image" xsi:type="string" translate="true">Image</item> </argument> </arguments> </referenceBlock> <referenceBlock name="order_item"> <block class="Learning\RewriteSales\Block\Adminhtml\Order\View\Items\Renderer\DefaultRenderer" name="sales_order_view_items_renderer_defaultrenderer" template="order/view/items/renderer/default.phtml" /> <arguments> <argument name="columns" xsi:type="array"> <item name="product" xsi:type="string" translate="false">col-product</item> <item name="status" xsi:type="string" translate="false">col-status</item> <item name="price-original" xsi:type="string" translate="false">col-price-original</item> <item name="price" xsi:type="string" translate="false">col-price</item> <item name="qty" xsi:type="string" translate="false">col-ordered-qty</item> <item name="subtotal" xsi:type="string" translate="false">col-subtotal</item> <item name="tax-amount" xsi:type="string" translate="false">col-tax-amount</item> <item name="tax-percent" xsi:type="string" translate="false">col-tax-percent</item> <item name="discont" xsi:type="string" translate="false">col-discont</item> <item name="total" xsi:type="string" translate="false">col-total</item> <item name="image" xsi:type="string" translate="false">col-image</item> </argument> </arguments> </referenceBlock> </body> but the module does not take this layout.