[IMP] crm,hr_recruitment,project: add 'Create and Edit' btn
This commit adds a 'Create and Edit' button in the footer of the dialog opened when creating a record from the Kanban of several models. Clicking on this button creates the record and directly opens it in a more detailled form view in edit mode.
This commit is contained in:
committed by
Aaron Bohy
parent
42757c120f
commit
98ceb0fd2d
@@ -421,6 +421,18 @@ class Lead(models.Model):
|
||||
def close_dialog(self):
|
||||
return {'type': 'ir.actions.act_window_close'}
|
||||
|
||||
@api.multi
|
||||
def edit_dialog(self):
|
||||
form_view = self.env.ref('crm.crm_case_form_view_oppor')
|
||||
return {
|
||||
'name': _('Opportunity'),
|
||||
'res_model': 'crm.lead',
|
||||
'res_id': self.id,
|
||||
'views': [(form_view.id, 'form'),],
|
||||
'type': 'ir.actions.act_window',
|
||||
'target': 'inline'
|
||||
}
|
||||
|
||||
# ----------------------------------------
|
||||
# Business Methods
|
||||
# ----------------------------------------
|
||||
|
||||
@@ -260,6 +260,7 @@
|
||||
</group>
|
||||
<footer>
|
||||
<button string="Create" name="close_dialog" type="object" class="btn-primary"/>
|
||||
<button string="Create & Edit" name="edit_dialog" type="object" class="btn-primary"/>
|
||||
<button string="Discard" class="btn-default" special="cancel"/>
|
||||
</footer>
|
||||
</sheet>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
||||
|
||||
from odoo import api, fields, models
|
||||
from odoo import api, fields, models, _
|
||||
|
||||
|
||||
class Job(models.Model):
|
||||
@@ -86,3 +86,15 @@ class Job(models.Model):
|
||||
@api.multi
|
||||
def close_dialog(self):
|
||||
return {'type': 'ir.actions.act_window_close'}
|
||||
|
||||
@api.multi
|
||||
def edit_dialog(self):
|
||||
form_view = self.env.ref('hr.view_hr_job_form')
|
||||
return {
|
||||
'name': _('Job'),
|
||||
'res_model': 'hr.job',
|
||||
'res_id': self.id,
|
||||
'views': [(form_view.id, 'form'),],
|
||||
'type': 'ir.actions.act_window',
|
||||
'target': 'inline'
|
||||
}
|
||||
|
||||
@@ -416,6 +416,7 @@
|
||||
</group>
|
||||
<footer>
|
||||
<button string="Create" name="close_dialog" type="object" class="btn-primary"/>
|
||||
<button string="Create & Edit" name="edit_dialog" type="object" class="btn-primary"/>
|
||||
<button string="Discard" class="btn-default" special="cancel"/>
|
||||
</footer>
|
||||
</sheet>
|
||||
|
||||
@@ -345,6 +345,18 @@ class Project(models.Model):
|
||||
def close_dialog(self):
|
||||
return {'type': 'ir.actions.act_window_close'}
|
||||
|
||||
@api.multi
|
||||
def edit_dialog(self):
|
||||
form_view = self.env.ref('project.edit_project')
|
||||
return {
|
||||
'name': _('Project'),
|
||||
'res_model': 'project.project',
|
||||
'res_id': self.id,
|
||||
'views': [(form_view.id, 'form'),],
|
||||
'type': 'ir.actions.act_window',
|
||||
'target': 'inline'
|
||||
}
|
||||
|
||||
|
||||
class Task(models.Model):
|
||||
_name = "project.task"
|
||||
|
||||
@@ -231,6 +231,7 @@
|
||||
</group>
|
||||
<footer>
|
||||
<button string="Create" name="close_dialog" type="object" class="btn-primary"/>
|
||||
<button string="Create & Edit" name="edit_dialog" type="object" class="btn-primary"/>
|
||||
<button string="Discard" class="btn-default" special="cancel"/>
|
||||
</footer>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user