Merge lp:~openerp-dev/openobject-addons/trunk-bug-891532-bde into lp:openobject-addons

Proposed by Bharat Devnani (Open ERP)
Status: Merged
Merged at revision: 5743
Proposed branch: lp:~openerp-dev/openobject-addons/trunk-bug-891532-bde
Merge into: lp:openobject-addons
Diff against target: 54 lines (+15/-6)
1 file modified
hr_payroll_account/hr_payroll_account.py (+15/-6)
To merge this branch: bzr merge lp:~openerp-dev/openobject-addons/trunk-bug-891532-bde
Reviewer Review Type Date Requested Status
OpenERP Core Team Pending
Review via email: mp+82528@code.launchpad.net

Description of the change

Hello Sir,

I have made copy method in hr_payroll_account/hr_payroll_account.py inorder to make move_id field false when the payslip is duplicated.

Thanks & Regards,
Devnani Bharat R.

To post a comment you must log in.

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-11-11 21:11:27 +0000
3+++ hr_payroll_account/hr_payroll_account.py 2011-11-17 13:04:58 +0000
4@@ -39,7 +39,16 @@
5 'journal_id': fields.many2one('account.journal', 'Expense Journal',states={'draft': [('readonly', False)]}, readonly=True, required=True),
6 'move_id': fields.many2one('account.move', 'Accounting Entry', readonly=True),
7 }
8-
9+
10+ def copy(self, cr, uid, id, default=None, context=None):
11+ if default is None:
12+ default = {}
13+ default = default.copy()
14+ default.update({
15+ 'move_id': False
16+ })
17+ return super(hr_payslip, self).copy(cr, uid, id, default, context=context)
18+
19 def create(self, cr, uid, vals, context=None):
20 if context is None:
21 context = {}
22@@ -95,9 +104,9 @@
23 partner_id = False
24 debit_account_id = line.salary_rule_id.account_debit.id
25 credit_account_id = line.salary_rule_id.account_credit.id
26-
27+
28 if debit_account_id:
29-
30+
31 debit_line = (0, 0, {
32 'name': line.name,
33 'date': timenow,
34@@ -113,9 +122,9 @@
35 })
36 line_ids.append(debit_line)
37 debit_sum += debit_line[2]['debit'] - debit_line[2]['credit']
38-
39+
40 if credit_account_id:
41-
42+
43 credit_line = (0, 0, {
44 'name': line.name,
45 'date': timenow,
46@@ -147,7 +156,7 @@
47 'credit': debit_sum - credit_sum,
48 })
49 line_ids.append(adjust_credit)
50-
51+
52 elif debit_sum < credit_sum:
53 acc_id = slip.journal_id.default_debit_account_id.id
54 if not acc_id:

Subscribers

People subscribed via source and target branches

to all changes: