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

Proposed by Nimesh Contractor(Open ERP)
Status: Merged
Merge reported by: Atul Patel(OpenERP)
Merged at revision: not available
Proposed branch: lp:~openerp-india/openerp-india/trunk-nco
Merge into: lp:openerp-india
Diff against target: 1638 lines (+649/-211)
10 files modified
l10n_in_tax_retail_invoice/__openerp__.py (+4/-0)
l10n_in_tax_retail_invoice/l10n_in_tax_retail_invoice.py (+202/-139)
l10n_in_tax_retail_invoice/report/purchase_order.py (+1/-1)
l10n_in_tax_retail_invoice/report/quotation.py (+1/-1)
l10n_in_tax_retail_invoice/report/sale_order_tax.py (+1/-1)
l10n_in_tax_retail_invoice/report/sale_order_tax.rml (+8/-8)
l10n_in_tax_retail_invoice/report/tax_invoice.py (+1/-1)
l10n_in_tax_retail_invoice/report/tax_invoice.rml (+320/-60)
l10n_in_tax_retail_invoice/test/purchase_order.yml (+42/-0)
l10n_in_tax_retail_invoice/test/sale_order.yml (+69/-0)
To merge this branch: bzr merge lp:~openerp-india/openerp-india/trunk-nco
Reviewer Review Type Date Requested Status
Mustufa Rangwala (Open ERP) Pending
Review via email: mp+170580@code.launchpad.net

This proposal supersedes a proposal from 2013-06-19.

Description of the change

Hello,

I have removed unused protal changes.

Thank You.
Nimesh.

To post a comment you must log in.
Revision history for this message
Mustufa Rangwala (Open ERP) (mra-tinyerp) wrote : Posted in a previous version of this proposal

Make clean diff currently it is showing changes on portal also..

Thanks,

