How to overwrite core template files from a custom module?

You could do this with a layout XML file inside of your module. You need to have a section in your module's config.xml like this to let Magento load your module's layout XML (path: app/design/frontend/base/default/layout/mymodulename.xml):

<config>
    [...]
    <frontend>
        [...]
        <layout>
            <updates>
                <mymodulename_layout module="MyModuleName">
                    <file>mymodulename.xml</file>
                </mymodulename_layout>
            </updates>
        </layout>
    </frontend>

In this layout XML file you can reference the specific blocks and change their template.

<layout>
    <sales_order_view>
        <reference name="sales.order.view">
            <action method="setTemplate">
                <template>mymodulename/sales/order/view.phtml</template>
            </action>
        </reference>
    </sales_order_view>
    <sales_order_print>
        <reference name="sales.order.print">
            <action method="setTemplate">
                <template>mymodulename/sales/order/print.phtml</template>
            </action>
        </reference>
    </sales_order_print>
</layout>

Suppose our Module Name 'CustomSales' and Package Name "Exercise".

Step 1 : Create a module config file into app/etc/modules/Exercise_CustomSales.xml

<config>
<modules>
    <Exercise_CustomSales>
        <active>true</active>
        <codePool>local</codePool>
    </Exercise_CustomSales>
</modules>

Step 2: Create a config file under app/code/local/Exercise/CustomSales/etc/config.xml

<config>
<modules>
    <Exercise_CustomSales>
        <version>1.7.0.2</version>
    </Exercise_CustomSales>
</modules>
<global>
    <blocks>
        <customsales>
            <class>Exercise_CustomSales_Block</class>
        </customsales>
        <sales>
            <rewrite>
                <order_view>Exercise_CustomSales_Block_Sales_Order_View</order_view>
            </rewrite>
        </sales>
    </blocks>
</global>

Step 3 : Create a php file which is overwrite the actual view.phtml file, app/code/local/Exercise/CustomSales/Block/Sales/Order/View.php

class Exercise_CustomSales_Block_Sales_Order_View extends Mage_Sales_Block_Order_View
{
    protected function _construct()
    {
        parent::_construct();
        $this->setTemplate('customsales/sales/order/view.phtml');
    }
}

Step 4 : you should create a local.xml file inside layout folder(Possible path: app/design/frontend/package/theme/layout). This is for print.phtml .

e.g (app/design/frontend/rwd/default/layout/local.xml)

<layout>
<sales_order_print>
    <reference name="sales.order.print">
        <action method="setTemplate">
            <template>customsales/sales/order/print.phtml</template>
        </action>
    </reference>
</sales_order_print>

Move view.phtml and print.phtml file inside "app/design/frontend/package/theme/template/customsales/sales/order".

Clear magento cache.