×
An easy guide for ODOO & ManageTeamz Integration

An easy guide for ODOO & ManageTeamz Integration

1. Get started with Logging into Odoo. You can Create Company if you are new and Update your Company Information to initiate the process. 

2. Select the relevant Contact. The Address section will have the default Odoo Company Address which is provided at Company Info.

3. In order to perfect track the location, click on the company, Partner Assignation, and Geo Locate.

4. Geo Location works on real-time tracking with Google Maps. If in case you don’t have the application, you can install it.  

5. Once installed, you can move to General Settings, click on Geo Localization and pick the API for Google Place Map and enter the API Key provided.

6. Now you can add the following code into installation folder i.e” C:\Program Files (x86)\Odoo 13.0\server\odoo\addons\stock\models\stock_picking.py”

ADD In function  def button_validate(self):

order_id = self.read()[0][‘sale_id’][0]
product_id = self.read()[0][‘product_id’][0]
customer_data = self.env[‘sale.order’].search([(‘id’, ‘=’, order_id)]).read()[0]

order_id = customer_data[‘id’]
note = customer_data[‘note’]
status = ‘Unallocated’
#6.1 picktime (Pickup time=Current Time+7hours )and schedule (delivery= Current Time+ time 10hours ) can be customized down below.date1 = customer_data[‘create_date’] + timedelta(hours=5, minutes=35)
date2 = customer_data[‘create_date’] + timedelta(hours=7, minutes=35)
picktime = date2.strftime(“%Y-%m-%d %H:%M”)
date3 = customer_data[‘create_date’] + timedelta(hours=17, minutes=35)
schedule = date3.strftime(“%Y-%m-%d %H:%M”)


customer_name = self.partner_id.name
customer_number = self.partner_id.phone
customer_email = self.partner_id.email
customer_address = self.partner_id.contact_address
customer_lat = self.partner_id.partner_latitude
customer_long = self.partner_id.partner_longitude
company_data = self.company_id.read()[0]
val = self.env[‘res.partner’].search([(‘id’, ‘=’, self.company_id.id)])
company_lat = val.partner_latitude
company_long = val.partner_longitude
company_name = val.name
company_number = val.phone
company_email = val.email
company_address = val.contact_address
company_emp_ids = val.child_ids
product = self.env[‘product.product’].search([(‘id’, ‘=’, product_id)]).read()[0]
product_weight = product[‘weight’]
product_volume = product[‘volume’]
product_name = product[‘name’]

import requests
import json

#####################_new_order_#######################

url = “https://delivery.manageteamz.com/api/new_order”
headers = {
    ‘Content-Type’: ‘application/json’,
    ‘Authorization’: auth_token,
    ‘x-client-data’: ’66f107c88a7b471282e70b944ae2e9ed’
}
payload = {
    “data”: {
        “status”: status,
        “type”: 0,
        “method”: “Pickup”,
        “is_multidelivery”: False,
        “is_multipickup”: False,
        “schedule”: schedule,
        “picktime”: picktime,
        “loc_lat”: company_lat,
        “loc_lng”: company_long,
        “pickup_ladd”: company_lat,
        “pickup_long”: company_long,
        “sent_ladd”: 13.0826802,
        “geo_fence_meter”: 200,
        “time_requirement”: “”,
        “time_to_delivery”: “”,
        “sent_long”: 80.2707184,
        “showpick”: False,
        “showdeliv”: False,
        “multiple_delivery”: [
            {
                “schedule”: schedule,
                “order_id”: order_id,
                “delivery_notes”: note,
                “cust_name”: customer_name,
                “cust_phone”: customer_number,
                “cust_email”: customer_email,
                “cust_address”: customer_address,
                “loc_lat”: customer_lat,
                “loc_lng”: customer_long,
                “receiver_name”: customer_name
            }
        ],
        “multiple_pickup”: [
            {
                “picktime”: picktime,
                “pick_address”: company_address,
                “notes”: product_name,
                “pickup_ladd”: company_lat,
                “pickup_long”: company_long,
                “product_weight”: product_weight,
                “time_to_delivery”: “”,
                “time_requirement”: “”,
                “product_length”: “”,
                “product_height”: “”,
                “product_breadth”: “”
            }
        ],
        “delivery_logic”: “3”,
        “sender_name”: company_data[‘name’],
        “sender_number”: company_data[‘phone’],
        “sent_address”: company_address,
        “is_geo_fence”: 1
    },
    “geo_fence_meter”: 200,
    “sender_name”: company_data[‘name’]
}
resp = requests.post(url, headers=headers, json=payload)
print(‘——————————————-‘)
print(json.loads(resp.text))
print(‘——————————————-‘)

self.action_done()
return

################################################

7. Install the Sale and Inventory app in Odoo Apps.

8. Create Customers in the application whom the product has to be delivered by entering the relevant details of them.

9. Once the customer details are entered, it has to be assigned to a partner. Similarly, the customer address will be default as entered in Odoo Customer Address.

10. In order to create the Sales Order for the Customer, one should initially select the product, product quantity, and confirm Sales Order, Select the Delivery icon finally. The product which is placed in Odoo will be the same which will get delivered in ManageTeamz.

11. The Delivery product has to be validated. For that, you can click on Edit, and enter the total quantity of the product. Now click on the Validate option. 

12. Once everything fine, confirm whether the status of the delivery changed into “Done” so that the delivery process gets initiated.

13. Login into ManageTeamz(MT), Check whether the task was automatically created in the unallocated tab shown below.

 

14. Once the task is allocated to the driver, the driver picks up the product from the pickup location and delivers it to the delivery location. After delivering the task, the driver will change the status as “Completed.” 

15. In order to change the status in Odoo as “Delivered”, add the following code shown below ” C:\Program Files (x86)\Odoo 13.0\server\odoo\addons\stock\views\stock_picking_views.xml

<filter name=”delivered” string=”Delivered” domain=”[(‘state’, ‘=’, ‘delivered’)]” help=”delivered already processed”/>

<field name=”state” widget=”statusbar” statusbar_visible=”draft,confirmed,partially_available,assigned,done,delivered/>

Also add in i.e” C:\Program Files (x86)\Odoo 13.0\server\odoo\addons\stock\models\stock_picking.py”

state = fields.Selection([
    (‘draft’, ‘Draft’),
    (‘waiting’, ‘Waiting Another Operation’),
    (‘confirmed’, ‘Waiting’),
    (‘assigned’, ‘Ready’),
    (‘done’, ‘Done’),
    (‘delivered’, ‘Delivered’),
    (‘cancel’, ‘Cancelled’),
], string=‘Status’, compute=‘_compute_state’,

Leave a Reply

Your email address will not be published. Required fields are marked *

Subscribe to our Blog

Get latest articles straight to your inbox

Subscribe Now
X