diff --git a/laundary_mgt/__manifest__.py b/laundary_mgt/__manifest__.py index acf6984..9be5e80 100644 --- a/laundary_mgt/__manifest__.py +++ b/laundary_mgt/__manifest__.py @@ -9,13 +9,14 @@ 'description': """ This module contains all the common features of Laundary Management. """, - 'depends': ['sale','sale_timesheet'], + 'depends': ['sale','sale_timesheet','crm'], 'data': [ 'security/ir.model.access.csv', 'data/ir_sequence_data.xml', 'views/sale_views.xml', 'views/sale_views.xml', 'views/project_task_view.xml', + 'views/crm_lead_view.xml', ], 'demo': [ ], diff --git a/laundary_mgt/models/__init__.py b/laundary_mgt/models/__init__.py index 2168351..29f5086 100644 --- a/laundary_mgt/models/__init__.py +++ b/laundary_mgt/models/__init__.py @@ -2,3 +2,4 @@ # Part of Odoo. See LICENSE file for full copyright and licensing details. from . import sale +from . import crm_lead diff --git a/laundary_mgt/models/__pycache__/__init__.cpython-36.pyc b/laundary_mgt/models/__pycache__/__init__.cpython-36.pyc index 7a239a6..c4d9d9c 100644 Binary files a/laundary_mgt/models/__pycache__/__init__.cpython-36.pyc and b/laundary_mgt/models/__pycache__/__init__.cpython-36.pyc differ diff --git a/laundary_mgt/models/__pycache__/crm_lead.cpython-36.pyc b/laundary_mgt/models/__pycache__/crm_lead.cpython-36.pyc new file mode 100644 index 0000000..f137526 Binary files /dev/null and b/laundary_mgt/models/__pycache__/crm_lead.cpython-36.pyc differ diff --git a/laundary_mgt/models/__pycache__/sale.cpython-36.pyc b/laundary_mgt/models/__pycache__/sale.cpython-36.pyc index 3fd9fa9..b46e0a3 100644 Binary files a/laundary_mgt/models/__pycache__/sale.cpython-36.pyc and b/laundary_mgt/models/__pycache__/sale.cpython-36.pyc differ diff --git a/laundary_mgt/models/crm_lead.py b/laundary_mgt/models/crm_lead.py new file mode 100644 index 0000000..7dc0379 --- /dev/null +++ b/laundary_mgt/models/crm_lead.py @@ -0,0 +1,38 @@ +# -*- coding: utf-8 -*- +# Part of Odoo. See LICENSE file for full copyright and licensing details. + +import logging +import threading +from psycopg2 import sql +from datetime import datetime, timedelta, date +from dateutil.relativedelta import relativedelta + +from odoo import api, fields, models, tools, SUPERUSER_ID +from odoo.tools.translate import _ +from odoo.tools import email_re, email_split +from odoo.exceptions import UserError, AccessError +from odoo.addons.phone_validation.tools import phone_validation +from collections import OrderedDict, defaultdict + + + + +class Lead(models.Model): + _inherit = "crm.lead" + + create_task = fields.Boolean(string='create task', default=False, copy=False) + + def action_create_task(self): + for rec in self: + rec.create_task = True + task_ids = self.env['project.task'].create({ + 'project_id': 2, + 'partner_id': rec.partner_id.id, + 'user_id': '', + 'name': rec.name, + 'crm_id':self.id, + 'is_fsm':True, + + }) + + diff --git a/laundary_mgt/models/sale.py b/laundary_mgt/models/sale.py index 1b42a65..b2bb635 100644 --- a/laundary_mgt/models/sale.py +++ b/laundary_mgt/models/sale.py @@ -70,6 +70,7 @@ class ProjectTask(models.Model): color = fields.Many2one('color.type', string='Color', related='sale_line_id.color') tracking_code = fields.Char(string='Tracking Code',related='sale_line_id.tracking_code') remark = fields.Text('Remark',copy=False, related='sale_line_id.remark') + crm_id = fields.Many2one('crm.lead', string='Crm Id') class Project(models.Model): _inherit = "project.project" @@ -85,4 +86,4 @@ class Project(models.Model): class ProjectTaskType(models.Model): _inherit = 'project.task.type' - all_project_check = fields.Boolean(string='Check Track code', default=False, copy=False) \ No newline at end of file + all_project_check = fields.Boolean(string='Show All Project', default=False, copy=False) \ No newline at end of file diff --git a/laundary_mgt/views/crm_lead_view.xml b/laundary_mgt/views/crm_lead_view.xml new file mode 100644 index 0000000..b1a60b2 --- /dev/null +++ b/laundary_mgt/views/crm_lead_view.xml @@ -0,0 +1,16 @@ + + + + crm.lead.form.view.inherit + crm.lead + + + + + +