summaryrefslogtreecommitdiff
path: root/addons
diff options
context:
space:
mode:
authorBharat (OpenERP) <bde@tinyerp.com>2011-11-17 18:18:11 +0530
committerBharat (OpenERP) <bde@tinyerp.com>2011-11-17 18:18:11 +0530
commit0037710e5d58e4be7ecfdf0f90f2b8cb4645c7ca (patch)
treeb286d964d6890553ae467ea01b553335cb48f361 /addons
parent03ef4eb14c354ab6c7ab4fd843a66ddede44b17e (diff)
[FIX] hr : Made copy method in hr_payroll_account/hr_payroll_account.py inorder to make move_id field false when the payslip is duplicated
lp bug: https://launchpad.net/bugs/891532 fixed bzr revid: bde@tinyerp.com-20111117124811-i162so6m6shc0054
Diffstat (limited to 'addons')
-rw-r--r--addons/hr_payroll_account/hr_payroll_account.py21
1 files changed, 15 insertions, 6 deletions
diff --git a/addons/hr_payroll_account/hr_payroll_account.py b/addons/hr_payroll_account/hr_payroll_account.py
index 684289c9737..af9019dc062 100644
--- a/addons/hr_payroll_account/hr_payroll_account.py
+++ b/addons/hr_payroll_account/hr_payroll_account.py
@@ -39,7 +39,16 @@ class hr_payslip(osv.osv):
'journal_id': fields.many2one('account.journal', 'Expense Journal',states={'draft': [('readonly', False)]}, readonly=True, required=True),
'move_id': fields.many2one('account.move', 'Accounting Entry', readonly=True),
}
-
+
+ def copy(self, cr, uid, id, default=None, context=None):
+ if default is None:
+ default = {}
+ default = default.copy()
+ default.update({
+ 'move_id': False
+ })
+ return super(hr_payslip, self).copy(cr, uid, id, default, context=context)
+
def create(self, cr, uid, vals, context=None):
if context is None:
context = {}
@@ -95,9 +104,9 @@ class hr_payslip(osv.osv):
partner_id = False
debit_account_id = line.salary_rule_id.account_debit.id
credit_account_id = line.salary_rule_id.account_credit.id
-
+
if debit_account_id:
-
+
debit_line = (0, 0, {
'name': line.name,
'date': timenow,
@@ -113,9 +122,9 @@ class hr_payslip(osv.osv):
})
line_ids.append(debit_line)
debit_sum += debit_line[2]['debit'] - debit_line[2]['credit']
-
+
if credit_account_id:
-
+
credit_line = (0, 0, {
'name': line.name,
'date': timenow,
@@ -147,7 +156,7 @@ class hr_payslip(osv.osv):
'credit': debit_sum - credit_sum,
})
line_ids.append(adjust_credit)
-
+
elif debit_sum < credit_sum:
acc_id = slip.journal_id.default_debit_account_id.id
if not acc_id: