Skip to content

Instantly share code, notes, and snippets.

View ilyasProgrammer's full-sized avatar

Ilyas ilyasProgrammer

  • Sindelfingen
View GitHub Profile
@ilyasProgrammer
ilyasProgrammer / gist:5157d85fd1a1811510dd44412385bb8c
Created May 17, 2017 08:42
Odoo Schedule to run Server Actions
As everything in OpenERP, a server action is an object, and you want execute the method run
1. Create the server action you want to execute
2. Find its ID
You'll need the ID of the server action to pass as argument of your scheduled action. You can find it in several ways: select the action and look for id=<action_id> in the address bar, enable developer mode and select view_log in the developer options, find it in the database using psql or pgadmin...
3. Create the scheduled action
<!--
You can add field using editor. Also all fields is in black list for website posting by default.
To remove it from blacklist you will need to do stuff like this:
-->
<function model="ir.model.fields" name="formbuilder_whitelist">
<value>crm.lead</value>
<value eval="[
'contact_name',
'description',
@ilyasProgrammer
ilyasProgrammer / odoo_wt.md
Last active May 8, 2017 19:48
Odoo website template modifications

Как найти и где хранятся изменения внесенные в теплейты через редактор вебсайта.

Для odoo 10:

Темплейты хранятся в виде текста в поле arch_db в таблице ir_ui_view собранные с учетом внесенных с помощью эдитора изменений.

Можно выбрать так:

SELECT * 

from ir_ui_view as v

@ilyasProgrammer
ilyasProgrammer / move.py
Last active May 8, 2017 19:59
Odoo move records from one database to another
# put this file in Odoo root folder
# explample shows basics. creates partners in db2 using data of db1
import odoo
ODOO_CONF = '/pd/hiring/odoo.conf'
UID = odoo.SUPERUSER_ID
def part(env,env2):
dr docker run -it --entrypoint=/bin/bash $IMAGE -i
de docker exec -it $CONTAINER_ID /bin/bash
dp docker ps -a
dk docker kill [ID]
drm docker rm [ID]
@ilyasProgrammer
ilyasProgrammer / xml_forms.py
Last active May 8, 2017 19:49
Можно задавать применяемый форм вью используя метод
@api.multi
def get_formview_id(self):
return self.env.ref('kro.kro_problem_form').id
ORIGINAL:
http://www.surekhatech.com/blog/running-odoo-8-0-as-a-servi-2
https://www.linode.com/docs/websites/cms/install-odoo-9-erp-on-ubuntu-14-04
To run: sudo /etc/init.d/openerp-server start
xxx:~/mods/kro$ cat /etc/init.d/openerp-server
#!/bin/sh
### BEGIN INIT INFO
scp ~/.ssh/id_rsa.pub username@host:~/.ssh/authorized_keys
sudo openvpn --config blabla.ovpn
Копировать файл с сервера:
sudo scp user@172.****:/full/path/to/file /local/folder
-r для папки -P порт ssh
Acces right for correct acces using key:
chmod g-w /home/your_user
chmod 700 /home/your_user/.ssh
sudo grep -Hrn --include=*.xml 'inherit_id="website_sale.product" name="Product"' /home/kupixleb/
find . -name "*.pot" -type f -delete | xargs du -sh
du -sh
df -h
echo 'alias c="cd /opt"' >> ~/.bashrc
sources ~/.bashrc
Для вызова rpc должнен быть сеанс (юзеру нужно залогиниться)
Что бы работало без логина нужно вызывать �jsonrpc:
openerp.jsonRpc("/shop/ingredients", 'call', {
'prod_id': this.prod_id,
'value_id': this.value,
'value_name': value_name
}).then(function (result) {
this.ingredients = result['ingredients'];
$(".prod_ingred").text(result['prod_ingred']);