~unifield-team/unifield-wm/us-826

« back to all changes in this revision

Viewing changes to msf_homere_interface/wizard/hr_payroll_import.py

  • Committer: jf
  • Date: 2014-01-14 07:53:33 UTC
  • mfrom: (1868.1.34 UF_2237)
  • Revision ID: jfb@tempo-consulting.fr-20140114075333-hmnqc97prb57w0rn
UF-2237 [IMP] Restrictions on accounts use in the interface
lp:~unifield-team/unifield-wm/UF_2237

Show diffs side-by-side

added added

removed removed

Lines of Context:
33
33
from tools import config
34
34
import time
35
35
import sys
 
36
from account_override import ACCOUNT_RESTRICTED_AREA
36
37
 
37
38
class hr_payroll_import_period(osv.osv):
38
39
    _name = 'hr.payroll.import.period'
133
134
        is_counterpart = False
134
135
        if third and third[0] and third[0] != '':
135
136
            is_counterpart = True
 
137
 
 
138
        # For non counterpart lines, check expected accounts
 
139
        if not is_counterpart:
 
140
            if not self.pool.get('account.account').search(cr, uid, ACCOUNT_RESTRICTED_AREA['payroll_lines'] + [('id', '=', account.id)]):
 
141
                raise osv.except_osv(_('Warning'), _('This account is not authorized: %s') % (account.code,))
 
142
 
136
143
        # If account is analytic-a-holic, fetch employee ID
137
144
        if account.is_analytic_addicted:
138
145
            # Add default destination from account