From 298119b0d339ad77c6a67dda394384c6e30b8547 Mon Sep 17 00:00:00 2001 From: "Khushboo Bhatt (Open ERP)" Date: Thu, 16 Aug 2012 18:14:07 +0530 Subject: [PATCH] [FIX]error of journal_id fixed and bank record added in yml bzr revid: kbh@tinyerp.com-20120816124407-z0i24fk26k0jltlk --- .../hr_payroll_account/hr_payroll_account.py | 11 +++++++ .../test/payment_advice_batch.yml | 30 +++++++++++++++++-- 2 files changed, 38 insertions(+), 3 deletions(-) diff --git a/addons/hr_payroll_account/hr_payroll_account.py b/addons/hr_payroll_account/hr_payroll_account.py index 71621874066..4dbd31c6550 100644 --- a/addons/hr_payroll_account/hr_payroll_account.py +++ b/addons/hr_payroll_account/hr_payroll_account.py @@ -218,6 +218,17 @@ class hr_payslip_run(osv.osv): 'journal_id': fields.many2one('account.journal', 'Expense Journal', states={'draft': [('readonly', False)]}, readonly=True, required=True), } + def _get_default_journal(self, cr, uid, context=None): + model_data = self.pool.get('ir.model.data') + res = model_data.search(cr, uid, [('name', '=', 'expenses_journal')]) + if res: + return model_data.browse(cr, uid, res[0]).res_id + return False + + _defaults = { + 'journal_id': _get_default_journal, + } + hr_payslip_run() # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/addons/l10n_in_hr_payroll/test/payment_advice_batch.yml b/addons/l10n_in_hr_payroll/test/payment_advice_batch.yml index 8193161478b..e470d81753f 100644 --- a/addons/l10n_in_hr_payroll/test/payment_advice_batch.yml +++ b/addons/l10n_in_hr_payroll/test/payment_advice_batch.yml @@ -1,5 +1,29 @@ - In order to test Payment Advice creation from Payslip Bacth I create New Payslip Batch +- + I Create a bank record +- + !record {model: res.partner.bank, id: res_partner_bank_0}: + acc_number: '23457685' + partner_id: base.res_partner_21 + sequence: 0.0 + name: Fortis + state: bank + bank: base.res_bank_1 +- + I create a new employee “Edwin” +- + !record {model: hr.employee, id: hr_employee_edwin0}: + address_home_id: base.res_partner_address_2 + address_id: base.res_partner_address_9 + birthday: '1984-05-01' + children: 0.0 + country_id: base.in + department_id: hr.dep_rd + gender: male + name: Edwin + bank_account_id: res_partner_bank_0 + vehicle_distance: 0.0 - I want to generate a payslip from Payslip Batch. - @@ -10,9 +34,9 @@ - !record {model: hr.payslip.employees, id: hr_payslip_employees}: employee_ids: - - hr.employee_qdp + - hr_employee_edwin0 - - I generate the payslip by clicking on Generat button wizard. + I generate the payslip by clicking on Generate button wizard. - !python {model: hr.payslip.employees}: | self.compute_sheet(cr, uid, [ref('hr_payslip_employees')], context={'active_id': ref('hr_payslip_run_forAdvice')}) @@ -33,7 +57,7 @@ batch = self.browse(cr, uid, ref("hr_payslip_run_forAdvice")) assert (batch.state == 'close') - - I Create Advice from Payslip Batch using Create Advice button + I create Advice from Payslip Batch using Create Advice button - !python {model: hr.payslip.run}: | self.create_advice(cr, uid, [ref('hr_payslip_run_forAdvice')])