This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Чтобы вызвать метод питона из JS нужно создать сессию: | |
var session = new openerp.Session(); | |
this.my_model = new openerp.Model(session, "product.attribute.value"); | |
var fff = this.my_model.call('pyth_met', []).done(function (result) { | |
this.cool1=result; | |
}); | |
var fff = this.my_model.call('pyth_met', []).then(function (result) { | |
this.cool2=result; | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
To select from one2mane like as from many2many table in form you can use: | |
<field name="estimate_ids" widget="many2many" ... | |
If you need only records with empty parent use: | |
<field name="estimate_ids" widget="many2many" domain="[('contract_id','=',False)]" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@api.model | |
def default_get(self, fields): | |
res = super(Report, self).default_get(fields) | |
if self._context.get('task_id', False): | |
res['task_id'] = self._context['task_id'] | |
task = self.env['project.task'].browse(res['task_id']) | |
brl = self.env['bm.report.lines'] | |
report_lines = [] | |
for l in task.pricing_ids: | |
report_line = brl.create({ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Если у поля флаг readonly не важно в самом поле или на виде, то в него не запишешь используя api.onchange | |
Надо использовать compute: | |
amount = fields.Float(string='Сметная стоимость', compute='_compute_amount', store=True) | |
@api.depends('pricing_ids') | |
def _compute_amount(self): | |
for rec in self: | |
amount_labor_cost = 0 | |
amount_mech_cost = 0 | |
for line in self.pricing_ids: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
instruction: | |
python migrate.py --config=/etc/odoo/8.py --database=ys --run-migrations=8.0 | |
https://blogs.teckzilla.net/2015/06/09/how-to-migrate-odoo-database-from-version-7-to-version-8/ | |
repos with migration script: | |
https://github.com/OCA/OpenUpgrade/tree/8.0 | |
important^ | |
Locate your /etc/postgresql/9.1/main/pg_hba.conf file, find the “local all all peer” line and change it to “local all all trust”, then reload postgresql |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pg_dump -t table_to_copy source_db | psql target_db | |
psql database_name < dump.bin | |
>psql | |
ALTER DATABASE zleb OWNER TO odoo8 ; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Суть в том чтобы сгенерировать хэш для известного пароля и записать его напрямую в таблицу. Можно через пгадмин. | |
from passlib.context import CryptContext | |
print CryptContext(['pbkdf2_sha512']).encrypt('MY_PASSWORD') | |
Then replace the hash in the database with the new one by running this SQL query (replace HASH by the result of the previous command) | |
UPDATE res_users SET password='', password_crypt='HASH' WHERE id=1; |
This file has been truncated, but you can view the full file.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="UTF-8" ?> | |
<API> | |
<Brand> | |
<ID>107</ID> | |
<Name>Acer</Name> | |
<Mobile> | |
<ID>8204</ID> | |
<Name>beTouch E110</Name> | |
<Photo>https://www.unlockbase.com/sdata/images/models/acer-betouch-e110-phone-unlock-code.png</Photo> | |
</Mobile> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def dump(obj): | |
for attr in dir(obj): | |
print "obj.%s = %s" % (attr, getattr(obj, attr)) | |
def dumpclean(obj): | |
if type(obj) == dict: | |
for k, v in obj.items(): | |
if hasattr(v, '__iter__'): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<record id="view_extends_filter" model="ir.ui.view"> | |
<field name="name">fleet_rental.document_extend.filter</field> | |
<field name="model">fleet_rental.document_extend</field> | |
<field name="arch" type="xml"> | |
<search string="Active"> | |
<field name="document_rent_id"/> | |
</search> | |
</field> | |
</record> |