review: Needs Fixing

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'l10n_in_tax_retail_invoice/__openerp__.py'
2--- l10n_in_tax_retail_invoice/__openerp__.py 2013-05-23 08:40:28 +0000
3+++ l10n_in_tax_retail_invoice/__openerp__.py 2013-06-20 10:57:25 +0000
4@@ -53,6 +53,10 @@
5 'l10n_in_tax_retail_invoice_view.xml',
6 'res_config_view.xml',
7 ],
8+ 'test':[
9+ 'test/purchase_order.yml',
10+ 'test/sale_order.yml',
11+ ],
12 'installable': True,
13 'auto_install': False,
14 }
15
16=== modified file 'l10n_in_tax_retail_invoice/l10n_in_tax_retail_invoice.py'
17--- l10n_in_tax_retail_invoice/l10n_in_tax_retail_invoice.py 2013-05-23 08:40:28 +0000
18+++ l10n_in_tax_retail_invoice/l10n_in_tax_retail_invoice.py 2013-06-20 10:57:25 +0000
19@@ -23,7 +23,7 @@
20 from lxml import etree
21
22 from openerp.osv import fields, osv
23-from tools.amount_to_text_en import amount_to_text
24+from openerp.tools.amount_to_text_en import amount_to_text
25 from openerp.tools.translate import _
26 from openerp import netsvc
27 import openerp.addons.decimal_precision as dp
28@@ -42,17 +42,20 @@
29 _inherit = "product.product"
30
31 def _check_packing_cost_allowed(self, cr, uid, ids, name, args, context=None):
32+ '''
33+ This function allows us to use Packing Cost Features.
34+
35+ :param ids: list of product record ids.
36+ :param name : browse name fields of packing_cost_allowed
37+ :returns: True or False value of Packing Cost of company.
38+ :rtype: dict
39+ '''
40 res = {}
41 res_company = self.pool.get('res.company')
42 for id in ids:
43- packing_cost_allowed = res_company.browse(cr, uid, uid, context=context).packing_cost
44- res[id] = packing_cost_allowed
45- return res
46+ res[id] = res_company.browse(cr, uid, uid, context=context).packing_cost
47+ return res
48
49- def _default_check_packing_cost_allowed(self, cr, uid, ids, context=None):
50- res_company = self.pool.get('res.company')
51- packing_cost_allowed = res_company.browse(cr, uid, uid, context=context).packing_cost
52- return packing_cost_allowed
53
54 _columns = {
55 'packing_cost_type': fields.selection([
56@@ -65,26 +68,27 @@
57 }
58
59 _defaults = {
60- 'packing_cost_allowed': _default_check_packing_cost_allowed,
61- 'packing_cost_type': 'percentage',
62+ 'packing_cost_allowed': lambda self, cr, uid, context: self.pool.get('res.company').browse(cr, uid, uid, context=context).packing_cost,
63+ 'packing_cost_type': 'percentage',
64 }
65
66 class res_partner(osv.osv):
67
68 _inherit = "res.partner"
69-
70+
71 def _check_dealers_discount_allowed(self, cr, uid, ids, name, args, context=None):
72+ '''
73+ This function allows us to use dealers discount feature.
74+
75+ :param ids: list of partner record ids.
76+ :returns: True or False value of dealers discount of company
77+ :rtype: dict of true and false value
78+ '''
79 res = {}
80 res_company = self.pool.get('res.company')
81 for id in ids:
82- dealers_discount_allowed = res_company.browse(cr, uid, uid, context=context).dealers_discount
83- res[id] = dealers_discount_allowed
84- return res
85-
86- def _default_check_dealers_discount_allowed(self, cr, uid, ids, context=None):
87- res_company = self.pool.get('res.company')
88- dealers_discount_allowed = res_company.browse(cr, uid, uid, context=context).dealers_discount
89- return dealers_discount_allowed
90+ res[id] = res_company.browse(cr, uid, uid, context=context).dealers_discount
91+ return res
92
93 _columns = {
94 'tin_no' : fields.char('TIN', size=32, help="Tax Identification Number"),
95@@ -98,9 +102,12 @@
96 }
97
98 _defaults = {
99- 'dealers_discount_allowed': _default_check_dealers_discount_allowed,
100+ 'dealers_discount_allowed': lambda self, cr, uid, context: self.pool.get('res.company').browse(cr, uid, uid, context=context).dealers_discount,
101 }
102 def _check_recursion(self, cr, uid, ids, context=None):
103+ """
104+ Set constraints to cannot create recursive dealers.
105+ """
106 level = 100
107 while len(ids):
108 cr.execute('select distinct dealer_id from res_partner where id IN %s',(tuple(ids),))
109@@ -151,17 +158,34 @@
110
111 _inherit = "sale.order"
112
113- def _get_pack_total(self, cursor, user, ids, name, arg, context=None):
114+ def _get_pack_total(self, cr, uid, ids, name, arg, context=None):
115+ '''
116+ The purpose of this function is to build and return packing_total and dealers_disc
117+ :param ids: list of sale order ids
118+ :returns: packing_total and dealers_disc
119+ :rtype: dictionary
120+ '''
121 res = {}
122- tot_diff = 0.0
123- for sale in self.browse(cursor, user, ids, context=context):
124- tot_diff = 0.0
125+ for sale in self.browse(cr, uid, ids, context=context):
126+ res[sale.id] = {
127+ 'packing_total': 0.0,
128+ 'dealers_disc': 0.0,
129+ }
130+ packing_total = dealers_disc = 0.0
131 for line in sale.order_line:
132- tot_diff += line.packing_amount # Need to check if packing cost apply by qty sold?
133- res[sale.id] = tot_diff
134+ if line.lst_price:
135+ dealers_disc += (line.price_unit - line.lst_price) * line.product_uom_qty
136+ packing_total += line.packing_amount # Need to check if packing cost apply by qty sold?
137+ res[sale.id]['packing_total'] = packing_total
138+ res[sale.id]['dealers_disc'] = dealers_disc
139 return res
140+
141
142 def copy(self, cr, uid, id, default=None, context=None):
143+ """
144+ override orm copy method.
145+ cannot duplicate invoice for sale order.
146+ """
147 default = default or {}
148 default.update({
149 'invoice_id':False,
150@@ -169,8 +193,13 @@
151 return super(sale_order, self).copy(cr, uid, id, default, context=context)
152
153 def _amount_line_tax(self, cr, uid, line, context=None):
154- sale_order_line_obj = self.pool.get('sale.order.line')
155- packing_cost_allowed = sale_order_line_obj.browse(cr, uid, line.id, context=context).order_id.company_id.packing_cost
156+ '''
157+ The purpose of this function is calculate amount with tax
158+ :param line: browse the record of sale.order.line
159+ :returns: amount val
160+ :rtype: int
161+ '''
162+ packing_cost_allowed = self.pool.get('sale.order.line').browse(cr, uid, line.id, context=context).order_id.company_id.packing_cost
163 if packing_cost_allowed:
164 val = 0.0
165 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']:
166@@ -179,25 +208,25 @@
167 return super(sale_order, self)._amount_line_tax(cr, uid, line, context=context)
168
169 def _amount_all(self, cr, uid, ids, field_name, arg, context=None):
170+ '''
171+ The purpose of this function is Calculate a amount, untaxed and tax
172+ :param ids: list of sale order record ids.
173+ :returns: amount_total, amount_untaxed,amount_tax
174+ :rtype: dictionary
175+ '''
176 res = super(sale_order, self)._amount_all(cr, uid, ids, field_name, arg, context=context)
177 return res
178
179 def _get_order(self, cr, uid, ids, context=None):
180+ '''
181+ The purpose of this function to reculate amount total.
182+ :param ids: list of sale order line record ids
183+ :returns: Recalculated sale order id
184+ :rtype: int
185+ '''
186 res = super(sale_order, self.pool.get('sale.order'))._get_order(cr, uid, ids, context=context)
187 return res
188
189- def _get_difference(self, cursor, user, ids, name, arg, context=None):
190- res = {}
191- tot_diff = 0.0
192- for sale in self.browse(cursor, user, ids):
193- tot_diff = 0.0
194- for line in sale.order_line:
195- if line.lst_price:
196- tot_diff += (line.price_unit - line.lst_price) * line.product_uom_qty
197-# tot_diff = tot_diff - line.packing_amount # Need to check if packing cost apply by qty sold?
198- res[sale.id] = tot_diff
199- return res
200-
201 def _get_qty_total(self, cr, uid, ids):
202 res = {}
203 qty = 0.0
204@@ -210,7 +239,7 @@
205 _columns = {
206 'contact_id': fields.many2one('res.partner', 'Contact'),
207 'partner_shipping_id': fields.many2one('res.partner', 'Delivery Address', required=True, help="Delivery address for current sales order."),
208- 'packing_total': fields.function(_get_pack_total, type="float", string='Packing Cost', store=True),
209+ 'packing_total': fields.function(_get_pack_total, type="float", string='Packing Cost', store=True, multi='_get_pack_total'),
210 'amount_total': fields.function(_amount_all, digits_compute=dp.get_precision('Account'), string='Total',
211 store={
212 'sale.order': (lambda self, cr, uid, ids, c={}: ids, ['order_line'], 10),
213@@ -220,7 +249,7 @@
214 'quote_validity': fields.integer('Quote Validity', help="Validity of Quote in days."),
215 'subject': fields.text('Subject'),
216 'invoice_id': fields.many2one('account.invoice', 'Invoice ID'),
217- 'dealers_disc': fields.function(_get_difference, type="float", string='Dealers Discount', store=True),
218+ 'dealers_disc': fields.function(_get_pack_total, type="float", string='Dealers Discount', store=True, multi='_get_pack_total'),
219 'delivery_term': fields.integer('Delivery Term', help='Delivery Term in Weeks')
220 }
221
222@@ -228,18 +257,17 @@
223 """ create invoices for the given sales orders (ids), and open the form
224 view of one of the newly created invoices
225 """
226- mod_obj = self.pool.get('ir.model.data')
227 wf_service = netsvc.LocalService("workflow")
228
229 # create invoices through the sales orders' workflow
230 inv_ids0 = set(inv.id for sale in self.browse(cr, uid, ids, context) for inv in sale.invoice_ids)
231- for id in ids:
232- wf_service.trg_validate(uid, 'sale.order', id, 'manual_invoice', cr)
233+ for sale_order_id in ids:
234+ wf_service.trg_validate(uid, 'sale.order', sale_order_id, 'manual_invoice', cr)
235 inv_ids1 = set(inv.id for sale in self.browse(cr, uid, ids, context) for inv in sale.invoice_ids)
236 # determine newly created invoices
237 new_inv_ids = list(inv_ids1 - inv_ids0)
238 self.write(cr, uid, ids[0], {'invoice_id': new_inv_ids[0]}, context=context)
239- res = mod_obj.get_object_reference(cr, uid, 'account', 'invoice_form')
240+ res = self.pool.get('ir.model.data').get_object_reference(cr, uid, 'account', 'invoice_form')
241 res_id = res and res[1] or False,
242
243 return {
244@@ -256,21 +284,26 @@
245 }
246
247 def _prepare_invoice(self, cr, uid, order, lines, context=None):
248+ """Override method of sale order to update invoice with delivery order
249+ information.
250+ :param browse_record order: sale.order record to invoice
251+ :param list(int) line: list of invoice line IDs that must be
252+ attached to the invoice
253+ :return: dict of value to update the invoice
254+ """
255 stock_picking_obj = self.pool.get('stock.picking')
256 res = super(sale_order, self)._prepare_invoice(cr, uid, order, lines, context=context)
257 delivery_id = stock_picking_obj.search(cr, uid, [('sale_id', '=', order.id)], context=context)
258 if delivery_id:
259 delivery = stock_picking_obj.browse(cr, uid, delivery_id[0], context=context)
260- delivery_date = delivery.date_done
261- delivery_name = delivery.name
262 res.update(
263 {
264 'delivery_order_id': delivery_id[0],
265 'delivery_address_id': order.partner_shipping_id.id,
266 'date': order.date_order,
267 'carrier_id': order.carrier_id and order.carrier_id.id,
268- 'delivery_name': delivery_name or None,
269- 'delivery_date': delivery_date or False,
270+ 'delivery_name': delivery.date_done or None,
271+ 'delivery_date': delivery.name or False,
272 'sale_id': order.id
273 }
274 )
275@@ -281,14 +314,21 @@
276 _inherit = 'sale.order.line'
277
278 def _amount_line(self, cr, uid, ids, field_name, arg, context=None):
279+ '''
280+ The purpose of this function is calculate price total value.
281+ :param ids: list of order line ids
282+ :param field_name: name of price subtotal
283+ :returns: subtotal value
284+ '''
285 packing_cost_allowed = False
286 res = super(sale_order_line, self)._amount_line(cr, uid, ids, field_name, arg, context=context)
287- for id in ids:
288- packing_cost_allowed = self.browse(cr, uid, id, context=context).order_id.company_id.packing_cost
289+ for line_id in ids:
290+ packing_cost_allowed = self.browse(cr, uid, line_id, context=context).order_id.company_id.packing_cost
291 if packing_cost_allowed:
292 for sale_order_line_id in res:
293- qty = self.browse(cr, uid, sale_order_line_id, context=context).product_uom_qty
294- packing_amount = self.browse(cr, uid, sale_order_line_id, context=context).packing_amount
295+ sale_order_line_obj = self.browse(cr, uid, sale_order_line_id, context=context)
296+ qty = sale_order_line_obj.product_uom_qty
297+ packing_amount = sale_order_line_obj.packing_amount
298 res[sale_order_line_id] += qty * packing_amount
299 return res
300
301@@ -301,20 +341,25 @@
302 def product_id_change(self, cr, uid, ids, pricelist, product, qty=0,
303 uom=False, qty_uos=0, uos=False, name='', partner_id=False,
304 lang=False, update_tax=True, date_order=False, packaging=False, fiscal_position=False, flag=False, context=None):
305+ '''
306+ The purpose of this function to get value of price unit, list price, packing amount on product change.
307+ :return: return this value list price , price unit, packing amount.
308+ :rtype: dictionary
309+ '''
310 res = super(sale_order_line, self).product_id_change(cr, uid, ids, pricelist, product, qty=0,
311 uom=uom, qty_uos=qty_uos, uos=uos, name=name, partner_id=partner_id,
312 lang=lang, update_tax=update_tax, date_order=date_order, packaging=packaging, fiscal_position=fiscal_position, flag=flag, context=context)
313 context = context or {}
314 lang = lang or context.get('lang', False)
315- partner_obj = self.pool.get('res.partner')
316 product_obj = self.pool.get('product.product')
317 if product:
318- packing_cost_allowed = product_obj.browse(cr, uid, product, context=context).company_id.packing_cost
319- dealers_discount_allowed = product_obj.browse(cr, uid, product, context=context).company_id.dealers_discount
320+ product_product_obj = product_obj.browse(cr, uid, product, context=context)
321+ packing_cost_allowed = product_product_obj.company_id.packing_cost
322+ dealers_discount_allowed = product_product_obj.company_id.dealers_discount
323 # Dealer's Discount Feature
324 if dealers_discount_allowed:
325 if partner_id:
326- partner_rec = partner_obj.browse(cr, uid, partner_id, context=context)
327+ partner_rec = self.pool.get('res.partner').browse(cr, uid, partner_id, context=context)
328 if partner_rec.dealer_id:
329 res['value']['lst_price'] = res['value']['price_unit']
330 res['value']['price_unit'] = 0.0
331@@ -396,10 +441,11 @@
332 pay_term = order.partner_id.property_payment_term.id
333 else:
334 pay_term = False
335- delivery_id = stock_picking_obj.search(cr, uid, [('sale_id', '=', order.id)])
336- for id in delivery_id:
337- delivery_date = stock_picking_obj.browse(cr, uid, id, context=context).date_done
338- delivery_name = stock_picking_obj.browse(cr, uid, id, context=context).name
339+ delivery_ids = stock_picking_obj.search(cr, uid, [('sale_id', '=', order.id)])
340+ for delivery_id in delivery_ids:
341+ delivery = stock_picking_obj.browse(cr, uid, delivery_id, context=context)
342+ delivery_date = delivery.date_done
343+ delivery_name = delivery.name
344 inv = {
345 'name': order.name,
346 'origin': order.name,
347@@ -464,6 +510,14 @@
348 _inherit = "stock.picking"
349
350 def _prepare_invoice(self, cr, uid, picking, partner, inv_type, journal_id, context=None):
351+ """Override method of picking to update invoice with delivery order
352+ information.
353+ :param browse_record picking: stock.picking record to invoice
354+ :param partner: browse record of partner
355+ :param inv_type: invoice type (in or out invoice).
356+ :param journal_id: journal id
357+ :return: dict of value to update the invoice for picking
358+ """
359 res = super(stock_picking, self)._prepare_invoice(cr, uid, picking, partner, inv_type, journal_id, context=context)
360 freight_allowed = self.browse(cr, uid, picking.id, context=context).company_id.freight
361 if picking.sale_id:
362@@ -488,17 +542,18 @@
363
364 def action_invoice_create(self, cr, uid, ids, journal_id=False,
365 group=False, type='out_invoice', context=None):
366- sale_order_obj = self.pool.get('sale.order')
367-
368- for id in ids:
369- sale_id = self.browse(cr, uid, id, context=context).sale_id.id
370+ """
371+ Overrride method from picking to update invoice id to sale order.
372+ """
373+ for picking_id in ids:
374+ sale_id = self.browse(cr, uid, picking_id, context=context).sale_id.id
375
376 res = super(stock_picking, self).action_invoice_create(cr, uid, ids, journal_id=journal_id,
377 group=group, type=type, context=context)
378
379 for key in res:
380 invoice_id = res[key]
381- sale_order_obj.write(cr, uid, sale_id, {'invoice_id': invoice_id}, context=context)
382+ self.pool.get('sale.order').write(cr, uid, sale_id, {'invoice_id': invoice_id}, context=context)
383 return res
384
385
386@@ -515,8 +570,9 @@
387 res = super(stock_picking, self)._prepare_invoice_line(cr, uid, group, picking, move_line, invoice_id,
388 invoice_vals, context=context)
389
390- dealers_discount_allowed = self.browse(cr, uid, picking.id, context=context).company_id.dealers_discount
391- packing_cost_allowed = self.browse(cr, uid, picking.id, context=context).company_id.packing_cost
392+ stock_picking_obj = self.browse(cr, uid, picking.id, context=context)
393+ dealers_discount_allowed = stock_picking_obj.company_id.dealers_discount
394+ packing_cost_allowed = stock_picking_obj.company_id.packing_cost
395
396 # Dealer's Discount Feature
397 if dealers_discount_allowed:
398@@ -532,11 +588,16 @@
399 _inherit = 'account.invoice'
400
401 def _amount_all(self, cr, uid, ids, name, args, context=None):
402+ """
403+ Override function from account invoice.
404+ Purpose of this function is to add freight charge to amount total.
405+ """
406 res = super(account_invoice, self)._amount_all(cr, uid, ids, name, args, context=context)
407 for invoice_id in res:
408- freight_allowed = self.browse(cr, uid, invoice_id, context=context).company_id.freight
409+ account_invoice_obj = self.browse(cr, uid, invoice_id, context=context)
410+ freight_allowed = account_invoice_obj.company_id.freight
411 if freight_allowed:
412- freight_charge = self.browse(cr, uid, invoice_id, context=context).freight_charge
413+ freight_charge = account_invoice_obj.freight_charge
414 res[invoice_id]['amount_total'] += freight_charge
415 return res
416
417@@ -549,24 +610,29 @@
418 return res
419
420 def _get_pack_total(self, cursor, user, ids, name, arg, context=None):
421+ '''
422+ The purpose of this function is calculate packing total and dealers discount
423+ @param user: pass login user id
424+ @param ids: pass invoice id
425+ @param name: pass packing_total
426+ @param args: None
427+ @param context: pass context in 'type' : 'out_invoice', 'no_store_function': True/False, 'journal_type': 'sale'
428+ @return: return a dict in invoice_id with packing amount of invoice line.
429+ @rtype : dict
430+ '''
431 res = {}
432- tot_diff = 0.0
433 for invoice in self.browse(cursor, user, ids, context=context):
434- tot_diff = 0.0
435- for line in invoice.invoice_line:
436- tot_diff += line.packing_amount # Need to check if packing cost apply by qty sold?
437- res[invoice.id] = tot_diff
438- return res
439-
440- def _get_difference(self, cursor, user, ids, name, arg, context=None):
441- res = {}
442- tot_diff = 0.0
443- for invoice in self.browse(cursor, user, ids):
444- tot_diff = 0.0
445+ res[invoice.id] = {
446+ 'packing_total': 0.0,
447+ 'dealers_disc': 0.0,
448+ }
449+ packing_total = dealers_disc = 0.0
450 for line in invoice.invoice_line:
451 if line.lst_price:
452- tot_diff += (line.price_unit - line.lst_price) * line.quantity
453- res[invoice.id] = tot_diff
454+ dealers_disc += (line.price_unit - line.lst_price) * line.quantity
455+ packing_total += line.packing_amount # Need to check if packing cost apply by qty sold?
456+ res[invoice.id]['packing_total'] = packing_total
457+ res[invoice.id]['dealers_disc'] = dealers_disc
458 return res
459
460 def _get_qty_total(self, cr, uid, ids):
461@@ -579,6 +645,13 @@
462 return res
463
464 def amount_to_text(self, amount, currency):
465+ '''
466+ The purpose of this function is to use payment amount change in word
467+ @param amount: pass Total payment of amount
468+ @param currency: pass which currency to pay
469+ @return: return amount in word
470+ @rtype : string
471+ '''
472 amount_in_word = amount_to_text(amount)
473 if currency == 'INR':
474 amount_in_word = amount_in_word.replace("euro", "Rupees").replace("Cents", "Paise").replace("Cent", "Paise")
475@@ -599,11 +672,6 @@
476 })
477 return super(account_invoice, self).copy(cr, uid, id, default, context)
478
479- def _check_freight_allowed(self, cr, uid, ids, context=None):
480- res_company_obj = self.pool.get('res.company')
481- freight_allowed = res_company_obj.browse(cr, uid, uid, context=context).freight
482- return freight_allowed
483-
484 _columns = {
485 'delivery_order_id': fields.many2one('stock.picking', 'Delivery Order', readonly="True"),
486 'delivery_address_id': fields.many2one('res.partner', 'Delivery Address'),
487@@ -615,8 +683,8 @@
488 'dispatch_doc_no': fields.char('Dispatch Document No.', size=16),
489 'dispatch_doc_date': fields.date('Dispatch Document Date'),
490 'consignee_account': fields.char('Consignee Account', size=32, help="Account Name, applies when there is customer for consignee."),
491- 'dealers_disc': fields.function(_get_difference, type="float", string='Dealers Discount', store=True),
492- 'packing_total': fields.function(_get_pack_total, type="float", string='Packing Cost', store=True),
493+ 'dealers_disc': fields.function(_get_pack_total, type="float", string='Dealers Discount', store=True, multi='_get_pack_total'),
494+ 'packing_total': fields.function(_get_pack_total, type="float", string='Packing Cost', store=True, multi='_get_pack_total'),
495 'amount_untaxed': fields.function(_amount_all, digits_compute=dp.get_precision('Account'), string='Subtotal', track_visibility='always',
496 store={
497 'account.invoice': (lambda self, cr, uid, ids, c={}: ids, ['invoice_line'], 20),
498@@ -645,46 +713,31 @@
499 }
500
501 _defaults = {
502- 'freight_allowed': _check_freight_allowed,
503+ 'freight_allowed': lambda self, cr, uid, context: self.pool.get('res.company').browse(cr, uid, uid, context=context).freight,
504 }
505
506-# def button_reset_taxes(self, cr, uid, ids, context=None):
507-# if context is None:
508-# context = {}
509-# ctx = context.copy()
510-# ait_obj = self.pool.get('account.invoice.tax')
511-# for id in ids:
512-# cr.execute("DELETE FROM account_invoice_tax WHERE invoice_id=%s AND manual is False", (id,))
513-# partner = self.browse(cr, uid, id, context=ctx).partner_id
514-# if partner.lang:
515-# ctx.update({'lang': partner.lang})
516-# for taxe in ait_obj.compute(cr, uid, id, context=ctx).values():
517-# ait_obj.create(cr, uid, taxe)
518-# # Update the stored value (fields.function), so we write to trigger recompute
519-# self.pool.get('account.invoice').write(cr, uid, ids, {'invoice_line':[]}, context=ctx)
520-# return True
521-#
522-# def button_compute(self, cr, uid, ids, context=None, set_total=False):
523-# self.button_reset_taxes(cr, uid, ids, context)
524-# for inv in self.browse(cr, uid, ids, context=context):
525-# if set_total:
526-# self.pool.get('account.invoice').write(cr, uid, [inv.id], {'check_total': inv.amount_total})
527-# return True
528-
529 class account_invoice_line(osv.osv):
530
531 _inherit = 'account.invoice.line'
532
533 def _amount_line(self, cr, uid, ids, prop, unknow_none, unknow_dict):
534+ '''
535+ The purpose of this function to give price subtotal.
536+ :param: ids: list of invoice line record ids.
537+ :param: prop: field price subtotal
538+ :return: calculted price subtotal value.
539+ :rtype: dictionary
540+ '''
541 res = super(account_invoice_line, self)._amount_line(cr, uid, ids, prop, unknow_none, unknow_dict)
542 packing_cost_allowed = False
543- for id in ids:
544- if self.browse(cr, uid, id).invoice_id:
545- packing_cost_allowed = self.browse(cr, uid, id).invoice_id.company_id.packing_cost
546+ for invoice_line_id in ids:
547+ if self.browse(cr, uid, invoice_line_id).invoice_id:
548+ packing_cost_allowed = self.browse(cr, uid, invoice_line_id).invoice_id.company_id.packing_cost
549 if packing_cost_allowed:
550 for account_invoice_line_id in res:
551- qty = self.browse(cr, uid, account_invoice_line_id).quantity
552- packing_amount = self.browse(cr, uid, account_invoice_line_id).packing_amount
553+ account_invoice_line_obj = self.browse(cr, uid, account_invoice_line_id)
554+ qty = account_invoice_line_obj.quantity
555+ packing_amount = account_invoice_line_obj.packing_amount
556 res[account_invoice_line_id] += qty * packing_amount
557 return res
558
559@@ -695,8 +748,12 @@
560 }
561
562 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):
563+ '''
564+ The purpose of this function to get value of price unit, list price and packing amount on product value change.
565+ :return: return this value price unit, list price, packing amount
566+ :rtype: dictionary
567+ '''
568 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)
569- partner_obj = self.pool.get('res.partner')
570 product_obj = self.pool.get('product.product')
571
572 if product:
573@@ -705,7 +762,7 @@
574
575 # Dealer's Discount Feature
576 if dealers_discount_allowed:
577- partner_rec = partner_obj.browse(cr, uid, partner_id, context=context)
578+ partner_rec = self.pool.get('res.partner').browse(cr, uid, partner_id, context=context)
579 if not partner_rec.dealer_id:
580 res['value']['price_unit'] = res['value']['price_unit']
581 else:
582@@ -726,6 +783,13 @@
583 _inherit = "account.invoice.tax"
584
585 def compute(self, cr, uid, invoice_id, context=None):
586+ '''
587+ The purpose of this function calculate the total tax amount include price of product and check invoice out/in
588+ base_amount + tax_amount
589+ @param ids: pass invoice id include tax for the product
590+ @return: return tax category,total tax,product price * unit,invoice tax code,account ids etc..
591+ @rtype : dict
592+ '''
593 tax_grouped = {}
594 tax_obj = self.pool.get('account.tax')
595 cur_obj = self.pool.get('res.currency')
596@@ -784,29 +848,27 @@
597 class purchase_order(osv.osv):
598 _inherit = 'purchase.order'
599
600-# def amount_to_text(self, amount):
601-# amount_in_word = amount_to_text(amount)
602-# amount_in_word = amount_in_word.replace("euro", "Rupees").replace("Cents", "Paise").replace("Cent", "Paise")
603-# return amount_in_word
604-
605 def _amount_all(self, cr, uid, ids, field_name, arg, context=None):
606+ """
607+ override function from purchase order to add inward freigh value with amount total.
608+ return: amount total with inward freight value
609+ """
610 res = super(purchase_order, self)._amount_all(cr, uid, ids, field_name, arg, context=context)
611 for purchase_id in res:
612- freight_allowed = self.browse(cr, uid, purchase_id, context=context).company_id.freight
613+ purchase_order_obj = self.browse(cr, uid, purchase_id, context=context)
614+ freight_allowed = purchase_order_obj.company_id.freight
615 if freight_allowed:
616- inward_freight = self.browse(cr, uid, purchase_id, context=context).inward_freight
617+ inward_freight = purchase_order_obj.inward_freight
618 res[purchase_id]['amount_total'] += inward_freight
619 return res
620
621 def _get_order(self, cr, uid, ids, context=None):
622+ """
623+ The purpose of this function is to recalculate amount total based on order line
624+ """
625 res = super(purchase_order, self.pool.get('purchase.order'))._get_order(cr, uid, ids, context=context)
626 return res
627
628- def _check_freight_allowed(self, cr, uid, ids, context=None):
629- res_company = self.pool.get('res.company')
630- freight_allowed = res_company.browse(cr, uid, uid, context=context).freight
631- return freight_allowed
632-
633 _columns = {
634 'inward_freight': fields.float('Inward Freight'),
635 'freight_allowed': fields.boolean('Freight Allowed'),
636@@ -826,7 +888,7 @@
637 }
638
639 _defaults = {
640- 'freight_allowed': _check_freight_allowed,
641+ 'freight_allowed': lambda self, cr, uid, context: self.pool.get('res.company').browse(cr, uid, uid, context=context).freight,
642 }
643
644
645@@ -839,9 +901,10 @@
646 res = super(purchase_order, self).action_invoice_create(cr, uid, ids, context=context)
647 account_invoice_obj = self.pool.get('account.invoice')
648 freight_allowed = False
649- for id in ids:
650- freight_allowed = self.browse(cr, uid, id, context=context).company_id.freight
651- inward_freight = self.browse(cr, uid, id, context=context).inward_freight
652+ for purchase_order_id in ids:
653+ purchase_order_obj = self.browse(cr, uid, purchase_order_id, context=context)
654+ freight_allowed = purchase_order_obj.company_id.freight
655+ inward_freight = purchase_order_obj.inward_freight
656 if freight_allowed:
657 account_invoice_obj.write(cr, uid, res, {'freight_charge': inward_freight}, context=context)
658 account_invoice_obj.button_compute(cr, uid, [res], context=context, set_total=True)
659
660=== modified file 'l10n_in_tax_retail_invoice/report/purchase_order.py'
661--- l10n_in_tax_retail_invoice/report/purchase_order.py 2013-05-23 08:40:28 +0000
662+++ l10n_in_tax_retail_invoice/report/purchase_order.py 2013-06-20 10:57:25 +0000
663@@ -21,7 +21,7 @@
664
665 import time
666
667-from report import report_sxw
668+from openerp.report import report_sxw
669
670 class purchase_order(report_sxw.rml_parse):
671
672
673=== modified file 'l10n_in_tax_retail_invoice/report/quotation.py'
674--- l10n_in_tax_retail_invoice/report/quotation.py 2013-05-23 08:40:28 +0000
675+++ l10n_in_tax_retail_invoice/report/quotation.py 2013-06-20 10:57:25 +0000
676@@ -21,7 +21,7 @@
677
678 import time
679
680-from report import report_sxw
681+from openerp.report import report_sxw
682
683 class quotation(report_sxw.rml_parse):
684
685
686=== modified file 'l10n_in_tax_retail_invoice/report/sale_order_tax.py'
687--- l10n_in_tax_retail_invoice/report/sale_order_tax.py 2013-05-23 08:40:28 +0000
688+++ l10n_in_tax_retail_invoice/report/sale_order_tax.py 2013-06-20 10:57:25 +0000
689@@ -20,7 +20,7 @@
690 ##############################################################################
691
692 import time
693-from report import report_sxw
694+from openerp.report import report_sxw
695 from openerp.tools.translate import _
696 from openerp.osv import fields, osv
697
698
699=== modified file 'l10n_in_tax_retail_invoice/report/sale_order_tax.rml'
700--- l10n_in_tax_retail_invoice/report/sale_order_tax.rml 2013-05-23 08:40:28 +0000
701+++ l10n_in_tax_retail_invoice/report/sale_order_tax.rml 2013-06-20 10:57:25 +0000
702@@ -247,12 +247,12 @@
703 <font face="Helvetica-Bold">Sales Order</font>
704 <font color="white">..................................................................</font>
705 </para>
706- <blockTable colWidths="240.0,113.0,177.0" style="Table9">
707+ <blockTable colWidths="200.0,133.0,197.0" style="Table9">
708 <tr>
709 <td>
710 <para style="P22">Buyer (if other than consignee)</para>
711 <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>
712- <para style="P21">[[ (o.partner_id and o.partner_id.street) or '' ]] [[ (o.partner_id and o.partner_id.street2) or '']]</para>
713+ <para style="P21">[[ display_address(o.partner_id) ]]</para>
714 </td>
715 <td>
716 <para style="P10">Order No.</para>
717@@ -265,7 +265,7 @@
718 </tr>
719 <tr>
720 <td>
721- <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>
722+ <para style="P21"></para>
723 </td>
724 <td>
725 <para style="P10">Mode/Terms of Payment</para>
726@@ -277,14 +277,14 @@
727 </td>
728 </tr>
729 </blockTable>
730- <blockTable colWidths="240.0,113.0,177.0" style="Table10">
731+ <blockTable colWidths="200.0,133.0,197.0" style="Table10">
732 <tr>
733 <td>
734 <para style="P17">
735 <font face="Helvetica" size="8.0">Consignee</font>
736 </para>
737 <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>
738- <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>
739+ <para style="P21">[[ display_address(o.partner_shipping_id) ]]</para>
740 </td>
741 <td>
742 <para style="P10">Buyer's Order No.</para>
743@@ -297,7 +297,7 @@
744 </tr>
745 <tr>
746 <td>
747- <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>
748+ <para style="P21"></para>
749 </td>
750 <td>
751 <para style="P10">Dispatched through</para>
752@@ -309,7 +309,7 @@
753 </td>
754 </tr>
755 </blockTable>
756- <blockTable colWidths="240.0,290.0" style="Table11">
757+ <blockTable colWidths="200.0,330.0" style="Table11">
758 <tr>
759 <td>
760 </td>
761@@ -677,7 +677,7 @@
762 <para style="terp_default_9">
763 <font color="white"> </font>
764 </para>
765- <blockTable colWidths="334.0,197.0" style="Table8">
766+ <blockTable colWidths="334.0,205.0" style="Table8">
767 <tr>
768 <td>
769 <para style="terp_default_9">Declaration</para>
770
771=== modified file 'l10n_in_tax_retail_invoice/report/tax_invoice.py'
772--- l10n_in_tax_retail_invoice/report/tax_invoice.py 2013-05-23 08:40:28 +0000
773+++ l10n_in_tax_retail_invoice/report/tax_invoice.py 2013-06-20 10:57:25 +0000
774@@ -21,7 +21,7 @@
775
776 import time
777
778-from report import report_sxw
779+from openerp.report import report_sxw
780
781 class tax_invoice(report_sxw.rml_parse):
782
783
784=== modified file 'l10n_in_tax_retail_invoice/report/tax_invoice.rml'
785--- l10n_in_tax_retail_invoice/report/tax_invoice.rml 2013-05-23 08:40:28 +0000
786+++ l10n_in_tax_retail_invoice/report/tax_invoice.rml 2013-06-20 10:57:25 +0000
787@@ -241,12 +241,12 @@
788 <font color="white">.............................................................</font>
789 <font face="Helvetica" size="7.0">(Original)</font>
790 </para>
791- <blockTable colWidths="230.0,140.0,160.0" style="Table9">
792+ <blockTable colWidths="210.0,160.0,160.0" style="Table9">
793 <tr>
794 <td>
795 <para style="P22">Buyer (if other than consignee)</para>
796 <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>
797- <para style="P21">[[ (o.partner_id and o.partner_id.street) or '' ]] [[ (o.partner_id and o.partner_id.street2) or '']]</para>
798+ <para style="P21">[[ display_address(o.partner_id) ]]</para>
799 </td>
800 <td>
801 <para style="P10">Invoice No.</para>
802@@ -259,8 +259,6 @@
803 </tr>
804 <tr>
805 <td>
806- <para style="P21">[[ (o.partner_id and o.partner_id.village_taluka) or '' ]]</para>
807- <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>
808 </td>
809 <td>
810 <para style="P10">Delivery Note</para>
811@@ -287,14 +285,14 @@
812 </td>
813 </tr>
814 </blockTable>
815- <blockTable colWidths="230.0,140.0,160.0" style="Table10">
816+ <blockTable colWidths="210.0,160.0,160.0" style="Table10">
817 <tr>
818 <td>
819 <para style="P17">
820 <font face="Helvetica" size="8.0">Consignee</font>
821 </para>
822 <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>
823- <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>
824+ <para style="P21">[[ display_address(o.delivery_address_id) ]]</para>
825 </td>
826 <td>
827 <para style="P10">Buyer's Order No.</para>
828@@ -307,8 +305,6 @@
829 </tr>
830 <tr>
831 <td>
832- <para style="P21">[[ (o.delivery_address_id and o.delivery_address_id.village_taluka) or '' ]]</para>
833- <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>
834 </td>
835 <td>
836 <para style="P10">Dispatch Document No.</para>
837@@ -333,7 +329,7 @@
838 </td>
839 </tr>
840 </blockTable>
841- <blockTable colWidths="230.0,300.0" style="Table11">
842+ <blockTable colWidths="210.0,320.0" style="Table11">
843 <tr>
844 <td>
845 <para style="P1">
846@@ -347,7 +343,7 @@
847 </tr>
848 </blockTable>
849
850- <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') ]]
851+ <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') ]]
852 <tr>
853 <td>
854 <para style="P1">Description of Goods</para>
855@@ -398,7 +394,7 @@
856
857 <section>
858 <para style="terp_default_2">[[ repeatIn(o.invoice_line,'l') ]]</para>
859- <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') ]]
860+ <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') ]]
861 <tr>
862 <td>
863 <para style="terp_default_91">[[ l.product_id and l.product_id.categ_id.name or '']]</para>
864@@ -515,7 +511,7 @@
865
866 <section>
867 <para style="terp_default_2">[[ repeatIn(o.tax_line,'t') ]]</para>
868- <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')]]
869+ <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')]]
870 <tr>
871 <td>
872 <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>
873@@ -579,7 +575,76 @@
874 </blockTable>
875 </section>
876
877- <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') ]]
878+ <section>
879+ <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')]]
880+ <tr>
881+ <td>
882+ <para style="terp_default_10"><font face="Helvetica">Inward Freight</font></para>
883+ </td>
884+ <td>
885+ <para style="P1">
886+ <font color="white"> </font>
887+ </para>
888+ </td>
889+ <td>
890+ <para style="P1">
891+ <font color="white"> </font>
892+ </para>
893+ </td>
894+ <td>
895+ <para style="P1">
896+ <font color="white"> </font>
897+ </para>
898+ </td>
899+ <td>
900+ <para style="P1">
901+ <font color="white"> </font>
902+ </para>
903+ </td>
904+ <td>
905+ <para style="terp_default_Right_10">[[ o.currency_id.symbol ]] [[ formatLang(o.freight_charge, digits=get_digits(dp='Account')) ]]</para>
906+ </td>
907+ </tr>
908+ </blockTable>
909+
910+ <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')]]
911+ <tr>
912+ <td>
913+ <para style="terp_default_10"><font face="Helvetica">Inward Freight</font></para>
914+ </td>
915+ <td>
916+ <para style="P1">
917+ <font color="white"> </font>
918+ </para>
919+ </td>
920+ <td>
921+ <para style="P1">
922+ <font color="white"> </font>
923+ </para>
924+ </td>
925+ <td>
926+ <para style="P1">
927+ <font color="white"> </font>
928+ </para>
929+ </td>
930+ <td>
931+ <para style="P1">
932+ <font color="white"> </font>
933+ </para>
934+ </td>
935+ <td>
936+ <para style="P1">
937+ <font color="white"> </font>
938+ </para>
939+ </td>
940+ <td>
941+ <para style="terp_default_Right_10">[[ o.currency_id.symbol ]] [[ formatLang(o.freight_charge, digits=get_digits(dp='Account')) ]]</para>
942+ </td>
943+ </tr>
944+ </blockTable>
945+ </section>
946+
947+ <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') ]]
948 <tr>
949 <td>
950 <para style="terp_default_10">Dealers' Discount </para>
951@@ -640,7 +705,7 @@
952 </tr>
953 </blockTable>
954
955- <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') ]]
956+ <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') ]]
957 <tr>
958 <td>
959 <para style="terp_default_10">Total</para>
960@@ -703,7 +768,7 @@
961 <para style="terp_default_9">
962 <font color="white"> </font>
963 </para>
964- <blockTable colWidths="334.0,197.0" style="Table8">
965+ <blockTable colWidths="334.0,205.0" style="Table8">
966 <tr>
967 <td>
968 <para style="terp_default_9">Declaration</para>
969@@ -750,12 +815,12 @@
970 <font color="white">..........................................................</font>
971 <font face="Helvetica" size="7.0">(Duplicate)</font>
972 </para>
973- <blockTable colWidths="230.0,140.0,160.0" style="Table9">
974+ <blockTable colWidths="210.0,160.0,160.0" style="Table9">
975 <tr>
976 <td>
977 <para style="P22">Buyer (if other than consignee)</para>
978 <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>
979- <para style="P21">[[ (o.partner_id and o.partner_id.street) or '' ]] [[ (o.partner_id and o.partner_id.street2) or '']]</para>
980+ <para style="P21">[[ display_address(o.partner_id) ]]</para>
981 </td>
982 <td>
983 <para style="P10">Invoice No.</para>
984@@ -768,8 +833,6 @@
985 </tr>
986 <tr>
987 <td>
988- <para style="P21">[[ (o.partner_id and o.partner_id.village_taluka) or '' ]]</para>
989- <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>
990 </td>
991 <td>
992 <para style="P10">Delivery Note</para>
993@@ -796,14 +859,14 @@
994 </td>
995 </tr>
996 </blockTable>
997- <blockTable colWidths="230.0,140.0,160.0" style="Table10">
998+ <blockTable colWidths="210.0,160.0,160.0" style="Table10">
999 <tr>
1000 <td>
1001 <para style="P17">
1002 <font face="Helvetica" size="8.0">Consignee</font>
1003 </para>
1004 <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>
1005- <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>
1006+ <para style="P21">[[ display_address(o.delivery_address_id) ]]</para>
1007 </td>
1008 <td>
1009 <para style="P10">Buyer's Order No.</para>
1010@@ -816,8 +879,6 @@
1011 </tr>
1012 <tr>
1013 <td>
1014- <para style="P21">[[ (o.delivery_address_id and o.delivery_address_id.village_taluka) or '' ]]</para>
1015- <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>
1016 </td>
1017 <td>
1018 <para style="P10">Dispatch Document No.</para>
1019@@ -842,7 +903,7 @@
1020 </td>
1021 </tr>
1022 </blockTable>
1023- <blockTable colWidths="230.0,300.0" style="Table11">
1024+ <blockTable colWidths="210.0,320.0" style="Table11">
1025 <tr>
1026 <td>
1027 <para style="P1">
1028@@ -856,7 +917,7 @@
1029 </tr>
1030 </blockTable>
1031
1032- <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') ]]
1033+ <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') ]]
1034 <tr>
1035 <td>
1036 <para style="P1">Description of Goods</para>
1037@@ -907,7 +968,7 @@
1038
1039 <section>
1040 <para style="terp_default_2">[[ repeatIn(o.invoice_line,'l') ]]</para>
1041- <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') ]]
1042+ <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') ]]
1043 <tr>
1044 <td>
1045 <para style="terp_default_91">[[ l.product_id and l.product_id.categ_id.name or '']]</para>
1046@@ -1024,7 +1085,7 @@
1047
1048 <section>
1049 <para style="terp_default_2">[[ repeatIn(o.tax_line,'t') ]]</para>
1050- <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')]]
1051+ <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')]]
1052 <tr>
1053 <td>
1054 <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>
1055@@ -1087,7 +1148,76 @@
1056 </tr>
1057 </blockTable>
1058 </section>
1059- <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') ]]
1060+
1061+ <section>
1062+ <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')]]
1063+ <tr>
1064+ <td>
1065+ <para style="terp_default_10"><font face="Helvetica">Inward Freight</font></para>
1066+ </td>
1067+ <td>
1068+ <para style="P1">
1069+ <font color="white"> </font>
1070+ </para>
1071+ </td>
1072+ <td>
1073+ <para style="P1">
1074+ <font color="white"> </font>
1075+ </para>
1076+ </td>
1077+ <td>
1078+ <para style="P1">
1079+ <font color="white"> </font>
1080+ </para>
1081+ </td>
1082+ <td>
1083+ <para style="P1">
1084+ <font color="white"> </font>
1085+ </para>
1086+ </td>
1087+ <td>
1088+ <para style="terp_default_Right_10">[[ o.currency_id.symbol ]] [[ formatLang(o.freight_charge, digits=get_digits(dp='Account')) ]]</para>
1089+ </td>
1090+ </tr>
1091+ </blockTable>
1092+
1093+ <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')]]
1094+ <tr>
1095+ <td>
1096+ <para style="terp_default_10"><font face="Helvetica">Inward Freight</font></para>
1097+ </td>
1098+ <td>
1099+ <para style="P1">
1100+ <font color="white"> </font>
1101+ </para>
1102+ </td>
1103+ <td>
1104+ <para style="P1">
1105+ <font color="white"> </font>
1106+ </para>
1107+ </td>
1108+ <td>
1109+ <para style="P1">
1110+ <font color="white"> </font>
1111+ </para>
1112+ </td>
1113+ <td>
1114+ <para style="P1">
1115+ <font color="white"> </font>
1116+ </para>
1117+ </td>
1118+ <td>
1119+ <para style="P1">
1120+ <font color="white"> </font>
1121+ </para>
1122+ </td>
1123+ <td>
1124+ <para style="terp_default_Right_10">[[ o.currency_id.symbol ]] [[ formatLang(o.freight_charge, digits=get_digits(dp='Account')) ]]</para>
1125+ </td>
1126+ </tr>
1127+ </blockTable>
1128+ </section>
1129+ <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') ]]
1130 <tr>
1131 <td>
1132 <para style="terp_default_10">Dealers' Discount </para>
1133@@ -1149,7 +1279,7 @@
1134 </blockTable>
1135
1136
1137- <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') ]]
1138+ <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') ]]
1139 <tr>
1140 <td>
1141 <para style="terp_default_10">Total</para>
1142@@ -1212,7 +1342,7 @@
1143 <para style="terp_default_9">
1144 <font color="white"> </font>
1145 </para>
1146- <blockTable colWidths="334.0,197.0" style="Table8">
1147+ <blockTable colWidths="334.0,205.0" style="Table8">
1148 <tr>
1149 <td>
1150 <para style="terp_default_9">Declaration</para>
1151@@ -1259,12 +1389,12 @@
1152 <font color="white">.........................................................</font>
1153 <font face="Helvetica" size="7.0">(Triplicate)</font>
1154 </para>
1155- <blockTable colWidths="230.0,140.0,160.0" style="Table9">
1156+ <blockTable colWidths="210.0,160.0,160.0" style="Table9">
1157 <tr>
1158 <td>
1159 <para style="P22">Buyer (if other than consignee)</para>
1160 <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>
1161- <para style="P21">[[ (o.partner_id and o.partner_id.street) or '' ]] [[ (o.partner_id and o.partner_id.street2) or '']]</para>
1162+ <para style="P21">[[ display_address(o.partner_id) ]]</para>
1163 </td>
1164 <td>
1165 <para style="P10">Invoice No.</para>
1166@@ -1277,8 +1407,6 @@
1167 </tr>
1168 <tr>
1169 <td>
1170- <para style="P21">[[ (o.partner_id and o.partner_id.village_taluka) or '' ]]</para>
1171- <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>
1172 </td>
1173 <td>
1174 <para style="P10">Delivery Note</para>
1175@@ -1305,14 +1433,14 @@
1176 </td>
1177 </tr>
1178 </blockTable>
1179- <blockTable colWidths="230.0,140.0,160.0" style="Table10">
1180+ <blockTable colWidths="210.0,160.0,160.0" style="Table10">
1181 <tr>
1182 <td>
1183 <para style="P17">
1184 <font face="Helvetica" size="8.0">Consignee</font>
1185 </para>
1186 <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>
1187- <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>
1188+ <para style="P21">[[ display_address(o.delivery_address_id) ]]</para>
1189 </td>
1190 <td>
1191 <para style="P10">Buyer's Order No.</para>
1192@@ -1325,8 +1453,6 @@
1193 </tr>
1194 <tr>
1195 <td>
1196- <para style="P21">[[ (o.delivery_address_id and o.delivery_address_id.village_taluka) or '' ]]</para>
1197- <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>
1198 </td>
1199 <td>
1200 <para style="P10">Dispatch Document No.</para>
1201@@ -1351,7 +1477,7 @@
1202 </td>
1203 </tr>
1204 </blockTable>
1205- <blockTable colWidths="230.0,300.0" style="Table11">
1206+ <blockTable colWidths="210.0,320.0" style="Table11">
1207 <tr>
1208 <td>
1209 <para style="P1">
1210@@ -1365,7 +1491,7 @@
1211 </tr>
1212 </blockTable>
1213
1214- <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') ]]
1215+ <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') ]]
1216 <tr>
1217 <td>
1218 <para style="P1">Description of Goods</para>
1219@@ -1416,7 +1542,7 @@
1220
1221 <section>
1222 <para style="terp_default_2">[[ repeatIn(o.invoice_line,'l') ]]</para>
1223- <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') ]]
1224+ <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') ]]
1225 <tr>
1226 <td>
1227 <para style="terp_default_91">[[ l.product_id and l.product_id.categ_id.name or '']]</para>
1228@@ -1533,7 +1659,7 @@
1229
1230 <section>
1231 <para style="terp_default_2">[[ repeatIn(o.tax_line,'t') ]]</para>
1232- <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')]]
1233+ <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')]]
1234 <tr>
1235 <td>
1236 <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>
1237@@ -1597,7 +1723,76 @@
1238 </blockTable>
1239 </section>
1240
1241- <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') ]]
1242+ <section>
1243+ <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')]]
1244+ <tr>
1245+ <td>
1246+ <para style="terp_default_10"><font face="Helvetica">Inward Freight</font></para>
1247+ </td>
1248+ <td>
1249+ <para style="P1">
1250+ <font color="white"> </font>
1251+ </para>
1252+ </td>
1253+ <td>
1254+ <para style="P1">
1255+ <font color="white"> </font>
1256+ </para>
1257+ </td>
1258+ <td>
1259+ <para style="P1">
1260+ <font color="white"> </font>
1261+ </para>
1262+ </td>
1263+ <td>
1264+ <para style="P1">
1265+ <font color="white"> </font>
1266+ </para>
1267+ </td>
1268+ <td>
1269+ <para style="terp_default_Right_10">[[ o.currency_id.symbol ]] [[ formatLang(o.freight_charge, digits=get_digits(dp='Account')) ]]</para>
1270+ </td>
1271+ </tr>
1272+ </blockTable>
1273+
1274+ <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')]]
1275+ <tr>
1276+ <td>
1277+ <para style="terp_default_10"><font face="Helvetica">Inward Freight</font></para>
1278+ </td>
1279+ <td>
1280+ <para style="P1">
1281+ <font color="white"> </font>
1282+ </para>
1283+ </td>
1284+ <td>
1285+ <para style="P1">
1286+ <font color="white"> </font>
1287+ </para>
1288+ </td>
1289+ <td>
1290+ <para style="P1">
1291+ <font color="white"> </font>
1292+ </para>
1293+ </td>
1294+ <td>
1295+ <para style="P1">
1296+ <font color="white"> </font>
1297+ </para>
1298+ </td>
1299+ <td>
1300+ <para style="P1">
1301+ <font color="white"> </font>
1302+ </para>
1303+ </td>
1304+ <td>
1305+ <para style="terp_default_Right_10">[[ o.currency_id.symbol ]] [[ formatLang(o.freight_charge, digits=get_digits(dp='Account')) ]]</para>
1306+ </td>
1307+ </tr>
1308+ </blockTable>
1309+ </section>
1310+
1311+ <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') ]]
1312 <tr>
1313 <td>
1314 <para style="terp_default_10">Dealers' Discount </para>
1315@@ -1658,7 +1853,7 @@
1316 </tr>
1317 </blockTable>
1318
1319- <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') ]]
1320+ <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') ]]
1321 <tr>
1322 <td>
1323 <para style="terp_default_10">Total</para>
1324@@ -1721,7 +1916,7 @@
1325 <para style="terp_default_9">
1326 <font color="white"> </font>
1327 </para>
1328- <blockTable colWidths="334.0,197.0" style="Table8">
1329+ <blockTable colWidths="334.0,205.0" style="Table8">
1330 <tr>
1331 <td>
1332 <para style="terp_default_9">Declaration</para>
1333@@ -1768,12 +1963,12 @@
1334 <font color="white">........................................................</font>
1335 <font face="Helvetica" size="7.0">(Extra Copy)</font>
1336 </para>
1337- <blockTable colWidths="230.0,140.0,160.0" style="Table9">
1338+ <blockTable colWidths="210.0,160.0,160.0" style="Table9">
1339 <tr>
1340 <td>
1341 <para style="P22">Buyer (if other than consignee)</para>
1342 <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>
1343- <para style="P21">[[ (o.partner_id and o.partner_id.street) or '' ]] [[ (o.partner_id and o.partner_id.street2) or '']]</para>
1344+ <para style="P21">[[ display_address(o.partner_id) ]]</para>
1345 </td>
1346 <td>
1347 <para style="P10">Invoice No.</para>
1348@@ -1786,8 +1981,6 @@
1349 </tr>
1350 <tr>
1351 <td>
1352- <para style="P21">[[ (o.partner_id and o.partner_id.village_taluka) or '' ]]</para>
1353- <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>
1354 </td>
1355 <td>
1356 <para style="P10">Delivery Note</para>
1357@@ -1814,14 +2007,14 @@
1358 </td>
1359 </tr>
1360 </blockTable>
1361- <blockTable colWidths="230.0,140.0,160.0" style="Table10">
1362+ <blockTable colWidths="210.0,160.0,160.0" style="Table10">
1363 <tr>
1364 <td>
1365 <para style="P17">
1366 <font face="Helvetica" size="8.0">Consignee</font>
1367 </para>
1368 <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>
1369- <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>
1370+ <para style="P21">[[ display_address(o.delivery_address_id) ]]</para>
1371 </td>
1372 <td>
1373 <para style="P10">Buyer's Order No.</para>
1374@@ -1834,8 +2027,6 @@
1375 </tr>
1376 <tr>
1377 <td>
1378- <para style="P21">[[ (o.delivery_address_id and o.delivery_address_id.village_taluka) or '' ]]</para>
1379- <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>
1380 </td>
1381 <td>
1382 <para style="P10">Dispatch Document No.</para>
1383@@ -1860,7 +2051,7 @@
1384 </td>
1385 </tr>
1386 </blockTable>
1387- <blockTable colWidths="230.0,300.0" style="Table11">
1388+ <blockTable colWidths="210.0,320.0" style="Table11">
1389 <tr>
1390 <td>
1391 <para style="P1">
1392@@ -1874,7 +2065,7 @@
1393 </tr>
1394 </blockTable>
1395
1396- <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') ]]
1397+ <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') ]]
1398 <tr>
1399 <td>
1400 <para style="P1">Description of Goods</para>
1401@@ -1925,7 +2116,7 @@
1402
1403 <section>
1404 <para style="terp_default_2">[[ repeatIn(o.invoice_line,'l') ]]</para>
1405- <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') ]]
1406+ <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') ]]
1407 <tr>
1408 <td>
1409 <para style="terp_default_91">[[ l.product_id and l.product_id.categ_id.name or '']]</para>
1410@@ -2042,7 +2233,7 @@
1411
1412 <section>
1413 <para style="terp_default_2">[[ repeatIn(o.tax_line,'t') ]]</para>
1414- <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')]]
1415+ <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')]]
1416 <tr>
1417 <td>
1418 <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>
1419@@ -2106,7 +2297,76 @@
1420 </blockTable>
1421 </section>
1422
1423- <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') ]]
1424+ <section>
1425+ <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')]]
1426+ <tr>
1427+ <td>
1428+ <para style="terp_default_10"><font face="Helvetica">Inward Freight</font></para>
1429+ </td>
1430+ <td>
1431+ <para style="P1">
1432+ <font color="white"> </font>
1433+ </para>
1434+ </td>
1435+ <td>
1436+ <para style="P1">
1437+ <font color="white"> </font>
1438+ </para>
1439+ </td>
1440+ <td>
1441+ <para style="P1">
1442+ <font color="white"> </font>
1443+ </para>
1444+ </td>
1445+ <td>
1446+ <para style="P1">
1447+ <font color="white"> </font>
1448+ </para>
1449+ </td>
1450+ <td>
1451+ <para style="terp_default_Right_10">[[ o.currency_id.symbol ]] [[ formatLang(o.freight_charge, digits=get_digits(dp='Account')) ]]</para>
1452+ </td>
1453+ </tr>
1454+ </blockTable>
1455+
1456+ <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')]]
1457+ <tr>
1458+ <td>
1459+ <para style="terp_default_10"><font face="Helvetica">Inward Freight</font></para>
1460+ </td>
1461+ <td>
1462+ <para style="P1">
1463+ <font color="white"> </font>
1464+ </para>
1465+ </td>
1466+ <td>
1467+ <para style="P1">
1468+ <font color="white"> </font>
1469+ </para>
1470+ </td>
1471+ <td>
1472+ <para style="P1">
1473+ <font color="white"> </font>
1474+ </para>
1475+ </td>
1476+ <td>
1477+ <para style="P1">
1478+ <font color="white"> </font>
1479+ </para>
1480+ </td>
1481+ <td>
1482+ <para style="P1">
1483+ <font color="white"> </font>
1484+ </para>
1485+ </td>
1486+ <td>
1487+ <para style="terp_default_Right_10">[[ o.currency_id.symbol ]] [[ formatLang(o.freight_charge, digits=get_digits(dp='Account')) ]]</para>
1488+ </td>
1489+ </tr>
1490+ </blockTable>
1491+ </section>
1492+
1493+ <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') ]]
1494 <tr>
1495 <td>
1496 <para style="terp_default_10">Dealers' Discount </para>
1497@@ -2167,7 +2427,7 @@
1498 </tr>
1499 </blockTable>
1500
1501- <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') ]]
1502+ <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') ]]
1503 <tr>
1504 <td>
1505 <para style="terp_default_10">Total</para>
1506@@ -2230,7 +2490,7 @@
1507 <para style="terp_default_9">
1508 <font color="white"> </font>
1509 </para>
1510- <blockTable colWidths="334.0,197.0" style="Table8">
1511+ <blockTable colWidths="334.0,205.0" style="Table8">
1512 <tr>
1513 <td>
1514 <para style="terp_default_9">Declaration</para>
1515
1516=== modified file 'l10n_in_tax_retail_invoice/report/tax_invoice.sxw'
1517Binary 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
1518=== added directory 'l10n_in_tax_retail_invoice/test'
1519=== added file 'l10n_in_tax_retail_invoice/test/purchase_order.yml'
1520--- l10n_in_tax_retail_invoice/test/purchase_order.yml 1970-01-01 00:00:00 +0000
1521+++ l10n_in_tax_retail_invoice/test/purchase_order.yml 2013-06-20 10:57:25 +0000
1522@@ -0,0 +1,42 @@
1523+-
1524+ 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.
1525+-
1526+ !record {model: purchase.order, id: purchase_order_1}:
1527+ partner_id: base.res_partner_3
1528+ invoice_method: 'order'
1529+ inward_freight: 5.0
1530+ order_line:
1531+ - product_id: product.product_product_48
1532+ product_qty: 1.0
1533+ price_unit: 13.0
1534+-
1535+ I confirm the purchase order and supplier invoice is created.
1536+-
1537+ !workflow {model: purchase.order, ref: purchase_order_1, action: purchase_confirm}
1538+-
1539+ I select Purchase Freight and check that the untaxed Amount should be 13.0, and Total Amount should be 18.0.
1540+-
1541+ !python {model: purchase.order}: |
1542+ purchase = self.browse(cr,uid,ref('purchase_order_1'))
1543+ assert(purchase.amount_untaxed == 13.0), _('Untax Amount should be 13.0')
1544+ assert(purchase.inward_freight == 5.0), _('Inward Freight should be 5.0')
1545+ if purchase.company_id.freight:
1546+ assert(purchase.amount_total == 18.0), _('Amount should be 18.0')
1547+-
1548+ I check that supplier invoice is created or not after confirming purchase order.
1549+-
1550+ !python {model: purchase.order}: |
1551+ purchase_order_obj = self.browse(cr,uid,ref('purchase_order_1'))
1552+ invoice_id = self.pool.get('account.invoice').search(cr, uid, [('partner_id','=',purchase_order_obj.partner_id.id),('origin','=',purchase_order_obj.name)])
1553+ assert(invoice_id), _('Supplier Invoice should be created')
1554+-
1555+ In order to test PDF reports defined on invoice, we will print an tax Invoice Report.
1556+-
1557+ !python {model: account.invoice}: |
1558+ from openerp import netsvc, tools
1559+ import os
1560+ purchase_order_obj = self.pool.get('purchase.order').browse(cr,uid,ref('purchase_order_1'))
1561+ invoice_id = self.search(cr,uid,[('partner_id','=',purchase_order_obj.partner_id.id),('origin','=',purchase_order_obj.name)])
1562+ (data, format) = netsvc.LocalService('report.account.invoice.tax.excise').create(cr, uid, invoice_id, {}, {})
1563+ if tools.config['test_report_directory']:
1564+ file(os.path.join(tools.config['test_report_directory'], 'account-invoice.'+format), 'wb+').write(data)
1565
1566=== added file 'l10n_in_tax_retail_invoice/test/sale_order.yml'
1567--- l10n_in_tax_retail_invoice/test/sale_order.yml 1970-01-01 00:00:00 +0000
1568+++ l10n_in_tax_retail_invoice/test/sale_order.yml 2013-06-20 10:57:25 +0000
1569@@ -0,0 +1,69 @@
1570+-
1571+ In order to test the tax invoice reports defined on an invoice, we will create sale order with packing amount and dealers discount.
1572+ For that we have a VAT tax defined.
1573+-
1574+ !record {model: account.tax, id: tax_1}:
1575+ name: 'Vat'
1576+ tax_categ: 'vat'
1577+ amount: 0.04
1578+-
1579+ we have a Additional tax defined.
1580+-
1581+ !record {model: account.tax, id: tax_2}:
1582+ name: 'Additional'
1583+ tax_categ: 'other'
1584+ amount: 0.01
1585+-
1586+ Create one sale order for [ADPT] USB Adapter.
1587+-
1588+ !record {model: sale.order, id: sale_order_01}:
1589+ partner_id: base.res_partner_2
1590+ order_policy: 'prepaid'
1591+ order_line:
1592+ - name: USB Adapter
1593+ product_uom_qty: 1.0
1594+ price_unit: 18.0
1595+ packing_amount: 5.0
1596+ lst_price: 10.0
1597+ tax_id:
1598+ - tax_1
1599+ - tax_2
1600+-
1601+ I confirm sale order.
1602+-
1603+ !workflow {model: sale.order, action: order_confirm, ref: sale_order_01}
1604+
1605+-
1606+ I select Packing cost and check that the untaxed Amount should be 23.0, Tax should be 1.15, Total Amount is 24.15.
1607+-
1608+ !python {model: sale.order}: |
1609+ sale = self.browse(cr, uid, ref('sale_order_01'))
1610+ if sale.company_id.packing_cost:
1611+ assert(sale.amount_untaxed == 23.0), _('Untax Amount should be 23.0')
1612+ assert(sale.amount_tax == 1.15), _('Tax should be 1.15')
1613+ assert(sale.amount_total == 24.15), _('Amount should be 24.15')
1614+-
1615+ I check that the dealers discount should be 8.0.
1616+-
1617+ !python {model: sale.order}: |
1618+ sale = self.browse(cr, uid, ref('sale_order_01'))
1619+ assert(sale.dealers_disc == 8.0), _('Dealers discount should be 8.0')
1620+
1621+-
1622+ I check that customer invoice is created or not after confirming sale order.
1623+-
1624+ !python {model: sale.order}: |
1625+ sale_order_obj = self.browse(cr, uid, ref('sale_order_01'))
1626+ invoice_id = self.pool.get('account.invoice').search(cr, uid, [('partner_id','=',sale_order_obj.partner_id.id),('origin','=',sale_order_obj.name)])
1627+ assert(invoice_id), _('customer Invoice should be created')
1628+-
1629+ In order to test the PDF reports defined on an invoice, we will print an Tax Invoice Report.
1630+-
1631+ !python {model: account.invoice}: |
1632+ import netsvc, tools, os
1633+ sale_order_obj = self.pool.get('sale.order').browse(cr, uid, ref('sale_order_01'))
1634+ invoice_id = self.search(cr, uid, [('partner_id','=',sale_order_obj.partner_id.id),('origin','=',sale_order_obj.name)])
1635+ (data, format) = netsvc.LocalService('report.account.invoice.tax.excise').create(cr, uid, invoice_id, {}, {})
1636+ if tools.config['test_report_directory']:
1637+ file(os.path.join(tools.config['test_report_directory'], 'account-invoice.'+format), 'wb+').write(data)
1638+