[IMP] hr_government_relations, exp_ticket_request: add accounting approva

This commit is contained in:
Abdurrahman Saber 2025-11-02 15:05:09 +02:00
parent d06e689491
commit 34bccc0445
8 changed files with 100 additions and 33 deletions

View File

@ -15,9 +15,11 @@ class HrTicketing(models.Model):
STATE_SELECTION = [
('draft', _('Draft')),
('submit', _('Direct Manager')),
('accounting', _('Accounting Manager')),
('review', _('Government Relations')),
('confirm', _('HR Manager')),
('done', _('Financial Manager')),
('accounting_final', _('Accounting Manager')),
('done', _('Done')),
('refuse', _('Refused')),
# ('cancelled', _('Cancelled')),
]
@ -93,11 +95,17 @@ class HrTicketing(models.Model):
self.write({'state': 'submit'})
def review(self):
self.write({'state': 'accounting'})
def accounting(self):
self.write({'state': 'review'})
def confirm(self):
self.write({'state': 'confirm'})
def accounting_final(self):
self.write({'state': 'accounting_final'})
def action_done(self):
if self.cost_of_tickets > 0:
debit_line_vals = {

View File

@ -8,3 +8,8 @@ access_airline_agent,airline.agent,model_airline_agent,base.group_user,1,0,0,0
access_airline_agent_hr,airline.agent.manager,model_airline_agent,hr.group_hr_manager,1,1,1,1
access_hr_airline_city_user,hr_airline_city_user,model_hr_airline_city,base.group_user,1,0,0,0
access_hr_airline_city_manager,hr_airline_city_manager,model_hr_airline_city,hr.group_hr_manager,1,1,1,1
access_hr_ticket_request_accounting,hr.ticket.request.accounting,model_hr_ticket_request,hr_base.group_account_manager,1,1,1,1
access_hr_ticket_request_type_accounting,hr.ticket.request.type.accounting,model_hr_ticket_request_type,hr_base.group_account_manager,1,1,1,1
access_hr_airline_accounting,hr.airline.accounting,model_hr_airline,hr_base.group_account_manager,1,1,1,1
access_hr_airline_city_accounting,hr.airline.city.accounting,model_hr_airline_city,hr_base.group_account_manager,1,1,1,1
access_airline_agent_accounting,airline.agent.accounting,model_airline_agent,hr_base.group_account_manager,1,1,1,1
1 id name model_id:id group_id:id perm_read perm_write perm_create perm_unlink
8 access_airline_agent_hr airline.agent.manager model_airline_agent hr.group_hr_manager 1 1 1 1
9 access_hr_airline_city_user hr_airline_city_user model_hr_airline_city base.group_user 1 0 0 0
10 access_hr_airline_city_manager hr_airline_city_manager model_hr_airline_city hr.group_hr_manager 1 1 1 1
11 access_hr_ticket_request_accounting hr.ticket.request.accounting model_hr_ticket_request hr_base.group_account_manager 1 1 1 1
12 access_hr_ticket_request_type_accounting hr.ticket.request.type.accounting model_hr_ticket_request_type hr_base.group_account_manager 1 1 1 1
13 access_hr_airline_accounting hr.airline.accounting model_hr_airline hr_base.group_account_manager 1 1 1 1
14 access_hr_airline_city_accounting hr.airline.city.accounting model_hr_airline_city hr_base.group_account_manager 1 1 1 1
15 access_airline_agent_accounting airline.agent.accounting model_airline_agent hr_base.group_account_manager 1 1 1 1

View File

@ -20,20 +20,24 @@
<button name="review" states="submit" string="Direct Manager" type="object" class="oe_highlight"
groups="hr_base.group_division_manager"/>
<button name="refuse" states="submit" string="Refuse" type="object" class="oe_highlight"
groups="hr_base.group_division_manager"/>
<button name="accounting" states="accounting" string="Accounting Manager" type="object" class="oe_highlight"
groups="hr_base.group_account_manager"/>
<button name="confirm" states="review" string="Government Relations" type="object"
class="oe_highlight"
groups="hr_base.group_government_relations"/>
<button name="refuse" states="review" string="Refuse" type="object" class="oe_highlight"
groups="hr_base.group_government_relations"/>
<button name="action_done" states="confirm" string="HR Manager" type="object"
<button name="accounting_final" states="confirm" string="HR Manager" type="object"
class="oe_highlight"
groups="hr.group_hr_manager"/>
<button name="refuse" states="confirm" string="Refuse" type="object" class="oe_highlight"
groups="hr.group_hr_manager"/>
<button name="action_done" states="accounting_final" string="Financial Manager" type="object"
class="oe_highlight"
groups="hr_base.group_account_manager"/>
<button name="refuse" states="submit,accounting_final,confirm,review,accounting" string="Refuse" type="object" class="oe_highlight"
groups="hr.group_hr_manager,hr_base.group_government_relations,hr_base.group_account_manager,hr_base.group_division_manager"/>
<button name="re_draft" string="Re-Draft" type="object" class="oe_highlight"
states="refuse,done"

View File

@ -13,7 +13,9 @@ class hr_exit_return(models.Model):
("draft", "Draft"),
("request", "Employee Request"),
("send", "Direct Manager"),
("accounting", "Accounting Manager"),
("confirm", "Government Relations"),
("accounting_final", "Accounting Manager"),
("done", "Approved"),
("refuse", "Refuse")
], default='draft', tracking=True)
@ -88,7 +90,7 @@ class hr_exit_return(models.Model):
for item in self:
if item.account_move_id:
if item.account_move_id.state == 'draft':
item.account_move_id.state = 'canceled'
item.account_move_id.button_cancel()
item.account_move_id = False
self.state = 'draft'
else:
@ -106,7 +108,13 @@ class hr_exit_return(models.Model):
else:
self.state = 'done'
def accounting(self):
self.state = 'accounting'
def financial_manager(self):
self.state = 'accounting_final'
def accounting_final(self):
for item in self:
if item.on_employee_fair == False and item.cost > 0:
debit_line_vals = {
@ -129,11 +137,11 @@ class hr_exit_return(models.Model):
'ref': 'Exit and Return',
'line_ids': [(0, 0, debit_line_vals), (0, 0, credit_line_vals)],
'res_model': 'hr.exit.return',
'res_id': self.id
'res_id': item.id
})
self.account_move_id = move_id.id
item.account_move_id = move_id.id
self.state = 'done'
item.state = 'done'
def refuse(self):
self.state = 'refuse'

