[MERGE]merge with project branch

bzr revid: kbh@tinyerp.com-20120615071522-ieb77ejkmdv4b15x
This commit is contained in:
Khushboo Bhatt (Open ERP) 2012-06-15 12:45:22 +05:30
commit a0aacb805a
5 changed files with 36 additions and 17 deletions

View File

@ -49,6 +49,7 @@ Indian Payroll Rules.
'l10n_in_hr_payroll_data.xml',
'data/hr.salary.rule.csv',
'l10n_in_hr_payroll_report.xml',
'l10n_in_hr_payroll_sequence.xml'
],
'demo_xml': ['l10n_in_hr_payroll_demo.xml'],
'installable': True

View File

@ -104,16 +104,16 @@ class payroll_advice(osv.osv):
_columns = {
'name':fields.char('Name', size=32, readonly=True, required=True, states={'draft': [('readonly', False)]},),
'note': fields.text('Description'),
'date': fields.date('Date', states={'draft': [('readonly', False)]},),
'date': fields.date('Date', readonly=True, states={'draft': [('readonly', False)]}, help="Date is used to search Payslips."),
'state':fields.selection([
('draft','Draft Sheet'),
('confirm','Confirm Sheet'),
('draft','Draft'),
('confirm','Confirm'),
('cancel','Cancelled'),
],'State', select=True, readonly=True),
'number':fields.char('Number', size=16, readonly=True),
'line_ids':fields.one2many('hr.payroll.advice.line', 'advice_id', 'Employee Salary', states={'draft': [('readonly', False)]}),
'line_ids':fields.one2many('hr.payroll.advice.line', 'advice_id', 'Employee Salary', states={'draft': [('readonly', False)]}, readonly=True),
'chaque_nos':fields.char('Chaque Nos', size=256),
'company_id':fields.many2one('res.company', 'Company',required=True, states={'draft': [('readonly', False)]}),
'company_id':fields.many2one('res.company', 'Company', required=True, readonly=True, states={'draft': [('readonly', False)]}),
'bank_id':fields.many2one('res.bank', 'Bank', readonly=True, states={'draft': [('readonly', False)]}, help="Select the Bank Address from whcih the salary is going to be paid"),
}
@ -123,6 +123,8 @@ class payroll_advice(osv.osv):
'company_id': lambda self, cr, uid, context: \
self.pool.get('res.users').browse(cr, uid, uid,
context=context).company_id.id,
'note': "Please make the payroll transfer from above account number to the below mentioned account numbers towards employee salaries:"
}
def compute_advice(self, cr, uid, ids, context=None):
@ -135,10 +137,10 @@ class payroll_advice(osv.osv):
if old_line_ids:
advice_line_pool.unlink(cr, uid, old_line_ids, context=context)
slip_ids = payslip_pool.search(cr, uid, [('date_from','<=',advice.date), ('date_to','>=',advice.date)], context=context)
if not slip_ids:
advice_date = datetime.strptime(advice.date,DATETIME_FORMAT)
a_date = advice_date.strftime('%B')+'-'+advice_date.strftime('%Y')
raise osv.except_osv(_('Error !'), _('No Payslips for found for %s Month') % (a_date))
# if not slip_ids:
# advice_date = datetime.strptime(advice.date,DATETIME_FORMAT)
# a_date = advice_date.strftime('%B')+'-'+advice_date.strftime('%Y')
# raise osv.except_osv(_('Error !'), _('No Payslips for found for %s Month') % (a_date))
for slip in payslip_pool.browse(cr, uid, slip_ids, context=context):
if not slip.employee_id.bank_account_id:
raise osv.except_osv(_('Error !'), _('Please define bank account for the %s employee') % (slip.employee_id.name))
@ -155,7 +157,11 @@ class payroll_advice(osv.osv):
return True
def confirm_sheet(self, cr, uid, ids, context=None):
return self.write(cr, uid, ids, {'state':'confirm'}, context=context)
for advice in self.browse(cr, uid, ids, context=context):
if not advice.line_ids:
raise osv.except_osv(_('Error !'), _('You can not confirm Payment advice without advice lines.'))
number = self.pool.get('ir.sequence').get(cr, uid, 'payment.advice')
return self.write(cr, uid, ids, {'number':number, 'state':'confirm'}, context=context)
def set_to_draft(self, cr, uid, ids, context=None):
return self.write(cr, uid, ids, {'state':'draft'}, context=context)
@ -186,7 +192,7 @@ class payroll_advice_line(osv.osv):
'name':fields.char('Bank Account No.', size=32, required=True),
'employee_id':fields.many2one('hr.employee', 'Employee', required=True),
'bysal': fields.float('By Salary', digits_compute=dp.get_precision('Payroll')),
'company_id': fields.related('advice_id','company_id', type='many2one', required=True,relation='res.company', string='Company'),
'company_id': fields.related('advice_id', 'company_id', type='many2one', required=True, relation='res.company', string='Company'),
}
payroll_advice_line()

View File

@ -0,0 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data noupdate="1">
<record id="seq_type_payment_advice" model="ir.sequence.type">
<field name="name">Payment Advice</field>
<field name="code">payment.advice</field>
</record>
<record id="seq_payment_advice" model="ir.sequence">
<field name="name">Payment Advice</field>
<field name="code">payment.advice</field>
<field name="prefix">PAY/%(month)s/%(year)s/</field>
<field name="padding">3</field>
</record>
</data>
</openerp>

View File

@ -61,10 +61,6 @@
<field name="company_id" groups="base.group_multi_company" widget="selection"/>
<field name="bank_id" select="1"/>
<field name="state"/>
<button name="compute_advice" string="Compute Advice" icon="terp-document-new" states="draft" type="object"/>
<button name="cancel_sheet" string="Cancel Sheet" states="draft" icon="gtk-cancel" type="object"/>
<button name="confirm_sheet" icon="gtk-apply" string="Confirm Sheet" states="draft" type="object"/>
<button name="set_to_draft" string="Set to Draft" icon="gtk-convert" states="cancel,confirm" type="object"/>
</tree>
</field>
</record>
@ -105,7 +101,7 @@
<field name="company_id" on_change="onchange_company_id(company_id)" groups="base.group_multi_company" widget="selection"/>
<field name="chaque_nos"/>
</group>
<separator colspan="4" string="Information"/>
<separator colspan="4" string="Letter Details"/>
<field name="note" colspan="4" nolabel="1"/>
</page>
</notebook>

View File

@ -1,2 +1,3 @@
"id","name","model_id:id","group_id:id","perm_read","perm_write","perm_create","perm_unlink"
"access_hr_salary_rule","hr.salary.rule","model_hr_salary_rule","base.group_hr_user",1,1,1,1
"access_hr_payroll_advice","hr.payroll.advice","model_hr_payroll_advice","base.group_hr_manager",1,1,1,1
"access_hr_payroll_advice_line","hr.payroll.advice.line","model_hr_payroll_advice_line","base.group_hr_manager",1,1,1,1

1 id name model_id:id group_id:id perm_read perm_write perm_create perm_unlink
2 access_hr_salary_rule access_hr_payroll_advice hr.salary.rule hr.payroll.advice model_hr_salary_rule model_hr_payroll_advice base.group_hr_user base.group_hr_manager 1 1 1 1
3 access_hr_payroll_advice_line hr.payroll.advice.line model_hr_payroll_advice_line base.group_hr_manager 1 1 1 1