Merge lp:~serpent-consulting-services/openobject-addons/trunk-885663-SerpentCS into lp:openobject-addons

Proposed by Serpent Consulting Services
Status: Merged
Merged at revision: 5627
Proposed branch: lp:~serpent-consulting-services/openobject-addons/trunk-885663-SerpentCS
Merge into: lp:openobject-addons
Diff against target: 77 lines (+19/-9)
1 file modified
hr_payroll_account/hr_payroll_account.py (+19/-9)
To merge this branch: bzr merge lp:~serpent-consulting-services/openobject-addons/trunk-885663-SerpentCS
Reviewer Review Type Date Requested Status
OpenERP Core Team Pending
Review via email: mp+81246@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Serpent Consulting Services (serpent-consulting-services) wrote :

The merge contains optimization changes as well.
Thanks.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'hr_payroll_account/hr_payroll_account.py'
2--- hr_payroll_account/hr_payroll_account.py 2011-10-11 14:03:35 +0000
3+++ hr_payroll_account/hr_payroll_account.py 2011-11-04 08:38:28 +0000
4@@ -95,7 +95,10 @@
5 partner_id = False
6 debit_account_id = line.salary_rule_id.account_debit.id
7 credit_account_id = line.salary_rule_id.account_credit.id
8- debit_line = (0, 0, {
9+
10+ if debit_account_id:
11+
12+ debit_line = (0, 0, {
13 'name': line.name,
14 'date': timenow,
15 'partner_id': partner_id,
16@@ -108,7 +111,12 @@
17 'tax_code_id': line.salary_rule_id.account_tax_id and line.salary_rule_id.account_tax_id.id or False,
18 'tax_amount': line.salary_rule_id.account_tax_id and amt or 0.0,
19 })
20- credit_line = (0, 0, {
21+ line_ids.append(debit_line)
22+ debit_sum += debit_line[2]['debit'] - debit_line[2]['credit']
23+
24+ if credit_account_id:
25+
26+ credit_line = (0, 0, {
27 'name': line.name,
28 'date': timenow,
29 'partner_id': partner_id,
30@@ -121,38 +129,40 @@
31 'tax_code_id': line.salary_rule_id.account_tax_id and line.salary_rule_id.account_tax_id.id or False,
32 'tax_amount': line.salary_rule_id.account_tax_id and amt or 0.0,
33 })
34- if debit_account_id:
35- line_ids.append(debit_line)
36- debit_sum += debit_line[2]['debit'] - debit_line[2]['credit']
37- if credit_account_id:
38 line_ids.append(credit_line)
39 credit_sum += credit_line[2]['credit'] - credit_line[2]['debit']
40
41 if debit_sum > credit_sum:
42+ acc_id = slip.journal_id.default_credit_account_id.id
43+ if not acc_id:
44+ raise osv.except_osv(_('Configuration Error!'),_('The Expense Journal "%s" has not properly configured the Credit Account!')%(slip.journal_id.name))
45 adjust_credit = (0, 0, {
46 'name': _('Adjustment Entry'),
47 'date': timenow,
48 'partner_id': partner_id,
49- 'account_id': slip.journal_id.default_credit_account_id.id,
50+ 'account_id': acc_id,
51 'journal_id': slip.journal_id.id,
52 'period_id': period_id,
53 'debit': 0.0,
54 'credit': debit_sum - credit_sum,
55 })
56 line_ids.append(adjust_credit)
57+
58 elif debit_sum < credit_sum:
59+ acc_id = slip.journal_id.default_debit_account_id.id
60+ if not acc_id:
61+ raise osv.except_osv(_('Configuration Error!'),_('The Expense Journal "%s" has not properly configured the Debit Account!')%(slip.journal_id.name))
62 adjust_debit = (0, 0, {
63 'name': _('Adjustment Entry'),
64 'date': timenow,
65 'partner_id': partner_id,
66- 'account_id': slip.journal_id.default_debit_account_id.id,
67+ 'account_id': acc_id,
68 'journal_id': slip.journal_id.id,
69 'period_id': period_id,
70 'debit': credit_sum - debit_sum,
71 'credit': 0.0,
72 })
73 line_ids.append(adjust_debit)
74-
75 move.update({'line_id': line_ids})
76 move_id = move_pool.create(cr, uid, move, context=context)
77 self.write(cr, uid, [slip.id], {'move_id': move_id}, context=context)

Subscribers

People subscribed via source and target branches

to all changes: