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

Proposed by Meera Trambadia (OpenERP)
Status: Rejected
Rejected by: qdp (OpenERP)
Proposed branch: lp:~openerp-dev/openobject-addons/trunk-payroll-account-mtr
Merge into: lp:~openerp-dev/openobject-addons/trunk-payroll
Diff against target: 1269 lines (+448/-373)
5 files modified
hr_payroll/hr_payroll.py (+3/-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)
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) Approve
qdp (OpenERP) Pending
Review via email: mp+60745@code.launchpad.net

This proposal supersedes 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 : Posted in a previous version of this proposal

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 : Posted in a previous version of this proposal

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

Revision history for this message
Meera Trambadia (OpenERP) (mtr-openerp) wrote : Posted in a previous version of this proposal

Hello sir,

I have made changes as described above.

Thanks
mtr

Revision history for this message
Mustufa Rangwala (Open ERP) (mra-tinyerp) wrote : Posted in a previous version of this proposal

Conflicts detected in your merge proposal.

review: Needs Fixing
Revision history for this message
Mustufa Rangwala (Open ERP) (mra-tinyerp) wrote : Posted in a previous version of this proposal

Whatever done in the merge seems ok.
I approve the branch an i let the Quentin (qdp) to review it completely.

thanks,
mra

review: Approve
Revision history for this message
Mustufa Rangwala (Open ERP) (mra-tinyerp) :
review: Approve
Revision history for this message
qdp (OpenERP) (qdp) wrote :

i merged another branch that i made but which is based on this one. so i'm rejecting this merge proposal to clear my pending merge to do list

Thanks

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

Subscribers

People subscribed via source and target branches