[REF] hr_government_relations: revert accouting approval code & keep bug fixes
This commit is contained in:
parent
d1e5e7b568
commit
58179000b9
|
|
@ -13,9 +13,7 @@ class hr_exit_return(models.Model):
|
||||||
("draft", "Draft"),
|
("draft", "Draft"),
|
||||||
("request", "Employee Request"),
|
("request", "Employee Request"),
|
||||||
("send", "Direct Manager"),
|
("send", "Direct Manager"),
|
||||||
("accounting", "Accounting Manager"),
|
|
||||||
("confirm", "Government Relations"),
|
("confirm", "Government Relations"),
|
||||||
("accounting_final", "Accounting Manager"),
|
|
||||||
("done", "Approved"),
|
("done", "Approved"),
|
||||||
("refuse", "Refuse")
|
("refuse", "Refuse")
|
||||||
], default='draft', tracking=True)
|
], default='draft', tracking=True)
|
||||||
|
|
@ -108,14 +106,7 @@ class hr_exit_return(models.Model):
|
||||||
else:
|
else:
|
||||||
self.state = 'done'
|
self.state = 'done'
|
||||||
|
|
||||||
def accounting(self):
|
|
||||||
self.state = 'accounting'
|
|
||||||
return self._reset_to_action()
|
|
||||||
|
|
||||||
def financial_manager(self):
|
def financial_manager(self):
|
||||||
self.state = 'accounting_final'
|
|
||||||
|
|
||||||
def accounting_final(self):
|
|
||||||
for item in self:
|
for item in self:
|
||||||
if item.on_employee_fair == False and item.cost > 0:
|
if item.on_employee_fair == False and item.cost > 0:
|
||||||
debit_line_vals = {
|
debit_line_vals = {
|
||||||
|
|
@ -143,15 +134,9 @@ class hr_exit_return(models.Model):
|
||||||
item.account_move_id = move_id.id
|
item.account_move_id = move_id.id
|
||||||
|
|
||||||
item.state = 'done'
|
item.state = 'done'
|
||||||
|
|
||||||
def refuse(self):
|
def refuse(self):
|
||||||
self.state = 'refuse'
|
self.state = 'refuse'
|
||||||
|
|
||||||
def _reset_to_action(self):
|
|
||||||
if not self.env.user.has_group('hr_base.group_account_manager'):
|
|
||||||
return
|
|
||||||
return self.env.ref('hr_government_relations.exit_and_return_action').sudo().read()[0]
|
|
||||||
|
|
||||||
# overrite unlink function
|
# overrite unlink function
|
||||||
def unlink(self):
|
def unlink(self):
|
||||||
for i in self:
|
for i in self:
|
||||||
|
|
|
||||||
|
|
@ -15,12 +15,10 @@ class hr_request_visa(models.Model):
|
||||||
("draft", "Draft"),
|
("draft", "Draft"),
|
||||||
("request", "Employee Request"),
|
("request", "Employee Request"),
|
||||||
("send", "Direct Manager"),
|
("send", "Direct Manager"),
|
||||||
("accounting", "Accounting Manager"),
|
|
||||||
("confirm", "Government Relations"),
|
("confirm", "Government Relations"),
|
||||||
("accounting_final", "Accounting Manager"),
|
("done", "HR Approve"),
|
||||||
("done", "Done"),
|
|
||||||
("refuse", "Refuse")
|
("refuse", "Refuse")
|
||||||
], default='draft', tracking=True)
|
], default='draft', )
|
||||||
religion = fields.Selection(selection=[('muslim', 'Muslim'), ('christian', 'Christian'), ('other', 'Other')],
|
religion = fields.Selection(selection=[('muslim', 'Muslim'), ('christian', 'Christian'), ('other', 'Other')],
|
||||||
default="muslim")
|
default="muslim")
|
||||||
from_hr = fields.Boolean()
|
from_hr = fields.Boolean()
|
||||||
|
|
@ -72,14 +70,10 @@ class hr_request_visa(models.Model):
|
||||||
else:
|
else:
|
||||||
self.state = 'draft'
|
self.state = 'draft'
|
||||||
|
|
||||||
def accounting(self):
|
|
||||||
self.state = 'accounting'
|
|
||||||
return self._reset_to_action()
|
|
||||||
|
|
||||||
def hr_manager(self):
|
def hr_manager(self):
|
||||||
self.state = 'confirm'
|
self.state = 'confirm'
|
||||||
|
|
||||||
def accounting_final(self):
|
def financial_manager(self):
|
||||||
for item in self:
|
for item in self:
|
||||||
if item.cost > 0:
|
if item.cost > 0:
|
||||||
debit_line_vals = {
|
debit_line_vals = {
|
||||||
|
|
@ -105,17 +99,9 @@ class hr_request_visa(models.Model):
|
||||||
|
|
||||||
self.state = 'done'
|
self.state = 'done'
|
||||||
|
|
||||||
def financial_manager(self):
|
|
||||||
self.state = 'accounting_final'
|
|
||||||
|
|
||||||
def refuse(self):
|
def refuse(self):
|
||||||
self.state = 'refuse'
|
self.state = 'refuse'
|
||||||
|
|
||||||
def _reset_to_action(self):
|
|
||||||
if not self.env.user.has_group('hr_base.group_account_manager'):
|
|
||||||
return
|
|
||||||
return self.env.ref('hr_government_relations.request_visa_action').sudo().read()[0]
|
|
||||||
|
|
||||||
def unlink(self):
|
def unlink(self):
|
||||||
for i in self:
|
for i in self:
|
||||||
if i.state != 'draft':
|
if i.state != 'draft':
|
||||||
|
|
|
||||||
|
|
@ -58,20 +58,6 @@
|
||||||
<field name="groups" eval="[(4, ref('hr_base.group_department_manager')),(4, ref('hr_base.group_division_manager'))]"/>
|
<field name="groups" eval="[(4, ref('hr_base.group_department_manager')),(4, ref('hr_base.group_division_manager'))]"/>
|
||||||
</record>
|
</record>
|
||||||
|
|
||||||
<record id="hr_exit_return_accounting_manager_rule" model="ir.rule">
|
|
||||||
<field name="name">Accounting Manager: views Exit and Return that needs approval</field>
|
|
||||||
<field name="model_id" ref="model_hr_exit_return"/>
|
|
||||||
<field name="domain_force">['|',('state','in',['refuse', 'send','accounting_final', 'done']),('employee_id.user_id','=',user.id)]</field>
|
|
||||||
<field name="groups" eval="[(4, ref('hr_base.group_account_manager'))]"/>
|
|
||||||
</record>
|
|
||||||
|
|
||||||
<record id="hr_request_visa_accounting_manager_rule" model="ir.rule">
|
|
||||||
<field name="name">Accounting Manager: views Request Visa that needs approval</field>
|
|
||||||
<field name="model_id" ref="model_hr_request_visa"/>
|
|
||||||
<field name="domain_force">['|',('state','in',['refuse', 'send','accounting_final', 'done']),('employee_id.user_id','=',user.id)]</field>
|
|
||||||
<field name="groups" eval="[(4, ref('hr_base.group_account_manager'))]"/>
|
|
||||||
</record>
|
|
||||||
|
|
||||||
<record id="hr_request_visaall_rule" model="ir.rule">
|
<record id="hr_request_visaall_rule" model="ir.rule">
|
||||||
<field name="name"> Manager: views Request Visa of all employee </field>
|
<field name="name"> Manager: views Request Visa of all employee </field>
|
||||||
<field name="model_id" ref="model_hr_request_visa"/>
|
<field name="model_id" ref="model_hr_request_visa"/>
|
||||||
|
|
|
||||||
|
|
@ -18,37 +18,21 @@
|
||||||
|
|
||||||
<button string="Direct Manager" name="send" type="object" class="oe_highlight" states="request"
|
<button string="Direct Manager" name="send" type="object" class="oe_highlight" states="request"
|
||||||
groups="hr_base.group_division_manager"/>
|
groups="hr_base.group_division_manager"/>
|
||||||
|
|
||||||
<button string="Accounting Manager" name="accounting" type="object" class="oe_highlight" states="send"
|
|
||||||
groups="hr_base.group_account_manager"/>
|
|
||||||
|
|
||||||
<button string="Government Relations" name="hr_manager" type="object" class="oe_highlight"
|
|
||||||
states="accounting"
|
|
||||||
groups="hr_base.group_government_relations"/>
|
|
||||||
|
|
||||||
|
|
||||||
<button string="HR Manager" name="financial_manager" class="oe_highlight" type="object"
|
|
||||||
states="confirm"
|
|
||||||
groups="hr.group_hr_user,hr.group_hr_manager"/>
|
|
||||||
|
|
||||||
<button string="Accounting Manager" name="accounting_final" type="object" class="oe_highlight"
|
|
||||||
states="accounting_final"
|
|
||||||
groups="hr_base.group_account_manager"/>
|
|
||||||
|
|
||||||
<button string="Refuse" name="refuse" type="object" class="oe_highlight" states="accounting"
|
|
||||||
groups="hr_base.group_government_relations"/>
|
|
||||||
<button string="Refuse" name="refuse" type="object" class="oe_highlight" states="accounting_final"
|
|
||||||
groups="hr_base.group_account_manager"/>
|
|
||||||
<button string="Refuse" name="refuse" type="object" class="oe_highlight" states="request"
|
<button string="Refuse" name="refuse" type="object" class="oe_highlight" states="request"
|
||||||
groups="hr_base.group_division_manager"/>
|
groups="hr_base.group_division_manager"/>
|
||||||
<button string="Refuse" name="refuse" type="object" class="oe_highlight" states="send"
|
|
||||||
groups="hr_base.group_account_manager"/>
|
|
||||||
<button string="Refuse" name="refuse" type="object" class="oe_highlight" states="confirm"
|
|
||||||
groups="hr.group_hr_user,hr.group_hr_manager"/>
|
|
||||||
|
|
||||||
|
<button string="Government Relations" name="hr_manager" type="object" class="oe_highlight"
|
||||||
|
states="send"
|
||||||
|
groups="hr_base.group_government_relations"/>
|
||||||
|
<button string="Refuse" name="refuse" type="object" class="oe_highlight" states="send"
|
||||||
|
groups="hr_base.group_government_relations"/>
|
||||||
|
<button string="HR Manager" name="financial_manager" class="oe_highlight" type="object"
|
||||||
|
states="confirm"
|
||||||
|
groups="hr.group_hr_user, hr.group_hr_manager"/>
|
||||||
<button string="Re-draft" name="draft" type="object" class="oe_highlight" states="refuse,done"
|
<button string="Re-draft" name="draft" type="object" class="oe_highlight" states="refuse,done"
|
||||||
groups="hr.group_hr_user" confirm="Are you sure to Reset To Draft This Record?"/>
|
groups="hr.group_hr_user" confirm="Are you sure to Reset To Draft This Record?"/>
|
||||||
|
<button string="Refuse" name="refuse" type="object" class="oe_highlight" states="confirm"
|
||||||
|
groups="hr.group_hr_user, hr.group_hr_manager"/>
|
||||||
<field name="state" widget="statusbar"/>
|
<field name="state" widget="statusbar"/>
|
||||||
|
|
||||||
</header>
|
</header>
|
||||||
|
|
@ -91,15 +75,15 @@
|
||||||
<field name="exit_return_type" string="Exit Return Type"
|
<field name="exit_return_type" string="Exit Return Type"
|
||||||
attrs="{'readonly':[('state','!=','draft')]}"/>
|
attrs="{'readonly':[('state','!=','draft')]}"/>
|
||||||
<field name="on_employee_fair" string="On Employee Fair"
|
<field name="on_employee_fair" string="On Employee Fair"
|
||||||
attrs="{'readonly':[('state','!=','accounting')],'required':[('state','=','accounting')]}"/>
|
attrs="{'readonly':[('state','!=','send')],'required':[('state','=','send')]}"/>
|
||||||
<field name="cost" string="Cost"
|
<field name="cost" string="Cost"
|
||||||
attrs="{'readonly':[('state','!=','accounting')],'required':[('state','=','accounting')]}"/>
|
attrs="{'readonly':[('state','!=','send')],'required':[('state','=','send')]}"/>
|
||||||
<field name="account_journal_id" string="Journal"
|
<field name="account_journal_id" string="Journal"
|
||||||
attrs="{'readonly':[('state','!=','accounting_final')],'invisible':[('on_employee_fair','=',True)],
|
attrs="{'readonly':[('state','!=','confirm')],'invisible':[('on_employee_fair','=',True)],
|
||||||
'required':[('state','=','accounting_final'),('on_employee_fair','=',False)]}"/>
|
'required':[('state','=','confirm'),('on_employee_fair','=',False)]}"/>
|
||||||
<field name="account_debit_id" string="Account"
|
<field name="account_debit_id" string="Account"
|
||||||
attrs="{'readonly':[('state','!=','accounting_final')],'invisible':[('on_employee_fair','=',True)],
|
attrs="{'readonly':[('state','!=','confirm')],'invisible':[('on_employee_fair','=',True)],
|
||||||
'required':[('state','=','accounting_final'),('on_employee_fair','=',False)]}"/>
|
'required':[('state','=','confirm'),('on_employee_fair','=',False)]}"/>
|
||||||
<field name="account_move_id" string="Account move" readonly="1"
|
<field name="account_move_id" string="Account move" readonly="1"
|
||||||
attrs="{'invisible':[('on_employee_fair','=',True)]}"/>
|
attrs="{'invisible':[('on_employee_fair','=',True)]}"/>
|
||||||
</group>
|
</group>
|
||||||
|
|
|
||||||
|
|
@ -21,31 +21,18 @@
|
||||||
<button string="Refuse" name="refuse" type="object" class="oe_highlight" states="request"
|
<button string="Refuse" name="refuse" type="object" class="oe_highlight" states="request"
|
||||||
groups="hr_base.group_division_manager"/>
|
groups="hr_base.group_division_manager"/>
|
||||||
|
|
||||||
<button string="Accounting Manager" name="accounting" type="object" class="oe_highlight" states="send"
|
|
||||||
groups="hr_base.group_account_manager"/>
|
|
||||||
|
|
||||||
<button string="Refuse" name="refuse" type="object" class="oe_highlight" states="send"
|
|
||||||
groups="hr_base.group_account_manager"/>
|
|
||||||
|
|
||||||
<button string="Government Relations" name="hr_manager" type="object" class="oe_highlight"
|
<button string="Government Relations" name="hr_manager" type="object" class="oe_highlight"
|
||||||
states="accounting"
|
states="send"
|
||||||
groups="hr_base.group_government_relations"/>
|
groups="hr_base.group_government_relations"/>
|
||||||
<button string="Refuse" name="refuse" type="object" class="oe_highlight" states="accounting"
|
<button string="Refuse" name="refuse" type="object" class="oe_highlight" states="send"
|
||||||
groups="hr_base.group_government_relations"/>
|
groups="hr_base.group_government_relations"/>
|
||||||
|
|
||||||
<button string="HR Manager" name="financial_manager" class="oe_highlight" type="object"
|
<button string="HR Manager" name="financial_manager" class="oe_highlight" type="object"
|
||||||
states="confirm"
|
states="confirm"
|
||||||
groups="hr.group_hr_user, hr.group_hr_manager"/>
|
groups="hr.group_hr_user, hr.group_hr_manager"/>
|
||||||
<button string="Refuse" name="refuse" type="object" class="oe_highlight" states="confirm"
|
|
||||||
groups="hr.group_hr_user, hr.group_hr_manager"/>
|
|
||||||
|
|
||||||
<button string="Accounting Manager" name="accounting_final" type="object" class="oe_highlight" states="accounting_final"
|
|
||||||
groups="hr_base.group_account_manager"/>
|
|
||||||
<button string="Refuse" name="refuse" type="object" class="oe_highlight" states="accounting_final"
|
|
||||||
groups="hr_base.group_account_manager"/>
|
|
||||||
|
|
||||||
<button string="Re-draft" name="draft" type="object" class="oe_highlight" states="refuse,done"
|
<button string="Re-draft" name="draft" type="object" class="oe_highlight" states="refuse,done"
|
||||||
groups="hr.group_hr_user" confirm="Are you sure to Reset To Draft This Record?"/>
|
groups="hr.group_hr_user" confirm="Are you sure to Reset To Draft This Record?"/>
|
||||||
|
<button string="Refuse" name="refuse" type="object" class="oe_highlight" states="confirm"
|
||||||
|
groups="hr.group_hr_user, hr.group_hr_manager"/>
|
||||||
<field name="state" widget="statusbar"/>
|
<field name="state" widget="statusbar"/>
|
||||||
|
|
||||||
</header>
|
</header>
|
||||||
|
|
@ -109,11 +96,11 @@
|
||||||
|
|
||||||
</group>
|
</group>
|
||||||
<group>
|
<group>
|
||||||
<field name="cost" string="Cost" attrs="{'readonly':[('state','!=','accounting')]}"/>
|
<field name="cost" string="Cost" attrs="{'readonly':[('state','!=','send')]}"/>
|
||||||
<field name="account_journal_id" string="Journal"
|
<field name="account_journal_id" string="Journal"
|
||||||
attrs="{'readonly':[('state','!=','accounting_final')],'required':['&',('cost','>', '0' ),('state','=','accounting_final')]}"/>
|
attrs="{'readonly':[('state','!=','confirm')],'required':['&',('cost','>', '0' ),('state','=','confirm')]}"/>
|
||||||
<field name="account_debit_id" string="Account"
|
<field name="account_debit_id" string="Account"
|
||||||
attrs="{'readonly':[('state','!=','accounting_final')],'required':['&',('cost','>', '0' ),('state','=','accounting_final')]}"/>
|
attrs="{'readonly':[('state','!=','confirm')],'required':['&',('cost','>', '0' ),('state','=','confirm')]}"/>
|
||||||
<field name="account_move_id" string="Account move" readonly="1"/>
|
<field name="account_move_id" string="Account move" readonly="1"/>
|
||||||
</group>
|
</group>
|
||||||
</group>
|
</group>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue