← Back to team overview

openerp-india team mailing list archive

[Merge] lp:~openerp-india/openerp-india/trunk-nco into lp:~openerp-india/openerp-india/trunk

 

Nimesh Contractor(Open ERP) has proposed merging lp:~openerp-india/openerp-india/trunk-nco into lp:~openerp-india/openerp-india/trunk.

Requested reviews:
  Mustufa Rangwala (Open ERP) (mra-tinyerp)

For more details, see:
https://code.launchpad.net/~openerp-india/openerp-india/trunk-nco/+merge/170580

Hello,

I have removed unused protal changes.

Thank You.
Nimesh.

-- 
https://code.launchpad.net/~openerp-india/openerp-india/trunk-nco/+merge/170580
Your team OpenERP Indian Team is subscribed to branch lp:~openerp-india/openerp-india/trunk-nco.
=== modified file 'l10n_in_tax_retail_invoice/__openerp__.py'
--- l10n_in_tax_retail_invoice/__openerp__.py	2013-05-23 08:40:28 +0000
+++ l10n_in_tax_retail_invoice/__openerp__.py	2013-06-20 10:57:25 +0000
@@ -53,6 +53,10 @@
         'l10n_in_tax_retail_invoice_view.xml',
         'res_config_view.xml',
     ],
+    'test':[
+        'test/purchase_order.yml',
+        'test/sale_order.yml',
+    ],
     'installable': True,
     'auto_install': False,
 }

=== modified file 'l10n_in_tax_retail_invoice/l10n_in_tax_retail_invoice.py'
--- l10n_in_tax_retail_invoice/l10n_in_tax_retail_invoice.py	2013-05-23 08:40:28 +0000
+++ l10n_in_tax_retail_invoice/l10n_in_tax_retail_invoice.py	2013-06-20 10:57:25 +0000
@@ -23,7 +23,7 @@
 from lxml import etree
 
 from openerp.osv import fields, osv
-from tools.amount_to_text_en import amount_to_text
+from openerp.tools.amount_to_text_en import amount_to_text
 from openerp.tools.translate import _
 from openerp import netsvc
 import openerp.addons.decimal_precision as dp
@@ -42,17 +42,20 @@
     _inherit = "product.product"
     
     def _check_packing_cost_allowed(self, cr, uid, ids, name, args, context=None):
+        '''
+         This function allows us to use Packing Cost Features. 
+  
+         :param ids: list of product record ids.
+         :param name : browse name fields of packing_cost_allowed
+         :returns: True or False value of Packing Cost of company. 
+         :rtype: dict
+         '''
         res = {}
         res_company = self.pool.get('res.company')
         for id in ids:
-            packing_cost_allowed = res_company.browse(cr, uid, uid, context=context).packing_cost
-            res[id] = packing_cost_allowed
-        return res
+            res[id] = res_company.browse(cr, uid, uid, context=context).packing_cost
+        return res    
     
