Merge lp:~openerp-dev/openobject-addons/trunk-payroll-account-mtr into lp:~openerp-dev/openobject-addons/trunk-payroll

Proposed by Meera Trambadia (OpenERP)
Status: Superseded
Proposed branch: lp:~openerp-dev/openobject-addons/trunk-payroll-account-mtr
Merge into: lp:~openerp-dev/openobject-addons/trunk-payroll
Diff against target: 1281 lines (+452/-373) (has conflicts)
5 files modified
hr_payroll/hr_payroll.py (+7/-1)
hr_payroll_account/__openerp__.py (+1/-1)
hr_payroll_account/hr_payroll_account.py (+312/-226)
hr_payroll_account/hr_payroll_account_demo.xml (+50/-25)
hr_payroll_account/hr_payroll_account_view.xml (+82/-120)
Text conflict in hr_payroll/hr_payroll.py
To merge this branch: bzr merge lp:~openerp-dev/openobject-addons/trunk-payroll-account-mtr
Reviewer Review Type Date Requested Status
Mustufa Rangwala (Open ERP) Needs Fixing
qdp (OpenERP) Pending
Review via email: mp+60723@code.launchpad.net

This proposal has been superseded by a proposal from 2011-05-12.

Description of the change

The following improvements has been made in hr_payroll_account:-
-> employee's contract: analytic account. + journal (with onchange on the journal of payslip)
-> contribution register: add a account.journal and an analytic account
-> salary rule: account.accoutns (for the debit and credit side) and account.analytic.account and an accuont.tax.code
-> payslip: accuont.period and account.move (m2m)
-> account.journal on the payslip (if account.Account empty in the salary rule use the default ones of it)
-> changed domain and ir.property to make account type=payable for employee account
-> improved code to create Accounting Entries

To post a comment you must log in.
Revision history for this message
Mustufa Rangwala (Open ERP) (mra-tinyerp) wrote :

I can not create new payslip.

File "/home/mra/rdtools/server/trunk/openerp/osv/orm.py", line 1453, in raise_view_error
    'model': self._name, })
AttributeError: View definition error for inherited view 'hr_payroll_account.view_hr_payslip_form_inherit_1' on 'hr.payslip' model: Element '<xpath expr="/form/notebook/page[@string='Salary Computation']/field[@name='line_ids']/form/group/field[@name='company_contrib']">' not found in parent view 'hr_payroll.view_hr_payslip_form'

review: Needs Fixing
Revision history for this message
Mustufa Rangwala (Open ERP) (mra-tinyerp) wrote :

fix this:

1. if line.name == 'Net' or line.name == 'Gross' or line.name == 'Basic': => use line.code instead of line.name
2. line.category_id.name => use line.category_id.code every where.

