
    |jU
                     ^    d dl mZmZmZmZ d dlmZ d dlmZ  G d dej                        Z
y)    )_apifieldsmodels)	UserError)
TRIP_TYPESc                      e Zd ZdZdZdZ ej                  ddd      Z ej                  dd      Z
 ej                  d	d      Z ej                  ed
d      Z ej                  d      Z ej                         Z ej                         Z ej&                  dd      Z ej*                         Z ej*                  d      Z ej*                         Zd Zy)HrBusinessTripWizarda  HR-only: create Business Trip requests for one or more employees at
    once. Unlike the employee self-service flow (Draft -> Submit -> Pending
    HR -> Acknowledged), each request created here goes straight to
    Acknowledged -- HR is authoring it directly, not reviewing an
    employee's own submission -- via hr.business.trip's own action_submit()/
    action_acknowledge() (not a raw state write), so the exact same
    validation and chatter trail apply. One hr.business.trip record per
    selected employee.zhr.business.trip.wizardz7Create Business Trip requests for one or more employeeszhr.employee	EmployeesT)stringrequiredz
Start DatezEnd DateTypez
Other Type)r   zres.countryCountryRequirementsc                    | j                          | j                  j                  s9| j                  j                  j	                  d      st        t        d            | j                  | j                  | j                  | j                  | j                  | j                  | j                  j                  | j                  | j                   | j"                  d
}| j                  d   }|j%                         }| j&                  D ]M  }|j)                  t+        ||j                              }|j-                          |j/                          ||z  }O dt        d      ddd	d
|j0                  fgdS )Nzhr.group_hr_userz3Only HR can create Business Trip requests this way.)
	date_fromdate_to	trip_typetrip_type_otheraddresscity
country_idreasonrequirements_descriptionremarkzhr.business.trip)employee_idzir.actions.act_windowzBusiness Tripsz	list,formidin)typename	res_model	view_modedomain)
ensure_oneenvsuuser	has_groupr   r   r   r   r   r   r   r   r   r   r   r   r   browseemployee_idscreatedictaction_submitaction_acknowledgeids)selfvals_commonTriptripsemployeetrips         ,xeno_leave/models/hr_business_trip_wizard.pyaction_createz"HrBusinessTripWizard.action_create    s/   txx}}667IJASTUU||#33||II//,,kk(,(E(Ekk
 xx*+)) 	H;;tKX[[IJD ##%TME		 ,&'+$dEII./
 	
    N)__name__
__module____qualname____doc___name_descriptionr   	Many2manyr*   Dater   r   	Selectionr   r   Charr   r   r   Many2oner   Textr   r   r   r7    r8   r6   r
   r
      s     &ELL#6##M+PTUL<$?Ifkkd;G   FTJI!fkk6OfkkmG6;;=D yAJV[[]F*v{{.AV[[]F
r8   r
   N)odoor   r   r   r   odoo.exceptionsr   3odoo.addons.xeno_attendance.models.hr_business_tripr   TransientModelr
   rE   r8   r6   <module>rJ      s#    ' ' % J6
600 6
r8   