diff options
| author | Mustufa Rangwala <mra@mra-laptop> | 2011-04-21 12:52:56 +0530 |
|---|---|---|
| committer | Mustufa Rangwala <mra@mra-laptop> | 2011-04-21 12:52:56 +0530 |
| commit | 60ad4cdfe6f18419116c8b479eada9f91c19604f (patch) | |
| tree | a7f68e13535efebade74025b761c0507d67e3a34 | |
| parent | 005d73a5e57d9e60395be2f5b460d9c3634d68a4 (diff) | |
[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
| -rw-r--r-- | addons/hr_payroll/hr_payroll.py | 2 | ||||
| -rw-r--r-- | addons/hr_payroll_account/hr_payroll_account.py | 8 | ||||
| -rw-r--r-- | addons/hr_payroll_account/hr_payroll_account_view.xml | 7 |
3 files changed, 9 insertions, 8 deletions
diff --git a/addons/hr_payroll/hr_payroll.py b/addons/hr_payroll/hr_payroll.py index 45826254df5..9b20e048bcf 100644 --- a/addons/hr_payroll/hr_payroll.py +++ b/addons/hr_payroll/hr_payroll.py @@ -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)]}), diff --git a/addons/hr_payroll_account/hr_payroll_account.py b/addons/hr_payroll_account/hr_payroll_account.py index 231a8b8d837..af7a911bf31 100644 --- a/addons/hr_payroll_account/hr_payroll_account.py +++ b/addons/hr_payroll_account/hr_payroll_account.py @@ -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) diff --git a/addons/hr_payroll_account/hr_payroll_account_view.xml b/addons/hr_payroll_account/hr_payroll_account_view.xml index 8ff199fb466..94af7526192 100644 --- a/addons/hr_payroll_account/hr_payroll_account_view.xml +++ b/addons/hr_payroll_account/hr_payroll_account_view.xml @@ -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> |
