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
# Copyright (c) 1993-2009 Microsoft Corp. | |
# | |
# This is a sample HOSTS file used by Microsoft TCP/IP for Windows. | |
# | |
# This file contains the mappings of IP addresses to host names. Each | |
# entry should be kept on an individual line. The IP address should | |
# be placed in the first column followed by the corresponding host name. | |
# The IP address and the host name should be separated by at least one | |
# space. | |
# |
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
# -*- coding: utf-8 -*- | |
from odoo import fields, models, api | |
class Config(models.TransientModel): | |
_name = 'mylib.config' | |
_inherit = 'res.config.settings' | |
_description = 'My Library Config' |
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"?> | |
<odoo> | |
<data> | |
<record id="employee_book_loan_create" model="ir.rule"> | |
<field name="name">Nhân viên chỉ thấy phiếu mượn do mình tạo</field> | |
<field name="model_id" ref="model_mylib_book_loan"/> | |
<field name="domain_force">[('create_uid', '=', user.id)]</field> | |
<field name="perm_write" eval="0"/> | |
<field name="perm_create" eval="0"/> |
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
# -*- coding: utf-8 -*- | |
from odoo import fields, models | |
class TestDomain(models.Model): | |
_name = 'test.domain' | |
_description = 'domain test' | |
_rec_name = 'book' | |
book = fields.Many2one("mylib.book", 'Sách của tôi', domain=[]) |
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"?> | |
<odoo> | |
<data> | |
<record id="domain_act" model="ir.actions.act_window"> | |
<field name="name">Domain test</field> | |
<field name="type">ir.actions.act_window</field> | |
<field name="res_model">test.domain</field> | |
<field name="view_mode">form</field> | |
</record> |
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"?> | |
<odoo noupdate='1'> | |
<record id="lost_document_email_templates" model="mail.template"> | |
<field name="name">Mẫu email: Thông báo về thất lạc hồ sơ</field> | |
<field name="email_from"> | |
${object.partner_id.company_id and object.partner_id.company_id.email or ''} | |
</field> | |
<field name="subject">Thông báo về việc thất lạc hồ sơ: ${object.name} | |
</field> | |
<field name="email_to">${object.partner_id.email|safe}</field> |
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
#include <iostream> | |
using namespace std; | |
void nhapmang(int a[], int n) { | |
for (int i = 0; i < n; i++) { | |
cout << "Nhap a[" << i << "]="; | |
cin >> a[i]; | |
} | |
} | |
void xuatmang(int a[], int n) { |
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 create_user(self, name, email, pwd): | |
info = { 'name': name, | |
'login': email, | |
'password': pwd,} | |
try: | |
self.env['res.users'].sudo().create(info) | |
return True | |
except: | |
return 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
{ | |
"name": "Python: Odoo", | |
"type": "python", | |
"request": "launch", | |
"stopOnEntry": false, | |
"pythonPath": "${config:python.pythonPath}", | |
"program": "${workspaceRoot}/odoo-bin", | |
"args": [ | |
"--config=../odoo.conf", | |
], |
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 get_selection_name(env, model, field, value): | |
return dict(env[model].fields_get(field, 'selection').get(field, {}).get('selection',{})).get(value) | |
# usage | |
get_selection_name(request.env, 'sale.order', 'general_status', 'picking') # 'Đang lấy hàng' | |
get_selection_name(self.env, 'sale.order', 'general_status', 'picking') # 'Đang lấy hàng' |