Skip to content

Instantly share code, notes, and snippets.

BEGIN;
\set HELP_PID 49
INSERT INTO helpdesk_stage (id,name,sequence,fold,create_uid,create_date,write_uid,write_date) select id,name,sequence,fold,create_uid,create_date,write_uid,write_date from project_task_type where id in (select type_id from project_task_type_rel where project_id in (:HELP_PID));
--> insert team_id
insert into helpdesk_team(id,alias_id,message_last_post,name,company_id,sequence,color,create_uid,create_date,write_uid,write_date,assign_method) select :HELP_PID,31,p.message_last_post,a.name,a.company_id,p.sequence,p.color,p.create_uid,p.create_date,p.write_uid,p.write_date,'manual' from project_project as p inner join account_analytic_account as a ON a.id = p.analytic_account_id where p.id = :HELP_PID;
--> relation between teams and stages
insert into team_stage_rel (helpdesk_team_id,helpdesk_stage_id) select :HELP_PID,type_id from project_task_type_rel where project_id = :HELP_PID;
@Whenrow
Whenrow / update_rating.py
Last active November 27, 2019 19:26
Update ole rating
players = self.env['res.partner'].search([
('kicker_player', '=', True)
]).write({'ole_rating': 1500})
matches = self.env['kicker.game'].search([]).sorted('create_date')
for match in matches:
match._update_ole_rating()
@Whenrow
Whenrow / locust_picking.py
Last active February 12, 2020 08:33
locust scenario of 2 stock pickers (in and out)
from OdooLocust.OdooLocust import OdooLocust
from locust import task, TaskSet, between
class PickerTaskSet(TaskSet):
"""Common code for picker task set"""
def _prepare_move_vals(self, product, qty, picking, location, location_dest):
product_product_model = self.client.get_model('product.product')
return {
'name': product_product_model.read(product)['name'],
'product_id': product,