[FIX]CRM Action new model methods to allow back to draft and set done

This commit is contained in:
Fabien BOURGEOIS 2017-11-23 07:12:16 +01:00
parent afbe61ed79
commit 7af4d4a609
4 changed files with 12 additions and 3 deletions

View File

@ -18,7 +18,7 @@
{
'name': 'CRM Actions',
'summary': 'Action management, instead of new activity, in CRM',
'version': '10.0.1.2.1',
'version': '10.0.1.2.2',
'category': 'Sales',
'author': 'Fabien BOURGEOIS - Yaltik',
'license': 'AGPL-3',

View File

@ -74,6 +74,15 @@ class CrmAction(models.Model):
details = u' '.join(action.details.split()[:5]) + details
action.display_name = u'[{}]{}'.format(action.action_type_name,
details)
@api.multi
def set_to_draft(self):
""" Set actions to draft """
self.write({'state': 'draft'})
@api.multi
def set_to_done(self):
""" Set actions to done """
self.write({'state': 'done'})
@api.multi
def create_linked_event(self):

View File

@ -52,4 +52,4 @@ class CrmLead(models.Model):
self.ensure_one()
lead = self[0]
if lead.next_action_id:
lead.next_action_id.confirm()
lead.next_action_id.set_to_done()

View File

@ -80,7 +80,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
<field name="lead_id" />
<field name="partner_id" />
<field name="user_id" />
<button icon="fa-check" name="confirm" type="object"
<button icon="fa-check" name="set_to_done" type="object"
string="Mark as Done" states="draft" />
<button icon="fa-undo" name="set_to_draft" type="object"
string="Back to Todo" states="done" />