-    def _default_check_packing_cost_allowed(self, cr, uid, ids, context=None):
-        res_company = self.pool.get('res.company')
-        packing_cost_allowed = res_company.browse(cr, uid, uid, context=context).packing_cost
-        return packing_cost_allowed
     
     _columns = {
         'packing_cost_type': fields.selection([
@@ -65,26 +68,27 @@
     }
     
     _defaults = {
-         'packing_cost_allowed': _default_check_packing_cost_allowed,
-         'packing_cost_type': 'percentage',
+        'packing_cost_allowed': lambda self, cr, uid, context: self.pool.get('res.company').browse(cr, uid, uid, context=context).packing_cost,
+        'packing_cost_type': 'percentage',
      }
     
 class res_partner(osv.osv):
     
     _inherit = "res.partner"
-    
+
     def _check_dealers_discount_allowed(self, cr, uid, ids, name, args, context=None):
+        '''
+        This function allows us to use dealers discount feature.
+    
+        :param ids: list of partner record ids. 
+        :returns: True or False value of dealers discount of company
+        :rtype: dict of true and false value
+        '''
         res = {}
         res_company = self.pool.get('res.company')
         for id in ids:
-            dealers_discount_allowed = res_company.browse(cr, uid, uid, context=context).dealers_discount
-            res[id] = dealers_discount_allowed
-        return res
-    
-    def _default_check_dealers_discount_allowed(self, cr, uid, ids, context=None):
-        res_company = self.pool.get('res.company')
-        dealers_discount_allowed = res_company.browse(cr, uid, uid, context=context).dealers_discount
-        return dealers_discount_allowed
+            res[id] = res_company.browse(cr, uid, uid, context=context).dealers_discount
+        return res    
     
     _columns = {
         'tin_no' : fields.char('TIN', size=32, help="Tax Identification Number"),
@@ -98,9 +102,12 @@
     }
     
     _defaults = {
-         'dealers_discount_allowed': _default_check_dealers_discount_allowed,
+         'dealers_discount_allowed': lambda self, cr, uid, context: self.pool.get('res.company').browse(cr, uid, uid, context=context).dealers_discount,
     }
     def _check_recursion(self, cr, uid, ids, context=None):
+        """
+        Set constraints to cannot create recursive dealers.
+        """
         level = 100
         while len(ids):
             cr.execute('select distinct dealer_id from res_partner where id IN %s',(tuple(ids),))
@@ -151,17 +158,34 @@
     
     _inherit = "sale.order"
     
-    def _get_pack_total(self, cursor, user, ids, name, arg, context=None):
+    def _get_pack_total(self, cr, uid, ids, name, arg, context=None):
+        '''
+        The purpose of this function is to build and return packing_total and dealers_disc
+        :param ids: list of sale order ids
+        :returns: packing_total and dealers_disc
+        :rtype: dictionary
+        '''
         res = {}
-        tot_diff = 0.0
-        for sale in self.browse(cursor, user, ids, context=context):
-            tot_diff = 0.0
+        for sale in self.browse(cr, uid, ids, context=context):
+            res[sale.id] = {
+            'packing_total': 0.0,
+            'dealers_disc': 0.0,
+            }
+            packing_total = dealers_disc = 0.0
             for line in sale.order_line:
-                tot_diff += line.packing_amount  # Need to check if packing cost apply by qty sold? 
-            res[sale.id] = tot_diff
+                if line.lst_price:
+                    dealers_disc += (line.price_unit - line.lst_price) * line.product_uom_qty 
+                packing_total += line.packing_amount  # Need to check if packing cost apply by qty sold?
+            res[sale.id]['packing_total'] = packing_total
+            res[sale.id]['dealers_disc'] = dealers_disc
         return res
+
     
     def copy(self, cr, uid, id, default=None, context=None):
+        """
+        override orm copy method.
+        cannot duplicate invoice for sale order.
+        """
         default = default or {}
         default.update({
             'invoice_id':False,
@@ -169,8 +193,13 @@
         return super(sale_order, self).copy(cr, uid, id, default, context=context)
     
     def _amount_line_tax(self, cr, uid, line, context=None):
-        sale_order_line_obj = self.pool.get('sale.order.line')
-        packing_cost_allowed = sale_order_line_obj.browse(cr, uid, line.id, context=context).order_id.company_id.packing_cost
+        '''
+        The purpose of this function is calculate amount with tax       
+        :param line: browse the record of sale.order.line
+        :returns: amount val
+        :rtype: int
+        '''
+        packing_cost_allowed = self.pool.get('sale.order.line').browse(cr, uid, line.id, context=context).order_id.company_id.packing_cost
         if packing_cost_allowed:
             val = 0.0
             for c in self.pool.get('account.tax').compute_all(cr, uid, line.tax_id, (line.price_unit + line.packing_amount) * (1 - (line.discount or 0.0) / 100.0), line.product_uom_qty, line.product_id, line.order_id.partner_id)['taxes']:
@@ -179,25 +208,25 @@
         return super(sale_order, self)._amount_line_tax(cr, uid, line, context=context)
     
     def _amount_all(self, cr, uid, ids, field_name, arg, context=None):
+        '''
+        The purpose of this function is Calculate a amount, untaxed and tax   
+        :param ids: list of sale order record ids.
+        :returns: amount_total, amount_untaxed,amount_tax
+        :rtype: dictionary
+        '''
         res = super(sale_order, self)._amount_all(cr, uid, ids, field_name, arg, context=context)
         return res
     
     def _get_order(self, cr, uid, ids, context=None):
+        '''
+        The purpose of this function to reculate amount total.  
+        :param ids: list of sale order line record ids
+        :returns: Recalculated sale order id
+        :rtype: int
+        '''        
         res = super(sale_order, self.pool.get('sale.order'))._get_order(cr, uid, ids, context=context)
         return res
     
-    def _get_difference(self, cursor, user, ids, name, arg, context=None):
-        res = {}
-        tot_diff = 0.0
-        for sale in self.browse(cursor, user, ids):
-            tot_diff = 0.0
-            for line in sale.order_line:
-                if line.lst_price:
-                    tot_diff += (line.price_unit - line.lst_price) * line.product_uom_qty
-#                tot_diff = tot_diff - line.packing_amount # Need to check if packing cost apply by qty sold? 
-            res[sale.id] = tot_diff
-        return res
-    
     def _get_qty_total(self, cr, uid, ids):
         res = {}
         qty = 0.0
@@ -210,7 +239,7 @@
     _columns = {
         'contact_id': fields.many2one('res.partner', 'Contact'),
         'partner_shipping_id': fields.many2one('res.partner', 'Delivery Address', required=True, help="Delivery address for current sales order."),
-        'packing_total': fields.function(_get_pack_total, type="float", string='Packing Cost', store=True),
+        'packing_total': fields.function(_get_pack_total, type="float", string='Packing Cost', store=True, multi='_get_pack_total'),
         'amount_total': fields.function(_amount_all, digits_compute=dp.get_precision('Account'), string='Total',
             store={
                 'sale.order': (lambda self, cr, uid, ids, c={}: ids, ['order_line'], 10),
@@ -220,7 +249,7 @@
         'quote_validity': fields.integer('Quote Validity', help="Validity of Quote in days."),
         'subject': fields.text('Subject'),
         'invoice_id': fields.many2one('account.invoice', 'Invoice ID'),
-        'dealers_disc': fields.function(_get_difference, type="float", string='Dealers Discount', store=True),
+        'dealers_disc': fields.function(_get_pack_total, type="float", string='Dealers Discount', store=True, multi='_get_pack_total'),
         'delivery_term': fields.integer('Delivery Term', help='Delivery Term in Weeks')
     }
     
@@ -228,18 +257,17 @@
         """ create invoices for the given sales orders (ids), and open the form
             view of one of the newly created invoices
         """
-        mod_obj = self.pool.get('ir.model.data')
         wf_service = netsvc.LocalService("workflow")
 
         # create invoices through the sales orders' workflow
         inv_ids0 = set(inv.id for sale in self.browse(cr, uid, ids, context) for inv in sale.invoice_ids)
-        for id in ids:
-            wf_service.trg_validate(uid, 'sale.order', id, 'manual_invoice', cr)
+        for sale_order_id in ids:
+            wf_service.trg_validate(uid, 'sale.order', sale_order_id, 'manual_invoice', cr)
         inv_ids1 = set(inv.id for sale in self.browse(cr, uid, ids, context) for inv in sale.invoice_ids)
         # determine newly created invoices
         new_inv_ids = list(inv_ids1 - inv_ids0)
         self.write(cr, uid, ids[0], {'invoice_id': new_inv_ids[0]}, context=context)
-        res = mod_obj.get_object_reference(cr, uid, 'account', 'invoice_form')
+        res = self.pool.get('ir.model.data').get_object_reference(cr, uid, 'account', 'invoice_form')
         res_id = res and res[1] or False,
 
         return {
@@ -256,21 +284,26 @@
         }
     
     def _prepare_invoice(self, cr, uid, order, lines, context=None):
+        """Override  method of sale order to update invoice with delivery order
+           information.
+           :param browse_record order: sale.order record to invoice
+           :param list(int) line: list of invoice line IDs that must be
+                                  attached to the invoice
+           :return: dict of value to update the invoice
+        """
         stock_picking_obj = self.pool.get('stock.picking')
         res = super(sale_order, self)._prepare_invoice(cr, uid, order, lines, context=context)
         delivery_id = stock_picking_obj.search(cr, uid, [('sale_id', '=', order.id)], context=context)
         if delivery_id:
             delivery = stock_picking_obj.browse(cr, uid, delivery_id[0], context=context)
-            delivery_date = delivery.date_done
-            delivery_name = delivery.name
             res.update(
                 {
                     'delivery_order_id': delivery_id[0],
                     'delivery_address_id': order.partner_shipping_id.id,
                     'date': order.date_order,
                     'carrier_id': order.carrier_id and order.carrier_id.id,
-                    'delivery_name': delivery_name or None,
-                    'delivery_date': delivery_date or False,
+                    'delivery_name': delivery.date_done or None,
+                    'delivery_date': delivery.name or False,
                     'sale_id': order.id
                 }
             )
@@ -281,14 +314,21 @@
     _inherit = 'sale.order.line'
     
     def _amount_line(self, cr, uid, ids, field_name, arg, context=None):
+        '''
+        The purpose of this function is calculate price total value.
+        :param ids: list of order line ids
+        :param field_name: name of price subtotal
+        :returns: subtotal value
+        '''
         packing_cost_allowed = False
         res = super(sale_order_line, self)._amount_line(cr, uid, ids, field_name, arg, context=context)
-        for id in ids:
-            packing_cost_allowed = self.browse(cr, uid, id, context=context).order_id.company_id.packing_cost
+        for line_id in ids:
+            packing_cost_allowed = self.browse(cr, uid, line_id, context=context).order_id.company_id.packing_cost
         if packing_cost_allowed:
             for sale_order_line_id in res:
-                qty = self.browse(cr, uid, sale_order_line_id, context=context).product_uom_qty
-                packing_amount = self.browse(cr, uid, sale_order_line_id, context=context).packing_amount
+                sale_order_line_obj = self.browse(cr, uid, sale_order_line_id, context=context)
+                qty = sale_order_line_obj.product_uom_qty
+                packing_amount = sale_order_line_obj.packing_amount
                 res[sale_order_line_id] += qty * packing_amount
         return res
     
@@ -301,20 +341,25 @@
     def product_id_change(self, cr, uid, ids, pricelist, product, qty=0,
             uom=False, qty_uos=0, uos=False, name='', partner_id=False,
             lang=False, update_tax=True, date_order=False, packaging=False, fiscal_position=False, flag=False, context=None):
+        '''
+        The purpose of this function to get value of price unit, list price, packing amount on product change.
+        :return: return this value list price , price unit, packing amount.
+        :rtype: dictionary
+        '''
         res = super(sale_order_line, self).product_id_change(cr, uid, ids, pricelist, product, qty=0,
             uom=uom, qty_uos=qty_uos, uos=uos, name=name, partner_id=partner_id,
             lang=lang, update_tax=update_tax, date_order=date_order, packaging=packaging, fiscal_position=fiscal_position, flag=flag, context=context)
         context = context or {}
         lang = lang or context.get('lang', False)
-        partner_obj = self.pool.get('res.partner')
         product_obj = self.pool.get('product.product')
         if product:
-            packing_cost_allowed = product_obj.browse(cr, uid, product, context=context).company_id.packing_cost
-            dealers_discount_allowed = product_obj.browse(cr, uid, product, context=context).company_id.dealers_discount
+            product_product_obj = product_obj.browse(cr, uid, product, context=context)
+            packing_cost_allowed = product_product_obj.company_id.packing_cost
+            dealers_discount_allowed = product_product_obj.company_id.dealers_discount
             # Dealer's Discount Feature
             if dealers_discount_allowed:
                 if partner_id:
-                    partner_rec = partner_obj.browse(cr, uid, partner_id, context=context)
+                    partner_rec = self.pool.get('res.partner').browse(cr, uid, partner_id, context=context)
                     if partner_rec.dealer_id:
                         res['value']['lst_price'] = res['value']['price_unit']
                         res['value']['price_unit'] = 0.0
@@ -396,10 +441,11 @@
                 pay_term = order.partner_id.property_payment_term.id
             else:
                 pay_term = False
-            delivery_id = stock_picking_obj.search(cr, uid, [('sale_id', '=', order.id)])
-            for id in delivery_id:
-                delivery_date = stock_picking_obj.browse(cr, uid, id, context=context).date_done
-                delivery_name = stock_picking_obj.browse(cr, uid, id, context=context).name
+            delivery_ids = stock_picking_obj.search(cr, uid, [('sale_id', '=', order.id)])
+            for delivery_id in delivery_ids:
+                delivery = stock_picking_obj.browse(cr, uid, delivery_id, context=context)
+                delivery_date = delivery.date_done
+                delivery_name = delivery.name
             inv = {
                 'name': order.name,
                 'origin': order.name,
@@ -464,6 +510,14 @@
     _inherit = "stock.picking"
     
     def _prepare_invoice(self, cr, uid, picking, partner, inv_type, journal_id, context=None):
+        """Override  method of picking to update invoice with delivery order
+           information.
+           :param browse_record picking: stock.picking record to invoice
+           :param partner: browse record of partner
+           :param inv_type: invoice type (in or out invoice).
+           :param journal_id: journal id
+           :return: dict of value to update the invoice for picking
+        """        
         res = super(stock_picking, self)._prepare_invoice(cr, uid, picking, partner, inv_type, journal_id, context=context)
         freight_allowed = self.browse(cr, uid, picking.id, context=context).company_id.freight
         if picking.sale_id:
@@ -488,17 +542,18 @@
     
     def action_invoice_create(self, cr, uid, ids, journal_id=False,
             group=False, type='out_invoice', context=None):
-        sale_order_obj = self.pool.get('sale.order')
-        
-        for id in ids:
-            sale_id = self.browse(cr, uid, id, context=context).sale_id.id
+        """
+        Overrride method from picking to update invoice id to sale order.
+        """
+        for picking_id in ids:
+            sale_id = self.browse(cr, uid, picking_id, context=context).sale_id.id
         
         res = super(stock_picking, self).action_invoice_create(cr, uid, ids, journal_id=journal_id,
             group=group, type=type, context=context)
         
         for key in res:
             invoice_id = res[key]
-        sale_order_obj.write(cr, uid, sale_id, {'invoice_id': invoice_id}, context=context)
+        self.pool.get('sale.order').write(cr, uid, sale_id, {'invoice_id': invoice_id}, context=context)
         return res
         
     
@@ -515,8 +570,9 @@
         res = super(stock_picking, self)._prepare_invoice_line(cr, uid, group, picking, move_line, invoice_id,
         invoice_vals, context=context)
         
-        dealers_discount_allowed = self.browse(cr, uid, picking.id, context=context).company_id.dealers_discount
-        packing_cost_allowed = self.browse(cr, uid, picking.id, context=context).company_id.packing_cost
+        stock_picking_obj = self.browse(cr, uid, picking.id, context=context)
+        dealers_discount_allowed = stock_picking_obj.company_id.dealers_discount
+        packing_cost_allowed = stock_picking_obj.company_id.packing_cost
         
         # Dealer's Discount Feature
         if dealers_discount_allowed:
@@ -532,11 +588,16 @@
     _inherit = 'account.invoice'
     
     def _amount_all(self, cr, uid, ids, name, args, context=None):
+        """
+        Override function from account invoice.
+        Purpose of this function is to add freight charge to amount total.
+        """
         res = super(account_invoice, self)._amount_all(cr, uid, ids, name, args, context=context)
         for invoice_id in res:
-            freight_allowed = self.browse(cr, uid, invoice_id, context=context).company_id.freight
+            account_invoice_obj = self.browse(cr, uid, invoice_id, context=context)
+            freight_allowed = account_invoice_obj.company_id.freight
             if freight_allowed:
-                freight_charge = self.browse(cr, uid, invoice_id, context=context).freight_charge
+                freight_charge = account_invoice_obj.freight_charge
                 res[invoice_id]['amount_total'] += freight_charge
         return res
     
@@ -549,24 +610,29 @@
         return res
     
     def _get_pack_total(self, cursor, user, ids, name, arg, context=None):
+        '''
+        The purpose of this function is calculate packing total and dealers discount
+        @param user: pass login user id
+        @param ids: pass invoice id
+        @param name: pass packing_total
+        @param args: None
+        @param context: pass context in 'type' : 'out_invoice', 'no_store_function': True/False, 'journal_type': 'sale'
+        @return: return a dict in invoice_id with packing amount of invoice line.
+        @rtype : dict
+        '''
         res = {}
-        tot_diff = 0.0
         for invoice in self.browse(cursor, user, ids, context=context):
-            tot_diff = 0.0
-            for line in invoice.invoice_line:
-                tot_diff += line.packing_amount  # Need to check if packing cost apply by qty sold? 
-            res[invoice.id] = tot_diff
-        return res
-    
-    def _get_difference(self, cursor, user, ids, name, arg, context=None):
-        res = {}
-        tot_diff = 0.0
-        for invoice in self.browse(cursor, user, ids):
-            tot_diff = 0.0
+            res[invoice.id] = {
+            'packing_total': 0.0,
+            'dealers_disc': 0.0,
+            }            
+            packing_total = dealers_disc = 0.0
             for line in invoice.invoice_line:
                 if line.lst_price:
-                    tot_diff += (line.price_unit - line.lst_price) * line.quantity
-            res[invoice.id] = tot_diff
+                    dealers_disc += (line.price_unit - line.lst_price) * line.quantity
+                packing_total += line.packing_amount  # Need to check if packing cost apply by qty sold?
+            res[invoice.id]['packing_total'] = packing_total 
+            res[invoice.id]['dealers_disc'] = dealers_disc
         return res
     
     def _get_qty_total(self, cr, uid, ids):
@@ -579,6 +645,13 @@
         return res
     
     def amount_to_text(self, amount, currency):
+        '''
+        The purpose of this function is to use payment amount change in word
+        @param amount: pass Total payment of amount
+        @param currency: pass which currency to pay
+        @return: return amount in word
+        @rtype : string
+        '''
         amount_in_word = amount_to_text(amount)
         if currency == 'INR':
             amount_in_word = amount_in_word.replace("euro", "Rupees").replace("Cents", "Paise").replace("Cent", "Paise")
@@ -599,11 +672,6 @@
         })
         return super(account_invoice, self).copy(cr, uid, id, default, context)
     
-    def _check_freight_allowed(self, cr, uid, ids, context=None):
-        res_company_obj = self.pool.get('res.company')
-        freight_allowed = res_company_obj.browse(cr, uid, uid, context=context).freight
-        return freight_allowed
-    
     _columns = {
         'delivery_order_id': fields.many2one('stock.picking', 'Delivery Order', readonly="True"),
         'delivery_address_id': fields.many2one('res.partner', 'Delivery Address'),
@@ -615,8 +683,8 @@
         'dispatch_doc_no': fields.char('Dispatch Document No.', size=16),
         'dispatch_doc_date': fields.date('Dispatch Document Date'),
         'consignee_account': fields.char('Consignee Account', size=32, help="Account Name, applies when there is customer for consignee."),
-        'dealers_disc': fields.function(_get_difference, type="float", string='Dealers Discount', store=True),
-        'packing_total': fields.function(_get_pack_total, type="float", string='Packing Cost', store=True),
+        'dealers_disc': fields.function(_get_pack_total, type="float", string='Dealers Discount', store=True, multi='_get_pack_total'),
+        'packing_total': fields.function(_get_pack_total, type="float", string='Packing Cost', store=True, multi='_get_pack_total'),
         'amount_untaxed': fields.function(_amount_all, digits_compute=dp.get_precision('Account'), string='Subtotal', track_visibility='always',
         store={
             'account.invoice': (lambda self, cr, uid, ids, c={}: ids, ['invoice_line'], 20),
@@ -645,46 +713,31 @@
     }
     
     _defaults = {
-         'freight_allowed': _check_freight_allowed,
+        'freight_allowed': lambda self, cr, uid, context: self.pool.get('res.company').browse(cr, uid, uid, context=context).freight,
      }
     
-#    def button_reset_taxes(self, cr, uid, ids, context=None):
-#        if context is None:
-#            context = {}
-#        ctx = context.copy()
-#        ait_obj = self.pool.get('account.invoice.tax')
-#        for id in ids:
-#            cr.execute("DELETE FROM account_invoice_tax WHERE invoice_id=%s AND manual is False", (id,))
-#            partner = self.browse(cr, uid, id, context=ctx).partner_id
-#            if partner.lang:
-#                ctx.update({'lang': partner.lang})
-#            for taxe in ait_obj.compute(cr, uid, id, context=ctx).values():
-#                ait_obj.create(cr, uid, taxe)
-#        # Update the stored value (fields.function), so we write to trigger recompute
-#        self.pool.get('account.invoice').write(cr, uid, ids, {'invoice_line':[]}, context=ctx)
-#        return True
-#
-#    def button_compute(self, cr, uid, ids, context=None, set_total=False):
-#        self.button_reset_taxes(cr, uid, ids, context)
-#        for inv in self.browse(cr, uid, ids, context=context):
-#            if set_total:
-#                self.pool.get('account.invoice').write(cr, uid, [inv.id], {'check_total': inv.amount_total})
-#        return True
-    
 class account_invoice_line(osv.osv):
     
     _inherit = 'account.invoice.line'
 
     def _amount_line(self, cr, uid, ids, prop, unknow_none, unknow_dict):
+        '''
+        The purpose of this function to give price subtotal.    
+        :param: ids: list of invoice line record ids.
+        :param: prop: field price subtotal
+        :return: calculted price subtotal value.
+        :rtype: dictionary
+        '''
         res = super(account_invoice_line, self)._amount_line(cr, uid, ids, prop, unknow_none, unknow_dict)
         packing_cost_allowed = False
-        for id in ids:
-            if self.browse(cr, uid, id).invoice_id:
-                packing_cost_allowed = self.browse(cr, uid, id).invoice_id.company_id.packing_cost
+        for invoice_line_id in ids:
+            if self.browse(cr, uid, invoice_line_id).invoice_id:
+                packing_cost_allowed = self.browse(cr, uid, invoice_line_id).invoice_id.company_id.packing_cost
         if packing_cost_allowed:
             for account_invoice_line_id in res:
-                qty = self.browse(cr, uid, account_invoice_line_id).quantity
-                packing_amount = self.browse(cr, uid, account_invoice_line_id).packing_amount
+                account_invoice_line_obj = self.browse(cr, uid, account_invoice_line_id) 
+                qty = account_invoice_line_obj.quantity
+                packing_amount = account_invoice_line_obj.packing_amount
                 res[account_invoice_line_id] += qty * packing_amount
         return res
     
@@ -695,8 +748,12 @@
     }
     
     def product_id_change(self, cr, uid, ids, product, uom_id, qty=0, name='', type='out_invoice', partner_id=False, fposition_id=False, price_unit=False, currency_id=False, context=None, company_id=None):
+        '''
+        The purpose of this function to get value of price unit, list price and packing amount on product value change.
+        :return: return this value price unit, list price, packing amount
+        :rtype: dictionary
+        '''
         res = super(account_invoice_line, self).product_id_change(cr, uid, ids, product, uom_id, qty=qty, name=name, type=type, partner_id=partner_id, fposition_id=fposition_id, price_unit=price_unit, currency_id=currency_id, context=context, company_id=company_id)
-        partner_obj = self.pool.get('res.partner')
         product_obj = self.pool.get('product.product')
 
         if product:
@@ -705,7 +762,7 @@
             
             # Dealer's Discount Feature
             if dealers_discount_allowed:
-                partner_rec = partner_obj.browse(cr, uid, partner_id, context=context)
+                partner_rec = self.pool.get('res.partner').browse(cr, uid, partner_id, context=context)
                 if not partner_rec.dealer_id:
                     res['value']['price_unit'] = res['value']['price_unit']
                 else:
@@ -726,6 +783,13 @@
     _inherit = "account.invoice.tax"
 
     def compute(self, cr, uid, invoice_id, context=None):
+        '''
+        The purpose of this function calculate the total tax amount include price of product and check invoice out/in
+        base_amount + tax_amount
+        @param ids: pass invoice id include tax for the product
+        @return: return tax category,total tax,product price * unit,invoice tax code,account ids etc..
+        @rtype : dict
+        '''
         tax_grouped = {}
         tax_obj = self.pool.get('account.tax')
         cur_obj = self.pool.get('res.currency')
@@ -784,29 +848,27 @@
 class purchase_order(osv.osv):
     _inherit = 'purchase.order'
     
-#    def amount_to_text(self, amount):
-#        amount_in_word = amount_to_text(amount)
-#        amount_in_word = amount_in_word.replace("euro", "Rupees").replace("Cents", "Paise").replace("Cent", "Paise")
-#        return amount_in_word
-    
     def _amount_all(self, cr, uid, ids, field_name, arg, context=None):
+        """
+        override function from purchase order to add inward freigh value with amount total.
+        return: amount total with inward freight value
+        """
         res = super(purchase_order, self)._amount_all(cr, uid, ids, field_name, arg, context=context)
         for purchase_id in res:
-            freight_allowed = self.browse(cr, uid, purchase_id, context=context).company_id.freight
+            purchase_order_obj =  self.browse(cr, uid, purchase_id, context=context)
+            freight_allowed = purchase_order_obj.company_id.freight
             if freight_allowed:
-                inward_freight = self.browse(cr, uid, purchase_id, context=context).inward_freight
+                inward_freight = purchase_order_obj.inward_freight
                 res[purchase_id]['amount_total'] += inward_freight
         return res
     
     def _get_order(self, cr, uid, ids, context=None):
+        """
+        The purpose of this function is to recalculate amount total based on order line
+        """
         res = super(purchase_order, self.pool.get('purchase.order'))._get_order(cr, uid, ids, context=context)
         return res
     
-    def _check_freight_allowed(self, cr, uid, ids, context=None):
-        res_company = self.pool.get('res.company')
-        freight_allowed = res_company.browse(cr, uid, uid, context=context).freight
-        return freight_allowed
-    
     _columns = {
         'inward_freight': fields.float('Inward Freight'),
         'freight_allowed': fields.boolean('Freight Allowed'),
@@ -826,7 +888,7 @@
     }
     
     _defaults = {
-         'freight_allowed': _check_freight_allowed,
+        'freight_allowed': lambda self, cr, uid, context: self.pool.get('res.company').browse(cr, uid, uid, context=context).freight,
      }
     
     
@@ -839,9 +901,10 @@
         res = super(purchase_order, self).action_invoice_create(cr, uid, ids, context=context)
         account_invoice_obj = self.pool.get('account.invoice')
         freight_allowed = False
-        for id in ids:
-            freight_allowed = self.browse(cr, uid, id, context=context).company_id.freight
-            inward_freight = self.browse(cr, uid, id, context=context).inward_freight
+        for purchase_order_id in ids:
+            purchase_order_obj = self.browse(cr, uid, purchase_order_id, context=context)
+            freight_allowed = purchase_order_obj.company_id.freight
+            inward_freight = purchase_order_obj.inward_freight
         if freight_allowed:
             account_invoice_obj.write(cr, uid, res, {'freight_charge': inward_freight}, context=context)
             account_invoice_obj.button_compute(cr, uid, [res], context=context, set_total=True)

=== modified file 'l10n_in_tax_retail_invoice/report/purchase_order.py'
--- l10n_in_tax_retail_invoice/report/purchase_order.py	2013-05-23 08:40:28 +0000
+++ l10n_in_tax_retail_invoice/report/purchase_order.py	2013-06-20 10:57:25 +0000
@@ -21,7 +21,7 @@
 
 import time
 
-from report import report_sxw
+from openerp.report import report_sxw
 
 class purchase_order(report_sxw.rml_parse):
     

=== modified file 'l10n_in_tax_retail_invoice/report/quotation.py'
--- l10n_in_tax_retail_invoice/report/quotation.py	2013-05-23 08:40:28 +0000
+++ l10n_in_tax_retail_invoice/report/quotation.py	2013-06-20 10:57:25 +0000
@@ -21,7 +21,7 @@
 
 import time
 
-from report import report_sxw
+from openerp.report import report_sxw
 
 class quotation(report_sxw.rml_parse):
     

=== modified file 'l10n_in_tax_retail_invoice/report/sale_order_tax.py'
--- l10n_in_tax_retail_invoice/report/sale_order_tax.py	2013-05-23 08:40:28 +0000
+++ l10n_in_tax_retail_invoice/report/sale_order_tax.py	2013-06-20 10:57:25 +0000
@@ -20,7 +20,7 @@
 ##############################################################################
 
 import time
-from report import report_sxw
+from openerp.report import report_sxw
 from openerp.tools.translate import _
 from openerp.osv import fields, osv
 

=== modified file 'l10n_in_tax_retail_invoice/report/sale_order_tax.rml'
--- l10n_in_tax_retail_invoice/report/sale_order_tax.rml	2013-05-23 08:40:28 +0000
+++ l10n_in_tax_retail_invoice/report/sale_order_tax.rml	2013-06-20 10:57:25 +0000
@@ -247,12 +247,12 @@
       <font face="Helvetica-Bold">Sales Order</font>
       <font color="white">..................................................................</font>
     </para>
-    <blockTable colWidths="240.0,113.0,177.0" style="Table9">
+    <blockTable colWidths="200.0,133.0,197.0" style="Table9">
       <tr>
         <td>
           <para style="P22">Buyer (if other than consignee)</para>
           <para style="P23">[[ (o.partner_id and o.partner_id.title and o.partner_id.title.name) or '' ]] [[ (o.partner_id and o.partner_id.name) or '' ]]</para>
-          <para style="P21">[[ (o.partner_id and o.partner_id.street) or '' ]] [[ (o.partner_id and o.partner_id.street2) or '']]</para>
+          <para style="P21">[[ display_address(o.partner_id) ]]</para>
         </td>
         <td>
           <para style="P10">Order No.</para>
@@ -265,7 +265,7 @@
       </tr>
       <tr>
         <td>
-          <para style="P21">[[ (o.partner_id and o.partner_id.city) or '' ]] - [[ (o.partner_id and o.partner_id.zip) or '' ]], [[ (o.partner_id and o.partner_id.state_id.name) or '' ]].</para>
+          <para style="P21"></para>
         </td>
         <td>
           <para style="P10">Mode/Terms of Payment</para>
@@ -277,14 +277,14 @@
         </td>
       </tr>
     </blockTable>
-    <blockTable colWidths="240.0,113.0,177.0" style="Table10">
+    <blockTable colWidths="200.0,133.0,197.0" style="Table10">
       <tr>
         <td>
           <para style="P17">
             <font face="Helvetica" size="8.0">Consignee</font>
           </para>
           <para style="P23">[[ (o.partner_shipping_id and o.partner_shipping_id.title and o.partner_shipping_id.title.name) or '' ]] [[ (o.partner_shipping_id and o.partner_shipping_id.name) or '' ]]</para>
-          <para style="P21">[[ (o.partner_shipping_id and o.partner_shipping_id.street) or '' ]] [[ (o.partner_shipping_id and o.partner_shipping_id.street2)]]</para>
+          <para style="P21">[[ display_address(o.partner_shipping_id) ]]</para>
         </td>
         <td>
           <para style="P10">Buyer's Order No.</para>
@@ -297,7 +297,7 @@
       </tr>
       <tr>
         <td>
-          <para style="P21">[[ (o.partner_shipping_id and o.partner_shipping_id.city) or '' ]] - [[ (o.partner_id and o.partner_id.zip) or '' ]], [[ (o.partner_shipping_id and o.partner_shipping_id.state_id and o.partner_shipping_id.state_id.name)]].</para>
+          <para style="P21"></para>
         </td>
         <td>
           <para style="P10">Dispatched through</para>
@@ -309,7 +309,7 @@
         </td>
       </tr>
     </blockTable>
-    <blockTable colWidths="240.0,290.0" style="Table11">
+    <blockTable colWidths="200.0,330.0" style="Table11">
       <tr>
         <td>
         </td>
@@ -677,7 +677,7 @@
     <para style="terp_default_9">
       <font color="white"> </font>
     </para>
-    <blockTable colWidths="334.0,197.0" style="Table8">
+    <blockTable colWidths="334.0,205.0" style="Table8">
       <tr>
         <td>
           <para style="terp_default_9">Declaration</para>

=== modified file 'l10n_in_tax_retail_invoice/report/tax_invoice.py'
--- l10n_in_tax_retail_invoice/report/tax_invoice.py	2013-05-23 08:40:28 +0000
+++ l10n_in_tax_retail_invoice/report/tax_invoice.py	2013-06-20 10:57:25 +0000
@@ -21,7 +21,7 @@
 
 import time
 
-from report import report_sxw
+from openerp.report import report_sxw
 
 class tax_invoice(report_sxw.rml_parse):
     

=== modified file 'l10n_in_tax_retail_invoice/report/tax_invoice.rml'
--- l10n_in_tax_retail_invoice/report/tax_invoice.rml	2013-05-23 08:40:28 +0000
+++ l10n_in_tax_retail_invoice/report/tax_invoice.rml	2013-06-20 10:57:25 +0000
@@ -241,12 +241,12 @@
       <font color="white">.............................................................</font>
       <font face="Helvetica" size="7.0">(Original)</font>
     </para>
-    <blockTable colWidths="230.0,140.0,160.0" style="Table9">
+    <blockTable colWidths="210.0,160.0,160.0" style="Table9">
       <tr>
         <td>
           <para style="P22">Buyer (if other than consignee)</para>
           <para style="P23">[[ (o.partner_id and o.partner_id.title and o.partner_id.title.name) or '' ]] [[ (o.partner_id and o.partner_id.name) or '' ]]</para>
-          <para style="P21">[[ (o.partner_id and o.partner_id.street) or '' ]] [[ (o.partner_id and o.partner_id.street2) or '']]</para>
+          <para style="P21">[[ display_address(o.partner_id) ]]</para>
         </td>
         <td>
           <para style="P10">Invoice No.</para>
@@ -259,8 +259,6 @@
       </tr>
       <tr>
         <td>
-          <para style="P21">[[ (o.partner_id and o.partner_id.village_taluka) or '' ]]</para>
-          <para style="P21">[[ (o.partner_id and o.partner_id.city) or '' ]] - [[ (o.partner_id and o.partner_id.zip) or '']], [[ (o.partner_id and o.partner_id.state_id.name) or '' ]].</para>
         </td>
         <td>
           <para style="P10">Delivery Note</para>
@@ -287,14 +285,14 @@
         </td>
       </tr>
     </blockTable>
-    <blockTable colWidths="230.0,140.0,160.0" style="Table10">
+    <blockTable colWidths="210.0,160.0,160.0" style="Table10">
       <tr>
         <td>
           <para style="P17">
             <font face="Helvetica" size="8.0">Consignee</font>
           </para>
           <para style="P23">[[ (o.delivery_address_id and o.delivery_address_id.title and o.delivery_address_id.title.name) or '' ]] [[ (o.delivery_address_id and o.delivery_address_id.name) or '' ]]</para>
-          <para style="P21">[[ (o.delivery_address_id and o.delivery_address_id.street) or '' ]] [[ (o.delivery_address_id and o.delivery_address_id.street2)]]</para>
+          <para style="P21">[[ display_address(o.delivery_address_id) ]]</para>
         </td>
         <td>
           <para style="P10">Buyer's Order No.</para>
@@ -307,8 +305,6 @@
       </tr>
       <tr>
         <td>
-          <para style="P21">[[ (o.delivery_address_id and o.delivery_address_id.village_taluka) or '' ]]</para>
-          <para style="P21">[[ (o.delivery_address_id and o.delivery_address_id.city) or '' ]] - [[ (o.delivery_address_id and o.delivery_address_id.zip) or '']], [[ (o.delivery_address_id and o.delivery_address_id.state_id and o.delivery_address_id.state_id.name)]].</para>
         </td>
         <td>
           <para style="P10">Dispatch Document No.</para>
@@ -333,7 +329,7 @@
         </td>
       </tr>
     </blockTable>
-    <blockTable colWidths="230.0,300.0" style="Table11">
+    <blockTable colWidths="210.0,320.0" style="Table11">
       <tr>
         <td>
           <para style="P1">
@@ -347,7 +343,7 @@
       </tr>
     </blockTable> 
     
-    <blockTable colWidths="200.0,60.0,50.0,61.0,50.0,40.0,69.0" style="Table3">[[ o.company_id.packing_cost or removeParentNode('blockTable') ]]
+    <blockTable colWidths="210.0,50.0,50.0,61.0,50.0,40.0,69.0" style="Table3">[[ o.company_id.packing_cost or removeParentNode('blockTable') ]]
       <tr>
         <td>
           <para style="P1">Description of Goods</para>
@@ -398,7 +394,7 @@
     
     <section>
       <para style="terp_default_2">[[ repeatIn(o.invoice_line,'l') ]]</para>
-      <blockTable colWidths="200.0,60.0,50.0,61.0,50.0,40.0,69.0" style="Table4"> [[ o.company_id.packing_cost or removeParentNode('blockTable') ]]
+      <blockTable colWidths="210.0,50.0,50.0,61.0,50.0,40.0,69.0" style="Table4"> [[ o.company_id.packing_cost or removeParentNode('blockTable') ]]
       	<tr>
           <td>
             <para style="terp_default_91">[[ l.product_id and l.product_id.categ_id.name or '']]</para>
@@ -515,7 +511,7 @@
     
     <section>
       <para style="terp_default_2">[[ repeatIn(o.tax_line,'t') ]]</para>
-      <blockTable colWidths="200.0,60.0,50.0,61.0,50.0,40.0,69.0" style="Table4"> [[ o.company_id.packing_cost or removeParentNode('blockTable') and (t.tax_code_id and t.tax_code_id.notprintable) and removeParentNode('blockTable')]]
+      <blockTable colWidths="210.0,50.0,50.0,61.0,50.0,40.0,69.0" style="Table4"> [[ o.company_id.packing_cost or removeParentNode('blockTable') and (t.tax_code_id and t.tax_code_id.notprintable) and removeParentNode('blockTable')]]
         <tr>
           <td>
             <para style="terp_default_81">[[ t.name ]] <font face="Helvetica">([[ t.tax_categ in ('excise', 'cess', 'cst', 'other') and removeParentNode('font') or ((t.base)) ]])</font></para>
@@ -579,7 +575,76 @@
       </blockTable>
     </section>
     
-    <blockTable colWidths="200.0,60.0,50.0,61.0,50.0,40.0,69.0" style="Table5"> [[ ( o.company_id.dealers_discount == True and o.company_id.packing_cost == True ) or removeParentNode('blockTable') ]]
+    <section>
+      <blockTable colWidths="210.0,70.0,50.0,71.0,40.0,89.0" style="Table5"> [[( o.freight_allowed == True and o.company_id.packing_cost == False) or removeParentNode('blockTable')]]
+        <tr>
+          <td>
+            <para style="terp_default_10"><font face="Helvetica">Inward Freight</font></para>
+          </td>
+          <td>
+            <para style="P1">
+              <font color="white"> </font>
+            </para>
+          </td>
+          <td>
+            <para style="P1">
+              <font color="white"> </font>
+            </para>
+          </td>
+          <td>
+            <para style="P1">
+              <font color="white"> </font>
+            </para>
+          </td>
+          <td>
+            <para style="P1">
+              <font color="white"> </font>
+            </para>
+          </td>
+          <td>
+            <para style="terp_default_Right_10">[[ o.currency_id.symbol ]] [[ formatLang(o.freight_charge, digits=get_digits(dp='Account')) ]]</para>
+          </td>
+        </tr>
+      </blockTable>
+      
+      <blockTable colWidths="210.0,50.0,50.0,61.0,50.0,40.0,69.0" style="Table5"> [[( o.company_id.packing_cost and o.freight_allowed == True) or removeParentNode('blockTable')]]
+        <tr>
+          <td>
+            <para style="terp_default_10"><font face="Helvetica">Inward Freight</font></para>
+           </td>
+           <td>
+             <para style="P1">
+               <font color="white"> </font>
+             </para>
+           </td>
+           <td>
+             <para style="P1">
+               <font color="white"> </font>
+             </para>
+           </td>
+           <td>
+             <para style="P1">
+               <font color="white"> </font>
+             </para>
+           </td>
+           <td>
+             <para style="P1">
+               <font color="white"> </font>
+             </para>
+           </td>
+           <td>
+             <para style="P1">
+               <font color="white"> </font>
+             </para>
+           </td>
+           <td>
+             <para style="terp_default_Right_10">[[ o.currency_id.symbol ]] [[ formatLang(o.freight_charge, digits=get_digits(dp='Account')) ]]</para>
+           </td>
+         </tr>
+       </blockTable>
+     </section>
+    
+    <blockTable colWidths="210.0,50.0,50.0,61.0,50.0,40.0,69.0" style="Table5"> [[ ( o.company_id.dealers_discount == True and o.company_id.packing_cost == True ) or removeParentNode('blockTable') ]]
       <tr>
         <td>
           <para style="terp_default_10">Dealers' Discount </para>
@@ -640,7 +705,7 @@
       </tr>
     </blockTable>
     
-    <blockTable colWidths="200.0,60.0,50.0,61.0,50.0,40.0,69.0" style="Table5"> [[ o.company_id.packing_cost or removeParentNode('blockTable') ]]
+    <blockTable colWidths="210.0,50.0,50.0,61.0,50.0,40.0,69.0" style="Table5"> [[ o.company_id.packing_cost or removeParentNode('blockTable') ]]
       <tr>
         <td>
           <para style="terp_default_10">Total</para>
@@ -703,7 +768,7 @@
     <para style="terp_default_9">
       <font color="white"> </font>
     </para>
-    <blockTable colWidths="334.0,197.0" style="Table8">
+    <blockTable colWidths="334.0,205.0" style="Table8">
       <tr>
         <td>
           <para style="terp_default_9">Declaration</para>
@@ -750,12 +815,12 @@
       <font color="white">..........................................................</font>
       <font face="Helvetica" size="7.0">(Duplicate)</font>
     </para>
-    <blockTable colWidths="230.0,140.0,160.0" style="Table9">
+    <blockTable colWidths="210.0,160.0,160.0" style="Table9">
       <tr>
         <td>
           <para style="P22">Buyer (if other than consignee)</para>
           <para style="P23">[[ (o.partner_id and o.partner_id.title and o.partner_id.title.name) or '' ]] [[ (o.partner_id and o.partner_id.name) or '' ]]</para>
-          <para style="P21">[[ (o.partner_id and o.partner_id.street) or '' ]] [[ (o.partner_id and o.partner_id.street2) or '']]</para>
+          <para style="P21">[[ display_address(o.partner_id) ]]</para>
         </td>
         <td>
           <para style="P10">Invoice No.</para>
@@ -768,8 +833,6 @@
       </tr>
       <tr>
         <td>
-          <para style="P21">[[ (o.partner_id and o.partner_id.village_taluka) or '' ]]</para>
-          <para style="P21">[[ (o.partner_id and o.partner_id.city) or '' ]] - [[ (o.partner_id and o.partner_id.zip) or '']], [[ (o.partner_id and o.partner_id.state_id.name) or '' ]].</para>
         </td>
         <td>
           <para style="P10">Delivery Note</para>
@@ -796,14 +859,14 @@
         </td>
       </tr>
     </blockTable>
-    <blockTable colWidths="230.0,140.0,160.0" style="Table10">
+    <blockTable colWidths="210.0,160.0,160.0" style="Table10">
       <tr>
         <td>
           <para style="P17">
             <font face="Helvetica" size="8.0">Consignee</font>
           </para>
           <para style="P23">[[ (o.delivery_address_id and o.delivery_address_id.title and o.delivery_address_id.title.name) or '' ]] [[ (o.delivery_address_id and o.delivery_address_id.name) or '' ]]</para>
-          <para style="P21">[[ (o.delivery_address_id and o.delivery_address_id.street) or '' ]] [[ (o.delivery_address_id and o.delivery_address_id.street2)]]</para>
+          <para style="P21">[[ display_address(o.delivery_address_id) ]]</para>
         </td>
         <td>
           <para style="P10">Buyer's Order No.</para>
@@ -816,8 +879,6 @@
       </tr>
       <tr>
         <td>
-          <para style="P21">[[ (o.delivery_address_id and o.delivery_address_id.village_taluka) or '' ]]</para>
-          <para style="P21">[[ (o.delivery_address_id and o.delivery_address_id.city) or '' ]] - [[ (o.delivery_address_id and o.delivery_address_id.zip) or '']], [[ (o.delivery_address_id and o.delivery_address_id.state_id and o.delivery_address_id.state_id.name)]].</para>
         </td>
         <td>
           <para style="P10">Dispatch Document No.</para>
@@ -842,7 +903,7 @@
         </td>
       </tr>
     </blockTable>
-    <blockTable colWidths="230.0,300.0" style="Table11">
+    <blockTable colWidths="210.0,320.0" style="Table11">
       <tr>
         <td>
           <para style="P1">
@@ -856,7 +917,7 @@
       </tr>
     </blockTable>
     
-    <blockTable colWidths="200.0,60.0,50.0,61.0,50.0,40.0,69.0" style="Table3">[[ o.company_id.packing_cost or removeParentNode('blockTable') ]]
+    <blockTable colWidths="210.0,50.0,50.0,61.0,50.0,40.0,69.0" style="Table3">[[ o.company_id.packing_cost or removeParentNode('blockTable') ]]
       <tr>
         <td>
           <para style="P1">Description of Goods</para>
@@ -907,7 +968,7 @@
     
     <section>
       <para style="terp_default_2">[[ repeatIn(o.invoice_line,'l') ]]</para>
-      <blockTable colWidths="200.0,60.0,50.0,61.0,50.0,40.0,69.0" style="Table4"> [[ o.company_id.packing_cost or removeParentNode('blockTable') ]]
+      <blockTable colWidths="210.0,50.0,50.0,61.0,50.0,40.0,69.0" style="Table4"> [[ o.company_id.packing_cost or removeParentNode('blockTable') ]]
       	<tr>
           <td>
             <para style="terp_default_91">[[ l.product_id and l.product_id.categ_id.name or '']]</para>
@@ -1024,7 +1085,7 @@
     
     <section>
       <para style="terp_default_2">[[ repeatIn(o.tax_line,'t') ]]</para>
-      <blockTable colWidths="200.0,60.0,50.0,61.0,50.0,40.0,69.0" style="Table4"> [[ o.company_id.packing_cost or removeParentNode('blockTable') and (t.tax_code_id and t.tax_code_id.notprintable) and removeParentNode('blockTable')]]
+      <blockTable colWidths="210.0,50.0,50.0,61.0,50.0,40.0,69.0" style="Table4"> [[ o.company_id.packing_cost or removeParentNode('blockTable') and (t.tax_code_id and t.tax_code_id.notprintable) and removeParentNode('blockTable')]]
         <tr>
           <td>
             <para style="terp_default_81">[[ t.name ]] <font face="Helvetica">([[ t.tax_categ in ('excise', 'cess', 'cst', 'other') and removeParentNode('font') or ((t.base)) ]])</font></para>
@@ -1087,7 +1148,76 @@
         </tr>
       </blockTable>
     </section>
-    <blockTable colWidths="200.0,60.0,50.0,61.0,50.0,40.0,69.0" style="Table5"> [[ ( o.company_id.dealers_discount == True and o.company_id.packing_cost == True ) or removeParentNode('blockTable') ]]
+    
+    <section>
+      <blockTable colWidths="210.0,70.0,50.0,71.0,40.0,89.0" style="Table5"> [[( o.freight_allowed == True and o.company_id.packing_cost == False) or removeParentNode('blockTable')]]
+        <tr>
+          <td>
+            <para style="terp_default_10"><font face="Helvetica">Inward Freight</font></para>
+          </td>
+          <td>
+            <para style="P1">
+              <font color="white"> </font>
+            </para>
+          </td>
+          <td>
+            <para style="P1">
+              <font color="white"> </font>
+            </para>
+          </td>
+          <td>
+            <para style="P1">
+              <font color="white"> </font>
+            </para>
+          </td>
+          <td>
+            <para style="P1">
+              <font color="white"> </font>
+            </para>
+          </td>
+          <td>
+            <para style="terp_default_Right_10">[[ o.currency_id.symbol ]] [[ formatLang(o.freight_charge, digits=get_digits(dp='Account')) ]]</para>
+          </td>
+        </tr>
+      </blockTable>
+      
+      <blockTable colWidths="210.0,50.0,50.0,61.0,50.0,40.0,69.0" style="Table5"> [[( o.company_id.packing_cost and o.freight_allowed == True) or removeParentNode('blockTable')]]
+        <tr>
+          <td>
+           <para style="terp_default_10"><font face="Helvetica">Inward Freight</font></para>
+          </td>
+          <td>
+            <para style="P1">
+              <font color="white"> </font>
+            </para>
+          </td>
+          <td>
+            <para style="P1">
+              <font color="white"> </font>
+            </para>
+          </td>
+          <td>
+            <para style="P1">
+              <font color="white"> </font>
+            </para>
+          </td>
+          <td>
+            <para style="P1">
+              <font color="white"> </font>
+            </para>
+          </td>
+          <td>
+            <para style="P1">
+              <font color="white"> </font>
+            </para>
+          </td>
+          <td>
+            <para style="terp_default_Right_10">[[ o.currency_id.symbol ]] [[ formatLang(o.freight_charge, digits=get_digits(dp='Account')) ]]</para>
+          </td>
+        </tr>
+      </blockTable>
+    </section>
+    <blockTable colWidths="210.0,50.0,50.0,61.0,50.0,40.0,69.0" style="Table5"> [[ ( o.company_id.dealers_discount == True and o.company_id.packing_cost == True ) or removeParentNode('blockTable') ]]
       <tr>
         <td>
           <para style="terp_default_10">Dealers' Discount </para>
@@ -1149,7 +1279,7 @@
     </blockTable>
     
     
-    <blockTable colWidths="200.0,60.0,50.0,61.0,50.0,40.0,69.0" style="Table5"> [[ o.company_id.packing_cost or removeParentNode('blockTable') ]]
+    <blockTable colWidths="210.0,50.0,50.0,61.0,50.0,40.0,69.0" style="Table5"> [[ o.company_id.packing_cost or removeParentNode('blockTable') ]]
       <tr>
         <td>
           <para style="terp_default_10">Total</para>
@@ -1212,7 +1342,7 @@
     <para style="terp_default_9">
       <font color="white"> </font>
     </para>
-    <blockTable colWidths="334.0,197.0" style="Table8">
+    <blockTable colWidths="334.0,205.0" style="Table8">
       <tr>
         <td>
           <para style="terp_default_9">Declaration</para>
@@ -1259,12 +1389,12 @@
       <font color="white">.........................................................</font>
       <font face="Helvetica" size="7.0">(Triplicate)</font>
     </para>
-    <blockTable colWidths="230.0,140.0,160.0" style="Table9">
+    <blockTable colWidths="210.0,160.0,160.0" style="Table9">
       <tr>
         <td>
           <para style="P22">Buyer (if other than consignee)</para>
           <para style="P23">[[ (o.partner_id and o.partner_id.title and o.partner_id.title.name) or '' ]] [[ (o.partner_id and o.partner_id.name) or '' ]]</para>
-          <para style="P21">[[ (o.partner_id and o.partner_id.street) or '' ]] [[ (o.partner_id and o.partner_id.street2) or '']]</para>
+          <para style="P21">[[ display_address(o.partner_id) ]]</para>
         </td>
         <td>
           <para style="P10">Invoice No.</para>
@@ -1277,8 +1407,6 @@
       </tr>
       <tr>
         <td>
-          <para style="P21">[[ (o.partner_id and o.partner_id.village_taluka) or '' ]]</para>
-          <para style="P21">[[ (o.partner_id and o.partner_id.city) or '' ]] - [[ (o.partner_id and o.partner_id.zip) or '']], [[ (o.partner_id and o.partner_id.state_id.name) or '' ]].</para>
         </td>
         <td>
           <para style="P10">Delivery Note</para>
@@ -1305,14 +1433,14 @@
         </td>
       </tr>
     </blockTable>
-    <blockTable colWidths="230.0,140.0,160.0" style="Table10">
+    <blockTable colWidths="210.0,160.0,160.0" style="Table10">
       <tr>
         <td>
           <para style="P17">
             <font face="Helvetica" size="8.0">Consignee</font>
           </para>
           <para style="P23">[[ (o.delivery_address_id and o.delivery_address_id.title and o.delivery_address_id.title.name) or '' ]] [[ (o.delivery_address_id and o.delivery_address_id.name) or '' ]]</para>
-          <para style="P21">[[ (o.delivery_address_id and o.delivery_address_id.street) or '' ]] [[ (o.delivery_address_id and o.delivery_address_id.street2)]]</para>
+          <para style="P21">[[ display_address(o.delivery_address_id) ]]</para>
         </td>
         <td>
           <para style="P10">Buyer's Order No.</para>
@@ -1325,8 +1453,6 @@
       </tr>
       <tr>
         <td>
-          <para style="P21">[[ (o.delivery_address_id and o.delivery_address_id.village_taluka) or '' ]]</para>
-          <para style="P21">[[ (o.delivery_address_id and o.delivery_address_id.city) or '' ]] - [[ (o.delivery_address_id and o.delivery_address_id.zip) or '']], [[ (o.delivery_address_id and o.delivery_address_id.state_id and o.delivery_address_id.state_id.name)]].</para>
         </td>
         <td>
           <para style="P10">Dispatch Document No.</para>
@@ -1351,7 +1477,7 @@
         </td>
       </tr>
     </blockTable>
-    <blockTable colWidths="230.0,300.0" style="Table11">
+    <blockTable colWidths="210.0,320.0" style="Table11">
       <tr>
         <td>
           <para style="P1">
@@ -1365,7 +1491,7 @@
       </tr>
     </blockTable>
     
-    <blockTable colWidths="200.0,60.0,50.0,61.0,50.0,40.0,69.0" style="Table3">[[ o.company_id.packing_cost or removeParentNode('blockTable') ]]
+    <blockTable colWidths="210.0,50.0,50.0,61.0,50.0,40.0,69.0" style="Table3">[[ o.company_id.packing_cost or removeParentNode('blockTable') ]]
       <tr>
         <td>
           <para style="P1">Description of Goods</para>
@@ -1416,7 +1542,7 @@
     
     <section>
       <para style="terp_default_2">[[ repeatIn(o.invoice_line,'l') ]]</para>
-      <blockTable colWidths="200.0,60.0,50.0,61.0,50.0,40.0,69.0" style="Table4"> [[ o.company_id.packing_cost or removeParentNode('blockTable') ]]
+      <blockTable colWidths="210.0,50.0,50.0,61.0,50.0,40.0,69.0" style="Table4"> [[ o.company_id.packing_cost or removeParentNode('blockTable') ]]
       	<tr>
           <td>
             <para style="terp_default_91">[[ l.product_id and l.product_id.categ_id.name or '']]</para>
@@ -1533,7 +1659,7 @@
     
     <section>
       <para style="terp_default_2">[[ repeatIn(o.tax_line,'t') ]]</para>
-      <blockTable colWidths="200.0,60.0,50.0,61.0,50.0,40.0,69.0" style="Table4"> [[ o.company_id.packing_cost or removeParentNode('blockTable') and (t.tax_code_id and t.tax_code_id.notprintable) and removeParentNode('blockTable')]]
+      <blockTable colWidths="210.0,50.0,50.0,61.0,50.0,40.0,69.0" style="Table4"> [[ o.company_id.packing_cost or removeParentNode('blockTable') and (t.tax_code_id and t.tax_code_id.notprintable) and removeParentNode('blockTable')]]
         <tr>
           <td>
             <para style="terp_default_81">[[ t.name ]] <font face="Helvetica">([[ t.tax_categ in ('excise', 'cess', 'cst', 'other') and removeParentNode('font') or ((t.base)) ]])</font></para>
@@ -1597,7 +1723,76 @@
       </blockTable>
     </section>
     
-    <blockTable colWidths="200.0,60.0,50.0,61.0,50.0,40.0,69.0" style="Table5"> [[ ( o.company_id.dealers_discount == True and o.company_id.packing_cost == True ) or removeParentNode('blockTable') ]]
+    <section>
+      <blockTable colWidths="210.0,70.0,50.0,71.0,40.0,89.0" style="Table5"> [[( o.freight_allowed == True and o.company_id.packing_cost == False) or removeParentNode('blockTable')]]
+        <tr>
+          <td>
+            <para style="terp_default_10"><font face="Helvetica">Inward Freight</font></para>
+          </td>
+          <td>
+            <para style="P1">
+              <font color="white"> </font>
+            </para>
+          </td>
+          <td>
+            <para style="P1">
+              <font color="white"> </font>
+            </para>
+          </td>
+          <td>
+            <para style="P1">
+              <font color="white"> </font>
+            </para>
+          </td>
+          <td>
+            <para style="P1">
+              <font color="white"> </font>
+            </para>
+          </td>
+          <td>
+            <para style="terp_default_Right_10">[[ o.currency_id.symbol ]] [[ formatLang(o.freight_charge, digits=get_digits(dp='Account')) ]]</para>
+          </td>
+        </tr>
+      </blockTable>
+      
+      <blockTable colWidths="210.0,50.0,50.0,61.0,50.0,40.0,69.0" style="Table5"> [[( o.company_id.packing_cost and o.freight_allowed == True) or removeParentNode('blockTable')]]
+        <tr>
+          <td>
+           <para style="terp_default_10"><font face="Helvetica">Inward Freight</font></para>
+          </td>
+          <td>
+            <para style="P1">
+              <font color="white"> </font>
+            </para>
+          </td>
+          <td>
+            <para style="P1">
+              <font color="white"> </font>
+            </para>
+          </td>
+          <td>
+            <para style="P1">
+              <font color="white"> </font>
+            </para>
+          </td>
+          <td>
+            <para style="P1">
+              <font color="white"> </font>
+            </para>
+          </td>
+          <td>
+            <para style="P1">
+              <font color="white"> </font>
+            </para>
+          </td>
+          <td>
+            <para style="terp_default_Right_10">[[ o.currency_id.symbol ]] [[ formatLang(o.freight_charge, digits=get_digits(dp='Account')) ]]</para>
+          </td>
+        </tr>
+      </blockTable>
+    </section>
+    
+    <blockTable colWidths="210.0,50.0,50.0,61.0,50.0,40.0,69.0" style="Table5"> [[ ( o.company_id.dealers_discount == True and o.company_id.packing_cost == True ) or removeParentNode('blockTable') ]]
       <tr>
         <td>
           <para style="terp_default_10">Dealers' Discount </para>
@@ -1658,7 +1853,7 @@
       </tr>
     </blockTable>
     
-    <blockTable colWidths="200.0,60.0,50.0,61.0,50.0,40.0,69.0" style="Table5"> [[ o.company_id.packing_cost or removeParentNode('blockTable') ]]
+    <blockTable colWidths="210.0,50.0,50.0,61.0,50.0,40.0,69.0" style="Table5"> [[ o.company_id.packing_cost or removeParentNode('blockTable') ]]
       <tr>
         <td>
           <para style="terp_default_10">Total</para>
@@ -1721,7 +1916,7 @@
     <para style="terp_default_9">
       <font color="white"> </font>
     </para>
-    <blockTable colWidths="334.0,197.0" style="Table8">
+    <blockTable colWidths="334.0,205.0" style="Table8">
       <tr>
         <td>
           <para style="terp_default_9">Declaration</para>
@@ -1768,12 +1963,12 @@
       <font color="white">........................................................</font>
       <font face="Helvetica" size="7.0">(Extra Copy)</font>
     </para>
-    <blockTable colWidths="230.0,140.0,160.0" style="Table9">
+    <blockTable colWidths="210.0,160.0,160.0" style="Table9">
       <tr>
         <td>
           <para style="P22">Buyer (if other than consignee)</para>
           <para style="P23">[[ (o.partner_id and o.partner_id.title and o.partner_id.title.name) or '' ]] [[ (o.partner_id and o.partner_id.name) or '' ]]</para>
-          <para style="P21">[[ (o.partner_id and o.partner_id.street) or '' ]] [[ (o.partner_id and o.partner_id.street2) or '']]</para>
+          <para style="P21">[[ display_address(o.partner_id) ]]</para>
         </td>
         <td>
           <para style="P10">Invoice No.</para>
@@ -1786,8 +1981,6 @@
       </tr>
       <tr>
         <td>
-          <para style="P21">[[ (o.partner_id and o.partner_id.village_taluka) or '' ]]</para>
-          <para style="P21">[[ (o.partner_id and o.partner_id.city) or '' ]] - [[ (o.partner_id and o.partner_id.zip) or '']], [[ (o.partner_id and o.partner_id.state_id.name) or '' ]].</para>
         </td>
         <td>
           <para style="P10">Delivery Note</para>
@@ -1814,14 +2007,14 @@
         </td>
       </tr>
     </blockTable>
-    <blockTable colWidths="230.0,140.0,160.0" style="Table10">
+    <blockTable colWidths="210.0,160.0,160.0" style="Table10">
       <tr>
         <td>
           <para style="P17">
             <font face="Helvetica" size="8.0">Consignee</font>
           </para>
           <para style="P23">[[ (o.delivery_address_id and o.delivery_address_id.title and o.delivery_address_id.title.name) or '' ]] [[ (o.delivery_address_id and o.delivery_address_id.name) or '' ]]</para>
-          <para style="P21">[[ (o.delivery_address_id and o.delivery_address_id.street) or '' ]] [[ (o.delivery_address_id and o.delivery_address_id.street2)]]</para>
+          <para style="P21">[[ display_address(o.delivery_address_id) ]]</para>
         </td>
         <td>
           <para style="P10">Buyer's Order No.</para>
@@ -1834,8 +2027,6 @@
       </tr>
       <tr>
         <td>
-          <para style="P21">[[ (o.delivery_address_id and o.delivery_address_id.village_taluka) or '' ]]</para>
-          <para style="P21">[[ (o.delivery_address_id and o.delivery_address_id.city) or '' ]] - [[ (o.delivery_address_id and o.delivery_address_id.zip) or '']], [[ (o.delivery_address_id and o.delivery_address_id.state_id and o.delivery_address_id.state_id.name)]].</para>
         </td>
         <td>
           <para style="P10">Dispatch Document No.</para>
@@ -1860,7 +2051,7 @@
         </td>
       </tr>
     </blockTable>
-    <blockTable colWidths="230.0,300.0" style="Table11">
+    <blockTable colWidths="210.0,320.0" style="Table11">
       <tr>
         <td>
           <para style="P1">
@@ -1874,7 +2065,7 @@
       </tr>
     </blockTable>
     
-    <blockTable colWidths="200.0,60.0,50.0,61.0,50.0,40.0,69.0" style="Table3">[[ o.company_id.packing_cost or removeParentNode('blockTable') ]]
+    <blockTable colWidths="210.0,50.0,50.0,61.0,50.0,40.0,69.0" style="Table3">[[ o.company_id.packing_cost or removeParentNode('blockTable') ]]
       <tr>
         <td>
           <para style="P1">Description of Goods</para>
@@ -1925,7 +2116,7 @@
     
     <section>
       <para style="terp_default_2">[[ repeatIn(o.invoice_line,'l') ]]</para>
-      <blockTable colWidths="200.0,60.0,50.0,61.0,50.0,40.0,69.0" style="Table4"> [[ o.company_id.packing_cost or removeParentNode('blockTable') ]]
+      <blockTable colWidths="210.0,50.0,50.0,61.0,50.0,40.0,69.0" style="Table4"> [[ o.company_id.packing_cost or removeParentNode('blockTable') ]]
       	<tr>
           <td>
             <para style="terp_default_91">[[ l.product_id and l.product_id.categ_id.name or '']]</para>
@@ -2042,7 +2233,7 @@
     
     <section>
       <para style="terp_default_2">[[ repeatIn(o.tax_line,'t') ]]</para>
-      <blockTable colWidths="200.0,60.0,50.0,61.0,50.0,40.0,69.0" style="Table4"> [[ o.company_id.packing_cost or removeParentNode('blockTable') and (t.tax_code_id and t.tax_code_id.notprintable) and removeParentNode('blockTable')]]
+      <blockTable colWidths="210.0,50.0,50.0,61.0,50.0,40.0,69.0" style="Table4"> [[ o.company_id.packing_cost or removeParentNode('blockTable') and (t.tax_code_id and t.tax_code_id.notprintable) and removeParentNode('blockTable')]]
         <tr>
           <td>
             <para style="terp_default_81">[[ t.name ]] <font face="Helvetica">([[ t.tax_categ in ('excise', 'cess', 'cst', 'other') and removeParentNode('font') or ((t.base)) ]])</font></para>
@@ -2106,7 +2297,76 @@
       </blockTable>
     </section>
     
-    <blockTable colWidths="200.0,60.0,50.0,61.0,50.0,40.0,69.0" style="Table5"> [[ ( o.company_id.dealers_discount == True and o.company_id.packing_cost == True ) or removeParentNode('blockTable') ]]
+    <section>
+      <blockTable colWidths="210.0,70.0,50.0,71.0,40.0,89.0" style="Table5"> [[( o.freight_allowed == True and o.company_id.packing_cost == False) or removeParentNode('blockTable')]]
+        <tr>
+          <td>
+            <para style="terp_default_10"><font face="Helvetica">Inward Freight</font></para>
+          </td>
+          <td>
+            <para style="P1">
+              <font color="white"> </font>
+            </para>
+          </td>
+          <td>
+            <para style="P1">
+              <font color="white"> </font>
+            </para>
+          </td>
+          <td>
+            <para style="P1">
+              <font color="white"> </font>
+            </para>
+          </td>
+          <td>
+            <para style="P1">
+              <font color="white"> </font>
+            </para>
+          </td>
+          <td>
+            <para style="terp_default_Right_10">[[ o.currency_id.symbol ]] [[ formatLang(o.freight_charge, digits=get_digits(dp='Account')) ]]</para>
+          </td>
+        </tr>
+      </blockTable>
+      
+      <blockTable colWidths="210.0,50.0,50.0,61.0,50.0,40.0,69.0" style="Table5"> [[( o.company_id.packing_cost and o.freight_allowed == True) or removeParentNode('blockTable')]]
+        <tr>
+          <td>
+           <para style="terp_default_10"><font face="Helvetica">Inward Freight</font></para>
+          </td>
+          <td>
+            <para style="P1">
+              <font color="white"> </font>
+            </para>
+          </td>
+          <td>
+            <para style="P1">
+              <font color="white"> </font>
+            </para>
+          </td>
+          <td>
+            <para style="P1">
+              <font color="white"> </font>
+            </para>
+          </td>
+          <td>
+            <para style="P1">
+              <font color="white"> </font>
+            </para>
+          </td>
+          <td>
+            <para style="P1">
+              <font color="white"> </font>
+            </para>
+          </td>
+          <td>
+            <para style="terp_default_Right_10">[[ o.currency_id.symbol ]] [[ formatLang(o.freight_charge, digits=get_digits(dp='Account')) ]]</para>
+          </td>
+        </tr>
+      </blockTable>
+    </section>
+    
+    <blockTable colWidths="210.0,50.0,50.0,61.0,50.0,40.0,69.0" style="Table5"> [[ ( o.company_id.dealers_discount == True and o.company_id.packing_cost == True ) or removeParentNode('blockTable') ]]
       <tr>
         <td>
           <para style="terp_default_10">Dealers' Discount </para>
@@ -2167,7 +2427,7 @@
       </tr>
     </blockTable>
     
-    <blockTable colWidths="200.0,60.0,50.0,61.0,50.0,40.0,69.0" style="Table5"> [[ o.company_id.packing_cost or removeParentNode('blockTable') ]]
+    <blockTable colWidths="210.0,50.0,50.0,61.0,50.0,40.0,69.0" style="Table5"> [[ o.company_id.packing_cost or removeParentNode('blockTable') ]]
       <tr>
         <td>
           <para style="terp_default_10">Total</para>
@@ -2230,7 +2490,7 @@
     <para style="terp_default_9">
       <font color="white"> </font>
     </para>
-    <blockTable colWidths="334.0,197.0" style="Table8">
+    <blockTable colWidths="334.0,205.0" style="Table8">
       <tr>
         <td>
           <para style="terp_default_9">Declaration</para>

=== modified file 'l10n_in_tax_retail_invoice/report/tax_invoice.sxw'
Binary files l10n_in_tax_retail_invoice/report/tax_invoice.sxw	2013-05-23 08:40:28 +0000 and l10n_in_tax_retail_invoice/report/tax_invoice.sxw	2013-06-20 10:57:25 +0000 differ
=== added directory 'l10n_in_tax_retail_invoice/test'
=== added file 'l10n_in_tax_retail_invoice/test/purchase_order.yml'
--- l10n_in_tax_retail_invoice/test/purchase_order.yml	1970-01-01 00:00:00 +0000
+++ l10n_in_tax_retail_invoice/test/purchase_order.yml	2013-06-20 10:57:25 +0000
@@ -0,0 +1,42 @@
+-
+  In order to test the tax invoice reports defined on an invoice, I create a Purchase Order with cost price 13.0 and inward freight 5.0.
+-
+  !record {model: purchase.order, id: purchase_order_1}:
+    partner_id: base.res_partner_3
+    invoice_method: 'order'
+    inward_freight: 5.0
+    order_line:
+      - product_id: product.product_product_48
+        product_qty: 1.0
+        price_unit: 13.0
+-
+  I confirm the purchase order and supplier invoice is created.
+-
+  !workflow {model: purchase.order, ref: purchase_order_1, action: purchase_confirm}
+-
+  I select Purchase Freight and check that the untaxed Amount should be 13.0, and Total Amount should be 18.0.
+-
+  !python {model: purchase.order}: |
+    purchase = self.browse(cr,uid,ref('purchase_order_1'))
+    assert(purchase.amount_untaxed == 13.0), _('Untax Amount should be 13.0')
+    assert(purchase.inward_freight == 5.0), _('Inward Freight should be 5.0')
+    if purchase.company_id.freight:
+        assert(purchase.amount_total == 18.0), _('Amount should be 18.0')
+-
+  I check that supplier invoice is created or not after confirming purchase order.
+-
+  !python {model: purchase.order}: |
+    purchase_order_obj = self.browse(cr,uid,ref('purchase_order_1'))
+    invoice_id = self.pool.get('account.invoice').search(cr, uid, [('partner_id','=',purchase_order_obj.partner_id.id),('origin','=',purchase_order_obj.name)])
+    assert(invoice_id), _('Supplier Invoice should be created')
+-
+ In order to test PDF reports defined on invoice, we will print an tax Invoice Report.
+-
+  !python {model: account.invoice}: |
+    from openerp import netsvc, tools
+    import os
+    purchase_order_obj = self.pool.get('purchase.order').browse(cr,uid,ref('purchase_order_1'))
+    invoice_id = self.search(cr,uid,[('partner_id','=',purchase_order_obj.partner_id.id),('origin','=',purchase_order_obj.name)])
+    (data, format) = netsvc.LocalService('report.account.invoice.tax.excise').create(cr, uid, invoice_id, {}, {})
+    if tools.config['test_report_directory']:
+        file(os.path.join(tools.config['test_report_directory'], 'account-invoice.'+format), 'wb+').write(data)

=== added file 'l10n_in_tax_retail_invoice/test/sale_order.yml'
--- l10n_in_tax_retail_invoice/test/sale_order.yml	1970-01-01 00:00:00 +0000
+++ l10n_in_tax_retail_invoice/test/sale_order.yml	2013-06-20 10:57:25 +0000
@@ -0,0 +1,69 @@
+-
+  In order to test the tax invoice reports defined on an invoice, we will create sale order with packing amount and dealers discount. 
+  For that we have a VAT tax defined.
+-  
+    !record {model: account.tax, id: tax_1}:
+      name: 'Vat'
+      tax_categ: 'vat'
+      amount: 0.04
+-
+  we have a Additional tax defined.
+-  
+    !record {model: account.tax, id: tax_2}:
+      name: 'Additional'
+      tax_categ: 'other'
+      amount: 0.01
+-
+  Create  one  sale order for [ADPT] USB Adapter.
+-
+   !record {model: sale.order, id: sale_order_01}:
+    partner_id: base.res_partner_2
+    order_policy: 'prepaid'
+    order_line:
+      - name: USB Adapter
+        product_uom_qty: 1.0
+        price_unit: 18.0
+        packing_amount: 5.0
+        lst_price: 10.0
+        tax_id:
+          - tax_1
+          - tax_2
+-
+  I confirm sale order. 
+-
+  !workflow {model: sale.order, action: order_confirm, ref: sale_order_01}
+
+-
+  I select Packing cost and check that the untaxed Amount should be 23.0, Tax should be 1.15, Total Amount is 24.15.
+-
+  !python {model: sale.order}: |
+    sale = self.browse(cr, uid, ref('sale_order_01'))
+    if sale.company_id.packing_cost:
+        assert(sale.amount_untaxed == 23.0), _('Untax Amount should be 23.0')
+        assert(sale.amount_tax == 1.15), _('Tax should be 1.15')
+        assert(sale.amount_total == 24.15), _('Amount should be 24.15')
+-
+  I check that the dealers discount should be 8.0.
+-
+  !python {model: sale.order}: |
+    sale = self.browse(cr, uid, ref('sale_order_01'))
+    assert(sale.dealers_disc == 8.0), _('Dealers discount should be 8.0')
+
+-
+  I check that customer invoice is created or not after confirming sale order.
+-
+  !python {model: sale.order}: |
+    sale_order_obj = self.browse(cr, uid, ref('sale_order_01'))
+    invoice_id = self.pool.get('account.invoice').search(cr, uid, [('partner_id','=',sale_order_obj.partner_id.id),('origin','=',sale_order_obj.name)])
+    assert(invoice_id), _('customer Invoice should be created') 
+-
+ In order to test the PDF reports defined on an invoice, we will print an Tax Invoice Report.
+-
+  !python {model: account.invoice}: |
+    import netsvc, tools, os
+    sale_order_obj = self.pool.get('sale.order').browse(cr, uid, ref('sale_order_01'))
+    invoice_id = self.search(cr, uid, [('partner_id','=',sale_order_obj.partner_id.id),('origin','=',sale_order_obj.name)])
+    (data, format) = netsvc.LocalService('report.account.invoice.tax.excise').create(cr, uid, invoice_id, {}, {})
+    if tools.config['test_report_directory']:
+        file(os.path.join(tools.config['test_report_directory'], 'account-invoice.'+format), 'wb+').write(data)
+


Follow ups