Merge lp:~openbig/bigconsulting/new_changes_in_account_invoice_cash_discount into lp:bigconsulting

Proposed by gpa(OpenERP)
Status: Merged
Merged at revision: 24
Proposed branch: lp:~openbig/bigconsulting/new_changes_in_account_invoice_cash_discount
Merge into: lp:bigconsulting
Diff against target: 77 lines (+17/-25)
1 file modified
account_invoice_cash_discount/account_invoice_cash_discount.py (+17/-25)
To merge this branch: bzr merge lp:~openbig/bigconsulting/new_changes_in_account_invoice_cash_discount
Reviewer Review Type Date Requested Status
openbig Pending
Review via email: mp+27912@code.launchpad.net

Description of the change

changes in the calculation of discount and changes name of the variables

To post a comment you must log in.
25. By gpa(OpenERP)

remove extra lines

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'account_invoice_cash_discount/account_invoice_cash_discount.py'
2--- account_invoice_cash_discount/account_invoice_cash_discount.py 2010-08-05 13:41:54 +0000
3+++ account_invoice_cash_discount/account_invoice_cash_discount.py 2010-06-18 10:00:47 +0000
4@@ -61,8 +61,8 @@
5 tax_obj = self.pool.get('account.tax')
6 invoice = self.browse(cr, uid, ids[0], context=context)
7
8- if invoice.date_due:
9- date1 = invoice.date_due
10+ if invoice.date_invoice:
11+ date1 = invoice.date_invoice
12 else:
13 date1 = time.strftime('%Y-%m-%d')
14
15@@ -81,24 +81,16 @@
16 diff_day = (from_dt-to_dt)/(3600*24)
17 discount = 0.0
18 if payment_term:
19- pt = self.pool.get('account.payment.term').browse(cr, uid, payment_term, context=context)
20- if pt.cash_discount_ids:
21+ payment_term_lines = self.pool.get('account.payment.term').browse(cr, uid, payment_term, context=context)
22+ if payment_term_lines.cash_discount_ids:
23 res = 0.0
24 dis = 0
25- for d in pt.cash_discount_ids:
26- if diff_day > dis and diff_day <= d.delay:
27+ for discount_line in payment_term_lines.cash_discount_ids:
28+ if diff_day > dis and diff_day <= discount_line.delay:
29 if resudial_amonut:
30- res = resudial_amonut * d.discount
31- ted = 0.0
32- for line in invoice.invoice_line:
33- if line.invoice_line_tax_id:
34- tt = tax_obj.compute_inv(cr, uid, line.invoice_line_tax_id, res, line.quantity)
35- for tex in tt:
36- rr = 0.0
37- rr += tex['amount']
38- ted +=rr
39- discount = res + ted
40- dis = d.delay
41+ res = resudial_amonut * discount_line.discount
42+ discount = res
43+ dis = discount_line.delay
44 return discount
45
46 def _get_account(self, cr, uid, ids, resudial_amonut, payment_term, context=None):
47@@ -113,9 +105,9 @@
48 tax_obj = self.pool.get('account.tax')
49 invoice = self.browse(cr, uid, ids[0], context=context)
50
51- if invoice.date_due:
52- date1 = invoice.date_due
53- else:
54+ if invoice.date_invoice:
55+ date1 = invoice.date_invoice
56+ else:
57 date1 = time.strftime('%Y-%m-%d')
58
59 if 'date_p' in context and context['date_p']:
60@@ -133,12 +125,12 @@
61 diff_day = (from_dt-to_dt)/(3600*24)
62
63 if payment_term:
64- pt = self.pool.get('account.payment.term').browse(cr, uid, payment_term, context=context)
65- if pt.cash_discount_ids:
66+ payment_term_lines = self.pool.get('account.payment.term').browse(cr, uid, payment_term, context=context)
67+ if payment_term_lines.cash_discount_ids:
68 res = 0.0
69- for d in pt.cash_discount_ids:
70- if diff_day == d.delay or diff_day < d.delay:
71- account_id = d.discount_account_id.id
72+ for discount_line in payment_term_lines.cash_discount_ids:
73+ if diff_day == discount_line.delay or diff_day < discount_line.delay:
74+ account_id = discount_line.discount_account_id.id
75 return account_id
76
77 def pay_and_reconcile(self, cr, uid, ids, pay_amount, pay_account_id, period_id, pay_journal_id, writeoff_acc_id, writeoff_period_id, writeoff_journal_id, context=None, name=''):

Subscribers

People subscribed via source and target branches