thanks,
mra

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'hr_payroll/hr_payroll.py'
2--- hr_payroll/hr_payroll.py 2011-05-12 07:49:18 +0000
3+++ hr_payroll/hr_payroll.py 2011-05-12 08:43:31 +0000
4@@ -248,7 +248,11 @@
5 return result
6
7 _columns = {
8+<<<<<<< TREE
9 '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'),
10+=======
11+ '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'),
12+>>>>>>> MERGE-SOURCE
13 'name': fields.char('Description', size=64, required=False, readonly=True, states={'draft': [('readonly', False)]}),
14 'number': fields.char('Reference', size=64, required=False, readonly=True, states={'draft': [('readonly', False)]}),
15 'employee_id': fields.many2one('hr.employee', 'Employee', required=True, readonly=True, states={'draft': [('readonly', False)]}),
16@@ -423,7 +427,9 @@
17
18 def compute_sheet(self, cr, uid, ids, context=None):
19 slip_line_pool = self.pool.get('hr.payslip.line')
20+ sequence_obj = self.pool.get('ir.sequence')
21 for payslip in self.browse(cr, uid, ids, context=context):
22+ number = sequence_obj.get(cr, uid, 'salary.slip')
23 #delete old payslip lines
24 old_slipline_ids = slip_line_pool.search(cr, uid, [('slip_id', '=', payslip.id)], context=context)
25 # old_slipline_ids
26@@ -436,7 +442,7 @@
27 #if we don't give the contract, then the rules to apply should be for all current contracts of the employee
28 contract_ids = self.get_contract(cr, uid, payslip.employee_id, payslip.date_from, payslip.date_to, context=context)
29 lines = [(0,0,line) for line in self.pool.get('hr.payslip').get_payslip_lines(cr, uid, contract_ids, payslip.id, context=context)]
30- self.write(cr, uid, [payslip.id], {'line_ids': lines}, context=context)
31+ self.write(cr, uid, [payslip.id], {'line_ids': lines, 'number': number,}, context=context)
32 return True
33
34 def get_worked_day_lines(self, cr, uid, contract_ids, date_from, date_to, context=None):
35
36=== modified file 'hr_payroll_account/__openerp__.py'
37--- hr_payroll_account/__openerp__.py 2011-03-18 14:06:18 +0000
38+++ hr_payroll_account/__openerp__.py 2011-05-12 08:43:31 +0000
39@@ -46,7 +46,7 @@
40 "hr_payroll_account_view.xml",
41 ],
42 'demo_xml': [
43- 'hr_payroll_demo.xml'
44+ 'hr_payroll_account_demo.xml'
45 ],
46 'installable': True,
47 'active': False,
48
49=== modified file 'hr_payroll_account/hr_payroll_account.py'
50--- hr_payroll_account/hr_payroll_account.py 2011-03-02 10:44:41 +0000
51+++ hr_payroll_account/hr_payroll_account.py 2011-05-12 08:43:31 +0000
52@@ -27,17 +27,17 @@
53 from tools import config
54 from tools.translate import _
55
56-def prev_bounds(cdate=False):
57- when = date.fromtimestamp(time.mktime(time.strptime(cdate,"%Y-%m-%d")))
58- this_first = date(when.year, when.month, 1)
59- month = when.month + 1
60- year = when.year
61- if month > 12:
62- month = 1
63- year += 1
64- next_month = date(year, month, 1)
65- prev_end = next_month - timedelta(days=1)
66- return this_first, prev_end
67+#def prev_bounds(cdate=False):
68+# when = date.fromtimestamp(time.mktime(time.strptime(cdate,"%Y-%m-%d")))
69+# this_first = date(when.year, when.month, 1)
70+# month = when.month + 1
71+# year = when.year
72+# if month > 12:
73+# month = 1
74+# year += 1
75+# next_month = date(year, month, 1)
76+# prev_end = next_month - timedelta(days=1)
77+# return this_first, prev_end
78
79 class hr_payroll_structure(osv.osv):
80 _inherit = 'hr.payroll.structure'
81@@ -80,7 +80,7 @@
82 relation='account.account',
83 string="Employee Account",
84 method=True,
85- domain="[('type', '=', 'other')]",
86+ domain="[('type', '=', 'payable')]",
87 view_load=True,
88 help="Employee Payable Account"),
89 'analytic_account':fields.property(
90@@ -94,90 +94,90 @@
91 }
92 hr_employee()
93
94-class payroll_register(osv.osv):
95- _inherit = 'hr.payroll.register'
96- _description = 'Payroll Register'
97-
98- _columns = {
99- 'journal_id': fields.many2one('account.journal', 'Expense Journal'),
100- 'bank_journal_id': fields.many2one('account.journal', 'Bank Journal'),
101- 'period_id': fields.many2one('account.period', 'Force Period', domain=[('state','<>','done')], help="Keep empty to use the period of the validation(Payslip) date."),
102- }
103-
104- def compute_sheet(self, cr, uid, ids, context=None):
105- emp_pool = self.pool.get('hr.employee')
106- slip_pool = self.pool.get('hr.payslip')
107- func_pool = self.pool.get('hr.payroll.structure')
108- slip_line_pool = self.pool.get('hr.payslip.line')
109- wf_service = netsvc.LocalService("workflow")
110- vals = self.browse(cr, uid, ids, context=context)[0]
111- emp_ids = emp_pool.search(cr, uid, [])
112-
113- for emp in emp_pool.browse(cr, uid, emp_ids, context=context):
114- old_slips = slip_pool.search(cr, uid, [('employee_id','=', emp.id), ('date','=',vals.date)])
115- if old_slips:
116- slip_pool.write(cr, uid, old_slips, {'register_id':ids[0]})
117- for sid in old_slips:
118- wf_service.trg_validate(uid, 'hr.payslip', sid, 'compute_sheet', cr)
119- else:
120- res = {
121- 'employee_id':emp.id,
122- 'basic':0.0,
123- 'register_id':ids[0],
124- 'name':vals.name,
125- 'date':vals.date,
126- 'journal_id':vals.journal_id.id,
127- 'bank_journal_id':vals.bank_journal_id.id
128- }
129- slip_id = slip_pool.create(cr, uid, res)
130- wf_service.trg_validate(uid, 'hr.payslip', slip_id, 'compute_sheet', cr)
131-
132- number = self.pool.get('ir.sequence').get(cr, uid, 'salary.register')
133- self.write(cr, uid, ids, {'state':'draft', 'number':number})
134- return True
135-
136-payroll_register()
137-
138-class payroll_advice(osv.osv):
139- _inherit = 'hr.payroll.advice'
140- _description = 'Bank Advice Note'
141-
142- _columns = {
143- 'account_id': fields.many2one('account.account', 'Account'),
144- }
145-payroll_advice()
146+#class payroll_register(osv.osv):
147+# _inherit = 'hr.payroll.register'
148+# _description = 'Payroll Register'
149+#
150+# _columns = {
151+# 'journal_id': fields.many2one('account.journal', 'Expense Journal'),
152+# 'bank_journal_id': fields.many2one('account.journal', 'Bank Journal'),
153+# 'period_id': fields.many2one('account.period', 'Force Period', domain=[('state','<>','done')], help="Keep empty to use the period of the validation(Payslip) date."),
154+# }
155+#
156+# def compute_sheet(self, cr, uid, ids, context=None):
157+# emp_pool = self.pool.get('hr.employee')
158+# slip_pool = self.pool.get('hr.payslip')
159+# func_pool = self.pool.get('hr.payroll.structure')
160+# slip_line_pool = self.pool.get('hr.payslip.line')
161+# wf_service = netsvc.LocalService("workflow")
162+# vals = self.browse(cr, uid, ids, context=context)[0]
163+# emp_ids = emp_pool.search(cr, uid, [])
164+#
165+# for emp in emp_pool.browse(cr, uid, emp_ids, context=context):
166+# old_slips = slip_pool.search(cr, uid, [('employee_id','=', emp.id), ('date','=',vals.date)])
167+# if old_slips:
168+# slip_pool.write(cr, uid, old_slips, {'register_id':ids[0]})
169+# for sid in old_slips:
170+# wf_service.trg_validate(uid, 'hr.payslip', sid, 'compute_sheet', cr)
171+# else:
172+# res = {
173+# 'employee_id':emp.id,
174+# 'basic':0.0,
175+# 'register_id':ids[0],
176+# 'name':vals.name,
177+# 'date':vals.date,
178+# 'journal_id':vals.journal_id.id,
179+# 'bank_journal_id':vals.bank_journal_id.id
180+# }
181+# slip_id = slip_pool.create(cr, uid, res)
182+# wf_service.trg_validate(uid, 'hr.payslip', slip_id, 'compute_sheet', cr)
183+#
184+# number = self.pool.get('ir.sequence').get(cr, uid, 'salary.register')
185+# self.write(cr, uid, ids, {'state':'draft', 'number':number})
186+# return True
187+#
188+#payroll_register()
189+
190+#class payroll_advice(osv.osv):
191+# _inherit = 'hr.payroll.advice'
192+# _description = 'Bank Advice Note'
193+#
194+# _columns = {
195+# 'account_id': fields.many2one('account.account', 'Account'),
196+# }
197+#payroll_advice()
198
199 class contrib_register(osv.osv):
200- _inherit = 'hr.contibution.register'
201+ _inherit = 'hr.contribution.register'
202 _description = 'Contribution Register'
203
204 def _total_contrib(self, cr, uid, ids, field_names, arg, context=None):
205- line_pool = self.pool.get('hr.contibution.register.line')
206+# line_pool = self.pool.get('hr.contibution.register.line')
207 period_id = self.pool.get('account.period').search(cr,uid,[('date_start','<=',time.strftime('%Y-%m-%d')),('date_stop','>=',time.strftime('%Y-%m-%d'))])[0]
208 fiscalyear_id = self.pool.get('account.period').browse(cr, uid, period_id, context=context).fiscalyear_id
209 res = {}
210- for cur in self.browse(cr, uid, ids, context=context):
211- current = line_pool.search(cr, uid, [('period_id','=',period_id),('register_id','=',cur.id)])
212- years = line_pool.search(cr, uid, [('period_id.fiscalyear_id','=',fiscalyear_id.id), ('register_id','=',cur.id)])
213-
214- e_month = 0.0
215- c_month = 0.0
216- for i in line_pool.browse(cr, uid, current, context=context):
217- e_month += i.emp_deduction
218- c_month += i.comp_deduction
219-
220- e_year = 0.0
221- c_year = 0.0
222- for j in line_pool.browse(cr, uid, years, context=context):
223- e_year += i.emp_deduction
224- c_year += i.comp_deduction
225-
226- res[cur.id]={
227- 'monthly_total_by_emp':e_month,
228- 'monthly_total_by_comp':c_month,
229- 'yearly_total_by_emp':e_year,
230- 'yearly_total_by_comp':c_year
231- }
232+# for cur in self.browse(cr, uid, ids, context=context):
233+# current = line_pool.search(cr, uid, [('period_id','=',period_id),('register_id','=',cur.id)])
234+# years = line_pool.search(cr, uid, [('period_id.fiscalyear_id','=',fiscalyear_id.id), ('register_id','=',cur.id)])
235+#
236+# e_month = 0.0
237+# c_month = 0.0
238+# for i in line_pool.browse(cr, uid, current, context=context):
239+# e_month += i.emp_deduction
240+# c_month += i.comp_deduction
241+#
242+# e_year = 0.0
243+# c_year = 0.0
244+# for j in line_pool.browse(cr, uid, years, context=context):
245+# e_year += i.emp_deduction
246+# c_year += i.comp_deduction
247+#
248+# res[cur.id]={
249+# 'monthly_total_by_emp':e_month,
250+# 'monthly_total_by_comp':c_month,
251+# 'yearly_total_by_emp':e_year,
252+# 'yearly_total_by_comp':c_year
253+# }
254 return res
255
256 _columns = {
257@@ -188,22 +188,22 @@
258 }
259 contrib_register()
260
261-class contrib_register_line(osv.osv):
262- _inherit = 'hr.contibution.register.line'
263- _description = 'Contribution Register Line'
264-
265- _columns = {
266- 'period_id': fields.many2one('account.period', 'Period'),
267- }
268-contrib_register_line()
269-
270-class hr_holidays_status(osv.osv):
271- _inherit = 'hr.holidays.status'
272- _columns = {
273- 'account_id': fields.many2one('account.account', 'Account'),
274- 'analytic_account_id':fields.many2one('account.analytic.account', 'Analytic Account'),
275- }
276-hr_holidays_status()
277+#class contrib_register_line(osv.osv):
278+# _inherit = 'hr.contibution.register.line'
279+# _description = 'Contribution Register Line'
280+#
281+# _columns = {
282+# 'period_id': fields.many2one('account.period', 'Period'),
283+# }
284+#contrib_register_line()
285+
286+#class hr_holidays_status(osv.osv):
287+# _inherit = 'hr.holidays.status'
288+# _columns = {
289+# 'account_id': fields.many2one('account.account', 'Account'),
290+# 'analytic_account_id':fields.many2one('account.analytic.account', 'Analytic Account'),
291+# }
292+#hr_holidays_status()
293
294 class hr_payslip(osv.osv):
295 '''
296@@ -213,14 +213,72 @@
297 _description = 'Pay Slip'
298
299 _columns = {
300- 'journal_id': fields.many2one('account.journal', 'Expense Journal'),
301- 'bank_journal_id': fields.many2one('account.journal', 'Bank Journal'),
302+ 'journal_id': fields.many2one('account.journal', 'Expense Journal',states={'draft': [('readonly', False)]}, readonly=True),
303+ 'bank_journal_id': fields.many2one('account.journal', 'Bank Journal', states={'draft': [('readonly', False)]}, readonly=True),
304 'move_ids':fields.one2many('hr.payslip.account.move', 'slip_id', 'Accounting vouchers'),
305 'move_line_ids':fields.many2many('account.move.line', 'payslip_lines_rel', 'slip_id', 'line_id', 'Accounting Lines', readonly=True),
306 'move_payment_ids':fields.many2many('account.move.line', 'payslip_payment_rel', 'slip_id', 'payment_id', 'Payment Lines', readonly=True),
307- 'period_id': fields.many2one('account.period', 'Force Period', domain=[('state','<>','done')], help="Keep empty to use the period of the validation(Payslip) date."),
308+ '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."),
309+ 'account_move_ids': fields.many2many('account.move', 'payslip_move_rel', 'slip_id', 'move_id', 'Accounting Entries', readonly=True),
310 }
311
312+ def onchange_contract_id(self, cr, uid, ids, date_from, date_to, employee_id=False, contract_id=False, context=None):
313+ contract_obj = self.pool.get('hr.contract')
314+ 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)
315+ journal_id = contract_obj.browse(cr, uid, contract_id, context=context).journal_id.id
316+ res['value'].update({'journal_id': journal_id})
317+ return res
318+
319+# def onchange_employee_id(self, cr, uid, ids, date_from, date_to, employee_id=False, contract_id=False, context=None):
320+# contract_obj = self.pool.get('hr.contract')
321+# res = super(hr_payslip, self).onchange_employee_id(cr, uid, ids, date_from=date_from, date_to=date_to, employee_id=employee_id, contract_id=contract_id, context=context)
322+# contract_id = res['value']['contract_id']
323+# if res['value']['contract_id']:
324+# journal_id = contract_obj.browse(cr, uid, res['value']['contract_id'], context=context).journal_id.id
325+# res['value'].update({'journal_id': journal_id})
326+# return res
327+
328+ def get_payslip_lines(self, cr, uid, contract_ids, payslip_id, context):
329+ journal_obj = self.pool.get('account.journal')
330+ rule_obj = self.pool.get('hr.salary.rule')
331+ contract_obj = self.pool.get('hr.contract')
332+ structure_obj = self.pool.get('hr.payroll.structure')
333+ vals_account = {}
334+ result = super(hr_payslip, self).get_payslip_lines(cr, uid, contract_ids, payslip_id, context)
335+ structure_ids = contract_obj.get_all_structures(cr, uid, contract_ids, context=context)
336+ #get the rules of the structure and thier children
337+ rule_ids = structure_obj.get_all_rules(cr, uid, structure_ids, context=context)
338+ sorted_rule_ids = [id for id, sequence in sorted(rule_ids, key=lambda x:x[1])]
339+ #Fetching Debit/Credit account of the payslip journal.
340+ journal = self.browse(cr, uid, payslip_id, context=context).journal_id
341+ credit_account = journal.default_credit_account_id and journal.default_credit_account_id.id or False
342+ debit_account = journal.default_debit_account_id and journal.default_debit_account_id.id or False
343+ # Assigning above fetched Debit/Credit account on salary rules if not specified
344+ for rule in rule_obj.browse(cr, uid, sorted_rule_ids, context=context):
345+ if not rule.account_debit.id:
346+ rule_obj.write(cr, uid, [rule.id], {'account_debit': debit_account})
347+ if not rule.account_credit.id:
348+ rule_obj.write(cr, uid, [rule.id], {'account_credit': credit_account})
349+ #Assigning Debit/Credit account on payslip lines
350+ for value in result:
351+ if value['salary_rule_id'] == rule.id:
352+ if rule.category_id.name == 'Deduction':
353+ if not rule.account_debit.id:
354+ value['account_id'] = debit_account
355+ else:
356+ value['account_id'] = rule.account_debit.id
357+ elif rule.category_id.name == 'Allowance':
358+ if not rule.account_credit.id:
359+ value['account_id'] = credit_account
360+ else:
361+ value['account_id'] = rule.account_credit.id
362+ else:
363+ emp_account_id = self.browse(cr, uid, payslip_id, context=context).employee_id.employee_account.id
364+ value['account_id'] = emp_account_id
365+ if rule.analytic_account_id:
366+ value['analytic_account_id'] = rule.analytic_account_id.id
367+ return result
368+
369 def create_voucher(self, cr, uid, ids, name, voucher, sequence=5):
370 slip_move = self.pool.get('hr.payslip.account.move')
371 for slip in ids:
372@@ -243,10 +301,8 @@
373 if line.move_id.state == 'posted':
374 move_pool.button_cancel(cr, uid [line.move_id.id], context)
375 move_pool.unlink(cr, uid, [line.move_id.id], context=context)
376-
377 slip_move.unlink(cr, uid, move_ids, context=context)
378- self.write(cr, uid, ids, {'state':'cancel'}, context=context)
379- return True
380+ return self.write(cr, uid, ids, {'state':'cancel'}, context=context)
381
382 def process_sheet(self, cr, uid, ids, context=None):
383 move_pool = self.pool.get('account.move')
384@@ -268,17 +324,21 @@
385 partner = slip.employee_id.bank_account_id.partner_id
386 partner_id = partner.id
387
388+ for line in slip.line_ids:
389+ if line.category_id.code == 'NET':
390+ amt = line.total
391+
392 fiscal_year_ids = fiscalyear_pool.search(cr, uid, [], context=context)
393 if not fiscal_year_ids:
394 raise osv.except_osv(_('Warning !'), _('Please define fiscal year for perticular contract'))
395 fiscal_year_objs = fiscalyear_pool.read(cr, uid, fiscal_year_ids, ['date_start','date_stop'], context=context)
396 year_exist = False
397 for fiscal_year in fiscal_year_objs:
398- if ((fiscal_year['date_start'] <= slip.date) and (fiscal_year['date_stop'] >= slip.date)):
399+ if ((fiscal_year['date_start'] <= slip.date_from) and (fiscal_year['date_stop'] >= slip.date_to)):
400 year_exist = True
401 if not year_exist:
402 raise osv.except_osv(_('Warning !'), _('Fiscal Year is not defined for slip date %s') % slip.date)
403- search_periods = period_pool.search(cr, uid, [('date_start','<=',slip.date),('date_stop','>=',slip.date)], context=context)
404+ search_periods = period_pool.search(cr, uid, [('date_start','<=',slip.date_from),('date_stop','>=',slip.date_to)], context=context)
405 if not search_periods:
406 raise osv.except_osv(_('Warning !'), _('Period is not defined for slip date %s') % slip.date)
407 period_id = search_periods[0]
408@@ -286,7 +346,7 @@
409 move = {
410 'journal_id': slip.bank_journal_id.id,
411 'period_id': period_id,
412- 'date': slip.date,
413+ 'date': slip.date_from,
414 'type':'bank_pay_voucher',
415 'ref':slip.number,
416 'narration': name
417@@ -302,10 +362,10 @@
418 ded_rec = {
419 'move_id': move_id,
420 'name': name,
421- 'date': slip.date,
422+ 'date': slip.date_from,
423 'account_id': slip.employee_id.property_bank_account.id,
424 'debit': 0.0,
425- 'credit': slip.total_pay,
426+ 'credit': amt,
427 'journal_id': slip.journal_id.id,
428 'period_id': period_id,
429 'ref': slip.number
430@@ -316,9 +376,9 @@
431 'move_id': move_id,
432 'name': name,
433 'partner_id': partner_id,
434- 'date': slip.date,
435+ 'date': slip.date_from,
436 'account_id': partner.property_account_payable.id,
437- 'debit': slip.total_pay,
438+ 'debit': amt,
439 'credit': 0.0,
440 'journal_id': slip.journal_id.id,
441 'period_id': period_id,
442@@ -326,74 +386,75 @@
443 }
444 line_ids += [movel_pool.create(cr, uid, cre_rec, context=context)]
445
446- other_pay = slip.other_pay
447+# other_pay = slip.other_pay
448 #Process all Reambuse Entries
449- for line in slip.line_ids:
450- if line.type == 'otherpay' and line.expanse_id.invoice_id:
451- if not line.expanse_id.invoice_id.move_id:
452- raise osv.except_osv(_('Warning !'), _('Please Confirm all Expense Invoice appear for Reimbursement'))
453- invids = [line.expanse_id.invoice_id.id]
454- amount = line.total
455- acc_id = slip.bank_journal_id.default_credit_account_id and slip.bank_journal_id.default_credit_account_id.id
456- period_id = slip.period_id.id
457- journal_id = slip.bank_journal_id.id
458- name = '[%s]-%s' % (slip.number, line.name)
459- invoice_pool.pay_and_reconcile(cr, uid, invids, amount, acc_id, period_id, journal_id, False, period_id, False, context, name)
460- other_pay -= amount
461- #TODO: link this account entries to the Payment Lines also Expense Entries to Account Lines
462- l_ids = movel_pool.search(cr, uid, [('name','=',name)], context=context)
463- line_ids += l_ids
464-
465- l_ids = movel_pool.search(cr, uid, [('invoice','=',line.expanse_id.invoice_id.id)], context=context)
466- exp_ids += l_ids
467+# for line in slip.line_ids:
468+# if line.type == 'otherpay' and line.expanse_id.invoice_id:
469+# if not line.expanse_id.invoice_id.move_id:
470+# raise osv.except_osv(_('Warning !'), _('Please Confirm all Expense Invoice appear for Reimbursement'))
471+# invids = [line.expanse_id.invoice_id.id]
472+# amount = line.total
473+# acc_id = slip.bank_journal_id.default_credit_account_id and slip.bank_journal_id.default_credit_account_id.id
474+# period_id = slip.period_id.id
475+# journal_id = slip.bank_journal_id.id
476+# name = '[%s]-%s' % (slip.number, line.name)
477+# invoice_pool.pay_and_reconcile(cr, uid, invids, amount, acc_id, period_id, journal_id, False, period_id, False, context, name)
478+# other_pay -= amount
479+# #TODO: link this account entries to the Payment Lines also Expense Entries to Account Lines
480+# l_ids = movel_pool.search(cr, uid, [('name','=',name)], context=context)
481+# line_ids += l_ids
482+#
483+# l_ids = movel_pool.search(cr, uid, [('invoice','=',line.expanse_id.invoice_id.id)], context=context)
484+# exp_ids += l_ids
485
486 #Process for Other payment if any
487- other_move_id = False
488- if slip.other_pay > 0:
489- narration = 'Payment of Other Payeble amounts to %s' % (slip.employee_id.name)
490- move = {
491- 'journal_id': slip.bank_journal_id.id,
492- 'period_id': period_id,
493- 'date': slip.date,
494- 'type':'bank_pay_voucher',
495- 'ref':slip.number,
496- 'narration': narration
497- }
498- other_move_id = move_pool.create(cr, uid, move, context=context)
499- self.create_voucher(cr, uid, [slip.id], narration, move_id)
500-
501- name = "To %s account" % (slip.employee_id.name)
502- ded_rec = {
503- 'move_id':other_move_id,
504- 'name':name,
505- 'date':slip.date,
506- 'account_id':slip.employee_id.property_bank_account.id,
507- 'debit': 0.0,
508- 'credit': other_pay,
509- 'journal_id':slip.journal_id.id,
510- 'period_id':period_id,
511- 'ref':slip.number
512- }
513- line_ids += [movel_pool.create(cr, uid, ded_rec, context=context)]
514- name = "By %s account" % (slip.employee_id.property_bank_account.name)
515- cre_rec = {
516- 'move_id':other_move_id,
517- 'name':name,
518- 'partner_id':partner_id,
519- 'date':slip.date,
520- 'account_id':partner.property_account_payable.id,
521- 'debit': other_pay,
522- 'credit':0.0,
523- 'journal_id':slip.journal_id.id,
524- 'period_id':period_id,
525- 'ref':slip.number
526- }
527- line_ids += [movel_pool.create(cr, uid, cre_rec, context=context)]
528+# other_move_id = False
529+# if slip.other_pay > 0:
530+# narration = 'Payment of Other Payeble amounts to %s' % (slip.employee_id.name)
531+# move = {
532+# 'journal_id': slip.bank_journal_id.id,
533+# 'period_id': period_id,
534+# 'date': slip.date_from,
535+# 'type':'bank_pay_voucher',
536+# 'ref':slip.number,
537+# 'narration': narration
538+# }
539+# other_move_id = move_pool.create(cr, uid, move, context=context)
540+# self.create_voucher(cr, uid, [slip.id], narration, move_id)
541+#
542+# name = "To %s account" % (slip.employee_id.name)
543+# ded_rec = {
544+# 'move_id':other_move_id,
545+# 'name':name,
546+# 'date':slip.date_from,
547+# 'account_id':slip.employee_id.property_bank_account.id,
548+# 'debit': 0.0,
549+# 'credit': other_pay,
550+# 'journal_id':slip.journal_id.id,
551+# 'period_id':period_id,
552+# 'ref':slip.number
553+# }
554+# line_ids += [movel_pool.create(cr, uid, ded_rec, context=context)]
555+# name = "By %s account" % (slip.employee_id.property_bank_account.name)
556+# cre_rec = {
557+# 'move_id':other_move_id,
558+# 'name':name,
559+# 'partner_id':partner_id,
560+# 'date':slip.date_from,
561+# 'account_id':partner.property_account_payable.id,
562+# 'debit': other_pay,
563+# 'credit':0.0,
564+# 'journal_id':slip.journal_id.id,
565+# 'period_id':period_id,
566+# 'ref':slip.number
567+# }
568+# line_ids += [movel_pool.create(cr, uid, cre_rec, context=context)]
569
570 rec = {
571 'state':'done',
572 'move_payment_ids':[(6, 0, line_ids)],
573- 'paid':True
574+ 'paid':True,
575+ 'account_move_ids': [(4, move_id)],
576 }
577 self.write(cr, uid, [slip.id], rec, context=context)
578 for exp_id in exp_ids:
579@@ -402,12 +463,10 @@
580 return True
581
582 def account_check_sheet(self, cr, uid, ids, context=None):
583- self.write(cr, uid, ids, {'state':'accont_check'}, context=context)
584- return True
585+ return self.write(cr, uid, ids, {'state':'accont_check'}, context=context)
586
587 def hr_check_sheet(self, cr, uid, ids, context=None):
588- self.write(cr, uid, ids, {'state':'hr_check'}, context=context)
589- return True
590+ return self.write(cr, uid, ids, {'state':'hr_check'}, context=context)
591
592 def verify_sheet(self, cr, uid, ids, context=None):
593 move_pool = self.pool.get('account.move')
594@@ -419,6 +478,9 @@
595 payslip_pool = self.pool.get('hr.payslip.line')
596
597 for slip in self.browse(cr, uid, ids, context=context):
598+ for line in slip.line_ids:
599+ if line.category_id.code == 'BASIC':
600+ basic_amt = line.total
601 if not slip.journal_id:
602 # Call super method to verify sheet if journal_id is not specified.
603 super(hr_payslip, self).verify_sheet(cr, uid, [slip.id], context=context)
604@@ -426,6 +488,7 @@
605 total_deduct = 0.0
606
607 line_ids = []
608+ move_ids = []
609 partner = False
610 partner_id = False
611
612@@ -449,11 +512,11 @@
613 fiscal_year_objs = fiscalyear_pool.read(cr, uid, fiscal_year_ids, ['date_start','date_stop'], context=context)
614 year_exist = False
615 for fiscal_year in fiscal_year_objs:
616- if ((fiscal_year['date_start'] <= slip.date) and (fiscal_year['date_stop'] >= slip.date)):
617+ if ((fiscal_year['date_start'] <= slip.date_from) and (fiscal_year['date_stop'] >= slip.date_to)):
618 year_exist = True
619 if not year_exist:
620 raise osv.except_osv(_('Warning !'), _('Fiscal Year is not defined for slip date %s') % slip.date)
621- search_periods = period_pool.search(cr,uid,[('date_start','<=',slip.date),('date_stop','>=',slip.date)], context=context)
622+ search_periods = period_pool.search(cr,uid,[('date_start','=',slip.date_from),('date_stop','=',slip.date_to)], context=context)
623 if not search_periods:
624 raise osv.except_osv(_('Warning !'), _('Period is not defined for slip date %s') % slip.date)
625 period_id = search_periods[0]
626@@ -461,11 +524,12 @@
627 move = {
628 'journal_id': slip.journal_id.id,
629 'period_id': period_id,
630- 'date': slip.date,
631+ 'date': slip.date_from,
632 'ref':slip.number,
633 'narration': slip.name
634 }
635 move_id = move_pool.create(cr, uid, move, context=context)
636+ move_ids += [move_id]
637 self.create_voucher(cr, uid, [slip.id], slip.name, move_id)
638
639 if not slip.employee_id.salary_account.id:
640@@ -474,17 +538,16 @@
641 line = {
642 'move_id':move_id,
643 'name': "By Basic Salary / " + slip.employee_id.name,
644- 'date': slip.date,
645+ 'date': slip.date_from,
646 'account_id': slip.employee_id.salary_account.id,
647- 'debit': slip.basic,
648+ 'debit': basic_amt,
649 'credit': 0.0,
650- 'quantity':slip.working_days,
651+# 'quantity':slip.working_days,
652 'journal_id': slip.journal_id.id,
653 'period_id': period_id,
654 'analytic_account_id': False,
655 'ref':slip.number
656 }
657-
658 #Setting Analysis Account for Basic Salary
659 if slip.employee_id.analytic_account:
660 line['analytic_account_id'] = slip.employee_id.analytic_account.id
661@@ -499,28 +562,30 @@
662 'move_id':move_id,
663 'name': "To Basic Payble Salary / " + slip.employee_id.name,
664 'partner_id': partner_id,
665- 'date': slip.date,
666+ 'date': slip.date_from,
667 'account_id': slip.employee_id.employee_account.id,
668 'debit': 0.0,
669- 'quantity':slip.working_days,
670- 'credit': slip.basic,
671+# 'quantity':slip.working_days,
672+ 'credit': basic_amt,
673 'journal_id': slip.journal_id.id,
674 'period_id': period_id,
675 'ref':slip.number
676 }
677 line_ids += [movel_pool.create(cr, uid, line, context=context)]
678-
679+ codes = ['NET', 'GROSS', 'BASIC']
680 for line in slip.line_ids:
681+ if line.code in codes:
682+ continue
683 name = "[%s] - %s / %s" % (line.code, line.name, slip.employee_id.name)
684 amount = line.total
685
686- if line.type == 'leaves':
687- continue
688+# if line.type == 'leaves':
689+# continue
690
691 rec = {
692 'move_id': move_id,
693 'name': name,
694- 'date': slip.date,
695+ 'date': slip.date_from,
696 'account_id': line.account_id.id,
697 'debit': 0.0,
698 'credit': 0.0,
699@@ -534,10 +599,11 @@
700 #Setting Analysis Account for Salary Slip Lines
701 if line.analytic_account_id:
702 rec['analytic_account_id'] = line.analytic_account_id.id
703- else:
704- rec['analytic_account_id'] = slip.deg_id.account_id.id
705+# else:
706+# rec['analytic_account_id'] = slip.deg_id.account_id.id
707
708- if line.type == 'allowance' or line.type == 'otherpay':
709+# if line.type == 'allowance' or line.type == 'otherpay':
710+ if line.category_id.code == 'ALW' :
711 rec['debit'] = amount
712 if not partner.property_account_payable:
713 raise osv.except_osv(_('Integrity Error !'), _('Please Configure Partners Payable Account!!'))
714@@ -545,7 +611,7 @@
715 'move_id': move_id,
716 'name': name,
717 'partner_id': partner_id,
718- 'date': slip.date,
719+ 'date': slip.date_from,
720 'account_id': partner.property_account_payable.id,
721 'debit': 0.0,
722 'quantity': 1,
723@@ -555,16 +621,17 @@
724 'ref': slip.number
725 }
726 line_ids += [movel_pool.create(cr, uid, ded_rec, context=context)]
727- elif line.type == 'deduction' or line.type == 'otherdeduct':
728+ elif line.category_id.code == 'DED':
729 if not partner.property_account_receivable:
730 raise osv.except_osv(_('Integrity Error !'), _('Please Configure Partners Receivable Account!!'))
731+ amount = -(amount)
732 rec['credit'] = amount
733 total_deduct += amount
734 ded_rec = {
735 'move_id': move_id,
736 'name': name,
737 'partner_id': partner_id,
738- 'date': slip.date,
739+ 'date': slip.date_from,
740 'quantity': 1,
741 'account_id': partner.property_account_receivable.id,
742 'debit': amount,
743@@ -574,23 +641,21 @@
744 'ref': slip.number
745 }
746 line_ids += [movel_pool.create(cr, uid, ded_rec, context=context)]
747-
748 line_ids += [movel_pool.create(cr, uid, rec, context=context)]
749-
750 # if self._debug:
751 # for contrib in line.category_id.contribute_ids:
752 # _log.debug("%s %s %s %s %s", contrib.name, contrub.code, contrub.amount_type, contrib.contribute_per, line.total)
753-
754 adj_move_id = False
755 if total_deduct > 0:
756 move = {
757 'journal_id': slip.journal_id.id,
758 'period_id': period_id,
759- 'date': slip.date,
760+ 'date': slip.date_from,
761 'ref':slip.number,
762 'narration': 'Adjustment: %s' % (slip.name)
763 }
764 adj_move_id = move_pool.create(cr, uid, move, context=context)
765+ move_ids += [adj_move_id]
766 name = "Adjustment Entry - %s" % (slip.employee_id.name)
767 self.create_voucher(cr, uid, [slip.id], name, adj_move_id)
768
769@@ -598,7 +663,7 @@
770 'move_id': adj_move_id,
771 'name': name,
772 'partner_id': partner_id,
773- 'date': slip.date,
774+ 'date': slip.date_from,
775 'account_id': partner.property_account_receivable.id,
776 'debit': 0.0,
777 'quantity': 1,
778@@ -612,7 +677,7 @@
779 'move_id': adj_move_id,
780 'name': name,
781 'partner_id': partner_id,
782- 'date': slip.date,
783+ 'date': slip.date_from,
784 'account_id': partner.property_account_payable.id,
785 'debit': total_deduct,
786 'quantity': 1,
787@@ -626,29 +691,28 @@
788 rec = {
789 'state':'confirm',
790 'move_line_ids':[(6, 0,line_ids)],
791+ 'account_move_ids':[(6, 0, move_ids)]
792 }
793 if not slip.period_id:
794 rec['period_id'] = period_id
795
796- dates = prev_bounds(slip.date)
797- exp_ids = exp_pool.search(cr, uid, [('date_valid','>=',dates[0]), ('date_valid','<=',dates[1]), ('state','=','invoiced')], context=context)
798- if exp_ids:
799- acc = property_pool.get(cr, uid, 'property_account_expense_categ', 'product.category')
800- for exp in exp_pool.browse(cr, uid, exp_ids, context=context):
801- exp_res = {
802- 'name':exp.name,
803- 'amount_type':'fix',
804- 'type':'otherpay',
805- 'category_id':exp.category_id.id,
806- 'amount':exp.amount,
807- 'slip_id':slip.id,
808- 'expanse_id':exp.id,
809- 'account_id':acc
810- }
811- payslip_pool.create(cr, uid, exp_res, context=context)
812-
813+# dates = prev_bounds(slip.date)
814+ exp_ids = exp_pool.search(cr, uid, [('date_valid','>=',slip.date_from), ('date_valid','<=',slip.date_to), ('state','=','invoiced')], context=context)
815+# if exp_ids:
816+# acc = property_pool.get(cr, uid, 'property_account_expense_categ', 'product.category')
817+# for exp in exp_pool.browse(cr, uid, exp_ids, context=context):
818+# exp_res = {
819+# 'name':exp.name,
820+# 'amount_type':'fix',
821+# 'type':'otherpay',
822+# 'category_id':exp.category_id.id,
823+# 'amount':exp.amount,
824+# 'slip_id':slip.id,
825+# 'expanse_id':exp.id,
826+# 'account_id':acc
827+# }
828+# payslip_pool.create(cr, uid, exp_res, context=context)
829 self.write(cr, uid, [slip.id], rec, context=context)
830-
831 return True
832
833 hr_payslip()
834@@ -661,6 +725,17 @@
835 }
836 hr_payslip_line()
837
838+class hr_salary_rule(osv.osv):
839+ _inherit = 'hr.salary.rule'
840+ _columns = {
841+# 'account_id': fields.many2one('account.account', 'General Account'),
842+ 'analytic_account_id':fields.many2one('account.analytic.account', 'Analytic Account'),
843+ 'account_tax_id':fields.many2one('account.tax.code', 'Tax Code'),
844+ 'account_debit': fields.many2one('account.account', 'Debit Account'),
845+ 'account_credit': fields.many2one('account.account', 'Credit Account'),
846+ }
847+hr_salary_rule()
848+
849 class account_move_link_slip(osv.osv):
850 '''
851 Account Move Link to Pay Slip
852@@ -675,4 +750,15 @@
853 }
854 account_move_link_slip()
855
856+class hr_contract(osv.osv):
857+
858+ _inherit = 'hr.contract'
859+ _description = 'Employee Contract'
860+ _columns = {
861+ 'analytic_account_id':fields.many2one('account.analytic.account', 'Analytic Account'),
862+ 'journal_id': fields.many2one('account.journal', 'Journal'),
863+ }
864+hr_contract()
865+
866+
867 # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
868
869=== renamed file 'hr_payroll_account/hr_payroll_demo.xml' => 'hr_payroll_account/hr_payroll_account_demo.xml'
870--- hr_payroll_account/hr_payroll_demo.xml 2011-01-14 00:11:01 +0000
871+++ hr_payroll_account/hr_payroll_account_demo.xml 2011-05-12 08:43:31 +0000
872@@ -2,31 +2,55 @@
873 <openerp>
874 <data>
875
876- <record id="hr_payroll.hr_payslip_line_houserantallowance1" model="hr.payslip.line">
877- <field name="account_id" ref="account.a_salary_expense"/>
878- </record>
879-
880- <record id="hr_payroll.hr_payslip_line_convanceallowance1" model="hr.payslip.line">
881- <field name="account_id" ref="account.a_salary_expense"/>
882- </record>
883-
884- <record id="hr_payroll.hr_payslip_line_professionaltax1" model="hr.payslip.line">
885- <field name="account_id" ref="account.a_salary_expense"/>
886- </record>
887-
888- <record id="hr_payroll.hr_payslip_line_providentfund1" model="hr.payslip.line">
889- <field name="account_id" ref="account.a_salary_expense"/>
890+ <record id="hr_payroll.hr_payslip_line_houserantallowance1" model="hr.salary.rule">
891+ <field name="account_debit" ref="account.a_salary_expense"/>
892+ </record>
893+
894+ <record id="hr_payroll.hr_payslip_line_convanceallowance1" model="hr.salary.rule">
895+ <field name="account_debit" ref="account.a_salary_expense"/>
896+ </record>
897+
898+ <record id="hr_payroll.hr_payslip_line_professionaltax1" model="hr.salary.rule">
899+ <field name="account_debit" ref="account.a_salary_expense"/>
900+ </record>
901+
902+ <record id="hr_payroll.hr_payslip_line_providentfund1" model="hr.salary.rule">
903+ <field name="account_debit" ref="account.a_salary_expense"/>
904+ </record>
905+
906+ <record id="hr_payroll.hr_salary_rule_meal_voucher" model="hr.salary.rule">
907+ <field name="account_debit" ref="account.a_salary_expense"/>
908+ </record>
909+
910+ <record id="hr_payroll.hr_salary_rule_ca_paolino" model="hr.salary.rule">
911+ <field name="account_debit" ref="account.a_salary_expense"/>
912+ </record>
913+
914+ <record id="hr_payroll.hr_rule_basic" model="hr.salary.rule">
915+ <field name="account_debit" ref="account.a_salary_expense"/>
916+ </record>
917+
918+ <record id="hr_payroll.hr_rule_taxable" model="hr.salary.rule">
919+ <field name="account_debit" ref="account.a_salary_expense"/>
920+ </record>
921+
922+ <record id="hr_payroll.hr_rule_net" model="hr.salary.rule">
923+ <field name="account_debit" ref="account.a_salary_expense"/>
924+ </record>
925+
926+ <record id="hr_payroll.hr_payslip_line_houserantallowance1" model="hr.salary.rule">
927+ <field name="account_debit" ref="account.a_salary_expense"/>
928 </record>
929
930 <!-- Payslip -->
931- <record id="hr_payroll.hr_payslip_salaryslipofbonamyforjune0" model="hr.payslip">
932+ <!-- <record id="hr_payroll.hr_payslip_salaryslipofbonamyforjune0" model="hr.payslip">
933 <field name="journal_id" ref="account.expenses_journal"/>
934 <field name="bank_journal_id" ref="account.bank_journal"/>
935- </record>
936+ </record>-->
937
938 <!-- Assigned Default Account in Different Demo Employees -->
939
940- <!--record id="hr.employee" model="hr.employee">
941+ <!-- <record id="hr.employee" model="hr.employee">
942 <field name="property_bank_account" ref="account.bnk"/>
943 <field name="salary_account" ref="account.a_salary_expense"/>
944 <field name="employee_account" ref="account.a_expense"/>
945@@ -54,7 +78,7 @@
946 <field name="property_bank_account" ref="account.bnk"/>
947 <field name="salary_account" ref="account.a_salary_expense"/>
948 <field name="employee_account" ref="account.a_expense"/>
949- </record-->
950+ </record>-->
951
952 <record id="bnk" model="account.account">
953 <field name="code">X110041</field>
954@@ -72,12 +96,13 @@
955 <field name="user_type" ref="account.account_type_expense"/>
956 </record>
957
958- <record id="a_expense" model="account.account">
959- <field name="code">X21102</field>
960- <field name="name">Expenses</field>
961- <field ref="account.ovr" name="parent_id"/>
962- <field name="type">other</field>
963- <field name="user_type" ref="account.account_type_expense"/>
964+ <record id="a_creditors" model="account.account">
965+ <field name="code">X11111</field>
966+ <field name="name">Employee Payable Account</field>
967+ <field ref="account.cli" name="parent_id"/>
968+ <field name="type">payable</field>
969+ <field eval="True" name="reconcile"/>
970+ <field name="user_type" ref="account.account_type_payable"/>
971 </record>
972
973 <!-- Properties -->
974@@ -98,7 +123,7 @@
975 <record forcecreate="True" id="employee_account" model="ir.property">
976 <field name="name">employee_account</field>
977 <field name="fields_id" search="[('model','=','hr.employee'),('name','=','employee_account')]"/>
978- <field eval="'account.account,'+str(a_expense)" name="value"/>
979+ <field eval="'account.account,'+str(a_creditors)" name="value"/>
980 <field name="company_id" ref="base.main_company"/>
981 </record>
982
983
984=== modified file 'hr_payroll_account/hr_payroll_account_view.xml'
985--- hr_payroll_account/hr_payroll_account_view.xml 2011-03-10 13:18:08 +0000
986+++ hr_payroll_account/hr_payroll_account_view.xml 2011-05-12 08:43:31 +0000
987@@ -2,29 +2,13 @@
988 <openerp>
989 <data>
990
991-
992- <record model="ir.ui.view" id="view_holiday_status_inherit_form1">
993- <field name="name">hr.holidays.status.inherit1</field>
994- <field name="model">hr.holidays.status</field>
995- <field name="inherit_id" ref="hr_payroll.view_holiday_status_form1"/>
996- <field name="type">form</field>
997- <field name="arch" type="xml">
998- <field name="code" position="after">
999- <field name="analytic_account_id"/>
1000- <newline/>
1001- <field name="account_id"/>
1002- <newline/>
1003- </field>
1004- </field>
1005- </record>
1006-
1007 <record model="ir.ui.view" id="view_hr_payslip_line_inherit_tree">
1008 <field name="name">hr.payslip.line.inherit.tree</field>
1009 <field name="model">hr.payslip.line</field>
1010 <field name="inherit_id" ref="hr_payroll.view_hr_payslip_line_tree"/>
1011 <field name="type">tree</field>
1012 <field name="arch" type="xml">
1013- <field name="amount" position="after">
1014+ <field name="category_id" position="after">
1015 <field name="analytic_account_id"/>
1016 <field name="account_id" required="1"/>
1017 </field>
1018@@ -44,7 +28,7 @@
1019 </field>
1020 </record>
1021
1022- <record model="ir.ui.view" id="view_hr_employee_grade_inherit_form">
1023+ <!-- <record model="ir.ui.view" id="view_hr_employee_grade_inherit_form">
1024 <field name="name">hr.employee.grade.inherit.form</field>
1025 <field name="model">hr.payroll.structure</field>
1026 <field name="inherit_id" ref="hr_payroll.view_hr_employee_grade_form"/>
1027@@ -54,7 +38,7 @@
1028 <field name="account_id" required="1"/>
1029 </xpath>
1030 </field>
1031- </record>
1032+ </record>-->
1033
1034 <record model="ir.ui.view" id="view_hr_payslip_inherit_form">
1035 <field name="name">hr.payslip.inherit.form</field>
1036@@ -62,9 +46,10 @@
1037 <field name="inherit_id" ref="hr_payroll.view_hr_payslip_form"/>
1038 <field name="type">form</field>
1039 <field name="arch" type="xml">
1040- <field name="date" position="before">
1041+ <field name="date_to" position="after">
1042 <field name="journal_id" required="1"/>
1043 <field name="bank_journal_id" domain="[('type','=','cash')]" required="1"/>
1044+ <field name="period_id" />
1045 </field>
1046 </field>
1047 </record>
1048@@ -80,58 +65,20 @@
1049 <field name="account_id" required="1"/>
1050 <field name="analytic_account_id"/>
1051 </xpath>
1052- <xpath expr="/form/notebook/page[@string='Salary Computation']/field[@name='line_ids']/form/group/field[@name='company_contrib']" position="before">
1053+ <xpath expr="/form/notebook/page[@string='Salary Computation']/field[@name='line_ids']/form/group/field[@name='salary_rule_id']" position="after">
1054 <field name="account_id" required="1"/>
1055 <field name="analytic_account_id"/>
1056 </xpath>
1057 </field>
1058 </record>
1059
1060- <record model="ir.ui.view" id="view_hr_bank_advice_inherit_form">
1061- <field name="name">hr.payroll.advice.inherit.form</field>
1062- <field name="model">hr.payroll.advice</field>
1063- <field name="inherit_id" ref="hr_payroll.view_hr_bank_advice_form"/>
1064- <field name="type">form</field>
1065- <field name="arch" type="xml">
1066- <field name="name" position="after">
1067- <field name="account_id" required="1"/>
1068- </field>
1069- </field>
1070- </record>
1071-
1072- <record model="ir.ui.view" id="view_hr_payroll_register_inherit_tree">
1073- <field name="name">hr.payroll.register.inherit.tree</field>
1074- <field name="model">hr.payroll.register</field>
1075- <field name="inherit_id" ref="hr_payroll.view_hr_payroll_register_tree"/>
1076- <field name="type">tree</field>
1077- <field name="arch" type="xml">
1078- <field name="state" position="before">
1079- <field name="journal_id" required="1"/>
1080- <field name="bank_journal_id" required="1"/>
1081- </field>
1082- </field>
1083- </record>
1084-
1085- <record model="ir.ui.view" id="view_hr_payroll_register_inherit_form">
1086- <field name="name">hr.payroll.register.inherit.form</field>
1087- <field name="model">hr.payroll.register</field>
1088- <field name="inherit_id" ref="hr_payroll.view_hr_payroll_register_form"/>
1089- <field name="type">form</field>
1090- <field name="arch" type="xml">
1091- <field name="number" position="after">
1092- <field name="journal_id" required="1"/>
1093- <field name="bank_journal_id" required="1"/>
1094- </field>
1095- </field>
1096- </record>
1097-
1098 <record model="ir.ui.view" id="hr_contibution_register_inherit_tree">
1099- <field name="name">hr.contibution.register.inherit.tree</field>
1100- <field name="model">hr.contibution.register</field>
1101- <field name="inherit_id" ref="hr_payroll.hr_contibution_register_tree"/>
1102+ <field name="name">hr.contribution.register.inherit.tree</field>
1103+ <field name="model">hr.contribution.register</field>
1104+ <field name="inherit_id" ref="hr_payroll.hr_contribution_register_tree"/>
1105 <field name="type">tree</field>
1106 <field name="arch" type="xml">
1107- <field name="monthly_total_by_comp" position="after">
1108+ <field name="name" position="after">
1109 <field name="yearly_total_by_emp"/>
1110 <field name="yearly_total_by_comp"/>
1111 </field>
1112@@ -139,45 +86,35 @@
1113 </record>
1114
1115 <record model="ir.ui.view" id="hr_contibution_register_inherit_form">
1116- <field name="name">hr.contibution.register.inherit.form</field>
1117- <field name="model">hr.contibution.register</field>
1118- <field name="inherit_id" ref="hr_payroll.hr_contibution_register_form"/>
1119+ <field name="name">hr.contribution.register.inherit.form</field>
1120+ <field name="model">hr.contribution.register</field>
1121+ <field name="inherit_id" ref="hr_payroll.hr_contribution_register_form"/>
1122 <field name="type">form</field>
1123 <field name="arch" type="xml">
1124- <field name="name" position="after">
1125- <field name="account_id" required="1"/>
1126- <field name="analytic_account_id"/>
1127- </field>
1128+ <xpath expr="/form/notebook" position="before">
1129+ <newline/>
1130+ <field name="account_id" />
1131+ <field name="analytic_account_id"/>
1132+ </xpath>
1133 </field>
1134 </record>
1135
1136- <record model="ir.ui.view" id="hr_contibution_register_inherit1_form">
1137- <field name="name">hr.contibution.register.inherit1.form</field>
1138- <field name="model">hr.contibution.register</field>
1139- <field name="inherit_id" ref="hr_payroll.hr_contibution_register_form"/>
1140+ <!-- <record model="ir.ui.view" id="hr_contibution_register_inherit1_form">
1141+ <field name="name">hr.contribution.register.inherit1.form</field>
1142+ <field name="model">hr.contribution.register</field>
1143+ <field name="inherit_id" ref="hr_payroll.hr_contribution_register_form"/>
1144 <field name="type">form</field>
1145 <field name="arch" type="xml">
1146- <group name="Month" position="after">
1147+ <xpath expr="/form/notebook" position="before">
1148 <group col="2" colspan="2">
1149+ <newline/>
1150 <separator colspan="4" string="Year"/>
1151 <field name="yearly_total_by_emp"/>
1152 <field name="yearly_total_by_comp"/>
1153 </group>
1154- </group>
1155- </field>
1156- </record>
1157-
1158- <record model="ir.ui.view" id="hr_contibution_register_line_inherit_form">
1159- <field name="name">hr.contibution.register.line.form.inherit</field>
1160- <field name="model">hr.contibution.register.line</field>
1161- <field name="inherit_id" ref="hr_payroll.hr_contibution_register_line_form"/>
1162- <field name="type">form</field>
1163- <field name="arch" type="xml">
1164- <field name="employee_id" position="after">
1165- <field name="period_id"/>
1166- </field>
1167- </field>
1168- </record>
1169+ </xpath>
1170+ </field>
1171+ </record>-->
1172
1173 <record id="view_hr_payslip_form_inherit" model="ir.ui.view">
1174 <field name="name">hr.payslip.form</field>
1175@@ -185,7 +122,7 @@
1176 <field name="type">form</field>
1177 <field name="inherit_id" ref="hr_payroll.view_hr_payslip_form"/>
1178 <field name="arch" type="xml">
1179- <page string="Other Informations" position="replace">
1180+ <xpath expr="/form/notebook/page[@string='Other Information']" position="replace">
1181 <page string="Accounting Details">
1182 <group col="4" colspan="3">
1183 <separator colspan="4" string="Accounting Informations"/>
1184@@ -203,37 +140,28 @@
1185 </field>
1186 </group>
1187 <group col="2" colspan="1">
1188- <separator colspan="2" string="Other Informations"/>
1189- <field name="paid" readonly="1"/>
1190- <field name="company_id"/>
1191- <field name="register_id"/>
1192- <field name="deg_id"/>
1193- <field name="contract_id" domain="[('employee_id','=',employee_id)]"/>
1194+ <separator colspan="4" string="Other Information"/>
1195+ <group col="5" colspan="2">
1196+ <field name="company_id" groups="base.group_multi_company" widget="selection"/>
1197+ <newline/>
1198+ <field name="paid" readonly="1"/>
1199+ </group>
1200 </group>
1201- <separator colspan="4" string="Description"/>
1202- <field name="note" colspan="4" nolabel="1"/>
1203+ <separator colspan="4" string="Notes"/>
1204+ <field name="note" colspan="4" nolabel="1"/>
1205 </page>
1206- </page>
1207- </field>
1208- </record>
1209-
1210- <record id="view_hr_payslip_form_inherit1" model="ir.ui.view">
1211- <field name="name">hr.payslip.form</field>
1212- <field name="model">hr.payslip</field>
1213- <field name="type">form</field>
1214- <field name="inherit_id" ref="view_hr_payslip_form_inherit"/>
1215- <field name="arch" type="xml">
1216- <notebook position="inside">
1217- <page string="Account Lines">
1218- <field name="move_line_ids" colspan="4" nolabel="1"/>
1219- </page>
1220- <page string="Payment Lines">
1221- <field name="move_payment_ids" colspan="4" nolabel="1"/>
1222- </page>
1223- </notebook>
1224- </field>
1225- </record>
1226-
1227+ <page string="Account Lines">
1228+ <field name="move_line_ids" colspan="4" nolabel="1"/>
1229+ </page>
1230+ <page string="Payment Lines">
1231+ <field name="move_payment_ids" colspan="4" nolabel="1"/>
1232+ </page>
1233+ <page string="Accounting Entries">
1234+ <field name="account_move_ids" colspan="4" nolabel="1"/>
1235+ </page>
1236+ </xpath>
1237+ </field>
1238+ </record>
1239
1240 <!-- Adding Account Properties to the Employee form -->
1241
1242@@ -251,5 +179,39 @@
1243 </field>
1244 </record>
1245
1246+ <!-- Adding Account fields to the Salary Rules -->
1247+
1248+ <record id="hr_salary_rule_form_inherit" model="ir.ui.view">
1249+ <field name="name">hr.salary.rule.form.inherit</field>
1250+ <field name="model">hr.salary.rule</field>
1251+ <field name="inherit_id" ref="hr_payroll.hr_salary_rule_form"/>
1252+ <field name="arch" type="xml">
1253+ <xpath expr="/form/notebook/page[@string='Child Rules']" position="after">
1254+ <page string="Accounting">
1255+ <field name="account_debit" />
1256+ <field name="account_credit"/>
1257+ <field name="analytic_account_id"/>
1258+ <field name="account_tax_id"/>
1259+ </page>
1260+ </xpath>
1261+ </field>
1262+ </record>
1263+
1264+ <!-- Contract View -->
1265+
1266+ <record id="hr_contract_form_inherit" model="ir.ui.view">
1267+ <field name="name">hr.contract.view.form.inherit</field>
1268+ <field name="model">hr.contract</field>
1269+ <field name="type">form</field>
1270+ <field name="inherit_id" ref="hr_contract.hr_contract_view_form"/>
1271+ <field name="arch" type="xml">
1272+ <xpath expr="/form/notebook/page/group/field[@name='advantages']" position="after">
1273+ <separator colspan="4" string="Accounting"/>
1274+ <field name="analytic_account_id"/>
1275+ <field name="journal_id"/>
1276+ </xpath>
1277+ </field>
1278+ </record>
1279+
1280 </data>
1281 </openerp>

Subscribers

People subscribed via source and target branches