View File

@ -15,10 +15,12 @@ class hr_request_visa(models.Model):
("draft", "Draft"),
("request", "Employee Request"),
("send", "Direct Manager"),
("accounting", "Accounting Manager"),
("confirm", "Government Relations"),
("done", "HR Approve"),
("accounting_final", "Accounting Manager"),
("done", "Done"),
("refuse", "Refuse")
], default='draft', )
], default='draft', tracking=True)
religion = fields.Selection(selection=[('muslim', 'Muslim'), ('christian', 'Christian'), ('other', 'Other')],
default="muslim")
from_hr = fields.Boolean()
@ -70,10 +72,13 @@ class hr_request_visa(models.Model):
else:
self.state = 'draft'
def accounting(self):
self.state = 'accounting'
def hr_manager(self):
self.state = 'confirm'
def financial_manager(self):
def accounting_final(self):
for item in self:
if item.cost > 0:
debit_line_vals = {
@ -95,10 +100,13 @@ class hr_request_visa(models.Model):
'ref': 'Exit and Return',
'line_ids': [(0, 0, debit_line_vals), (0, 0, credit_line_vals)]
})
self.account_move_id = move_id.id
item.account_move_id = move_id.id
self.state = 'done'
def financial_manager(self):
self.state = 'accounting_final'
def refuse(self):
self.state = 'refuse'

View File

@ -9,3 +9,8 @@ hr_request_visa_emp,hr.request.visa.emp,model_hr_request_visa,base.group_user,1,
hr_request_visa_managr,hr.request.visa.manger,model_hr_request_visa,hr_base.group_division_manager,1,1,1,1
hr_request_visa_hr,hr.request.visa.hr,model_hr_request_visa,hr.group_hr_user,1,1,1,1
hr_request_visa_gov,hr.request.visa.gov,model_hr_request_visa,hr_base.group_government_relations,1,1,1,1
access_hr_exit_return_accounting,hr.exit.return.accounting,model_hr_exit_return,hr_base.group_account_manager,1,1,1,1
access_hr_renew_official_paper_accounting,hr.renew.official.paper.accounting,model_hr_renew_official_paper,hr_base.group_account_manager,1,1,1,1
access_hr_official_paper_line_accounting,hr.official.paper.line.accounting,model_hr_official_paper_line,hr_base.group_account_manager,1,1,1,1
access_hr_request_visa_accounting,hr.request.visa.accounting,model_hr_request_visa,hr_base.group_account_manager,1,1,1,1
1 id name model_id:id group_id/id perm_read perm_write perm_create perm_unlink
9 hr_request_visa_managr hr.request.visa.manger model_hr_request_visa hr_base.group_division_manager 1 1 1 1
10 hr_request_visa_hr hr.request.visa.hr model_hr_request_visa hr.group_hr_user 1 1 1 1
11 hr_request_visa_gov hr.request.visa.gov model_hr_request_visa hr_base.group_government_relations 1 1 1 1
12 access_hr_exit_return_accounting hr.exit.return.accounting model_hr_exit_return hr_base.group_account_manager 1 1 1 1
13 access_hr_renew_official_paper_accounting hr.renew.official.paper.accounting model_hr_renew_official_paper hr_base.group_account_manager 1 1 1 1
14 access_hr_official_paper_line_accounting hr.official.paper.line.accounting model_hr_official_paper_line hr_base.group_account_manager 1 1 1 1
15 access_hr_request_visa_accounting hr.request.visa.accounting model_hr_request_visa hr_base.group_account_manager 1 1 1 1
16

View File

@ -18,21 +18,37 @@
<button string="Direct Manager" name="send" type="object" class="oe_highlight" states="request"
groups="hr_base.group_division_manager"/>
<button string="Refuse" name="refuse" type="object" class="oe_highlight" states="request"
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="send"
groups="hr_base.group_government_relations"/>
<button string="Refuse" name="refuse" type="object" class="oe_highlight" states="send"
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="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?"/>
<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"
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="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?"/>
<field name="state" widget="statusbar"/>
</header>

View File

@ -21,18 +21,31 @@
<button string="Refuse" name="refuse" type="object" class="oe_highlight" states="request"
groups="hr_base.group_division_manager"/>
<button string="Government Relations" name="hr_manager" type="object" class="oe_highlight"
states="send"
groups="hr_base.group_government_relations"/>
<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"
states="accounting"
groups="hr_base.group_government_relations"/>
<button string="Refuse" name="refuse" 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="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?"/>
<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"
groups="hr.group_hr_user" confirm="Are you sure to Reset To Draft This Record?"/>
<field name="state" widget="statusbar"/>
</header>