[IMP] Payroll_account: improved views, on the other state of draft make fields on payslip to readonly=true

bzr revid: mra@mra-laptop-20110421072256-la7412gwr7osf0hj
This commit is contained in:
Mustufa Rangwala
2011-04-21 12:52:56 +05:30
parent 005d73a5e5
commit 60ad4cdfe6
3 changed files with 9 additions and 8 deletions
+1 -1
View File
@@ -226,7 +226,7 @@ class hr_payslip(osv.osv):
return result
_columns = {
'struct_id': fields.many2one('hr.payroll.structure', 'Structure', help='Defines the rules that have to be applied to this payslip, accordingly to the contract chosen. If you let empty the field contract, this field isn\'t mandatory anymore and thus the rules applied will be all the rules set on the structure of all contracts of the employee valid for the chosen period'),
'struct_id': fields.many2one('hr.payroll.structure', 'Structure', readonly=True, states={'draft': [('readonly', False)]},help='Defines the rules that have to be applied to this payslip, accordingly to the contract chosen. If you let empty the field contract, this field isn\'t mandatory anymore and thus the rules applied will be all the rules set on the structure of all contracts of the employee valid for the chosen period'),
'name': fields.char('Description', size=64, required=False, readonly=True, states={'draft': [('readonly', False)]}),
'number': fields.char('Reference', size=64, required=False, readonly=True, states={'draft': [('readonly', False)]}),
'employee_id': fields.many2one('hr.employee', 'Employee', required=True, readonly=True, states={'draft': [('readonly', False)]}),
@@ -213,15 +213,15 @@ class hr_payslip(osv.osv):
_description = 'Pay Slip'
_columns = {
'journal_id': fields.many2one('account.journal', 'Expense Journal'),
'bank_journal_id': fields.many2one('account.journal', 'Bank Journal'),
'journal_id': fields.many2one('account.journal', 'Expense Journal',states={'draft': [('readonly', False)]}, readonly=True),
'bank_journal_id': fields.many2one('account.journal', 'Bank Journal', states={'draft': [('readonly', False)]}, readonly=True),
'move_ids':fields.one2many('hr.payslip.account.move', 'slip_id', 'Accounting vouchers'),
'move_line_ids':fields.many2many('account.move.line', 'payslip_lines_rel', 'slip_id', 'line_id', 'Accounting Lines', readonly=True),
'move_payment_ids':fields.many2many('account.move.line', 'payslip_payment_rel', 'slip_id', 'payment_id', 'Payment Lines', readonly=True),
'period_id': fields.many2one('account.period', 'Force Period', domain=[('state','<>','done')], help="Keep empty to use the period of the validation(Payslip) date."),
'period_id': fields.many2one('account.period', 'Force Period',states={'draft': [('readonly', False)]}, readonly=True, domain=[('state','<>','done')], help="Keep empty to use the period of the validation(Payslip) date."),
'account_move_ids': fields.many2many('account.move', 'payslip_move_rel', 'slip_id', 'move_id', 'Accounting Entries', readonly=True),
}
def onchange_contract_id(self, cr, uid, ids, date_from, date_to, employee_id=False, contract_id=False, context=None):
contract_obj = self.pool.get('hr.contract')
res = super(hr_payslip, self).onchange_contract_id(cr, uid, ids, date_from=date_from, date_to=date_to, employee_id=employee_id, contract_id=contract_id, context=context)
@@ -49,6 +49,7 @@
<field name="date_to" position="after">
<field name="journal_id" required="1"/>
<field name="bank_journal_id" domain="[('type','=','cash')]" required="1"/>
<field name="period_id" />
</field>
</field>
</record>
@@ -152,12 +153,12 @@
<page string="Account Lines">
<field name="move_line_ids" colspan="4" nolabel="1"/>
</page>
<page string="Accounting Entries">
<field name="account_move_ids" colspan="4" nolabel="1"/>
</page>
<page string="Payment Lines">
<field name="move_payment_ids" colspan="4" nolabel="1"/>
</page>
<page string="Accounting Entries">
<field name="account_move_ids" colspan="4" nolabel="1"/>
</page>
</xpath>
</field>
</record>