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
version: '3.3' | |
services: | |
# Web Application Service Definition | |
# -------- | |
# | |
# All of the information needed to start up an odoo web | |
# application container. | |
web: | |
image: odoo:12.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
[options] | |
addons_path = /mnt/extra-addons | |
db_user = odoo | |
db_password = odoo | |
logfile = /etc/odoo/odoo-server.log |
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
version: '3.3' | |
services: | |
# Web Application Service Definition | |
# -------- | |
# | |
# All of the information needed to start up an odoo web | |
# application container. | |
web: | |
image: odoo:16 |
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
# First you need to define a create method for the sequence number | |
class ExampleClass(models.Model): | |
_rec_name = 'sequence_number' | |
@api.model | |
def create(self, vals): | |
if vals.get('sequence_number', 'New') == 'New': | |
vals['sequence_number'] = self.env['ir.sequence'].next_by_code('mysequence.model') or 'New' | |
result = super(ExampleClass, self).create(vals) | |
return 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
# this block will create a stock_quant | |
# stock_quant is an on hand quantity inside certain location | |
create_quant = self.env['stock.quant'].with_context(inventory_mode=True).create({ | |
'product_id': self.product_id.id, | |
'location_id': self.location_destination.id, | |
'quantity': 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
# this block will create a stock move | |
# its recommended to put this inside a button method that checking availability | |
# ._action_confirm() will make this stock_move state to be confirmed | |
# ._action_assign() will assign this stock_move and reserve the available stock | |
stock_move = self.env['stock.move'].create({ | |
'name': 'stock_move_name', | |
'location_id': self.location_source.id, | |
'location_dest_id': self.location_destination.id, | |
'product_id': self.product.id, |
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
# .search usability is to find object inside a model | |
# this block below means "search product_id with value 5 inside sale_order table" | |
# in postgresql query this ORM block equal to "SELECT * FROM sale_order_lines WHERE product_id = 5" | |
# then show all result using FOR iteration, preventing singleton error | |
for result in self.env['sale.order.lines'].search([('product_id', '=', 5)]): | |
product_id = int(result.product_id) # Get result.product_id and assign in to product_id inside current class | |
price_unit = int(result.price_unit) # Get result.price_unit and assign in to price_unit inside current class | |
print(product_id) | |
print(price_unit) |
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
lower_case = "thequickfoxjumpedoverthelazydog" | |
# Created a new dictionary | |
lexicon = { | |
"a": "61", | |
"b": "62", | |
"c": "63", | |
"d": "64", | |
"e": "65", | |
"f": "66", |
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
# Add character inside list | |
list_numbers = ['001','002','003'] | |
add_percent = [pulled + "%" for pulled in list_numbers] | |
print(add_percent) | |
# The result will be ['001%','002%','003%'] | |
# Split each words with space | |
# Example 1 | |
the_string = 'silly walks' | |
for ix in range(len(the_string)): |
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
/* Check odoo version from sql : */ | |
SELECT latest_version FROM ir_module_module WHERE name = 'base'; | |
/* Check module license wheter it's Community or Enterprise ver " */ | |
SELECT license, count(*) FROM ir_module_module where state = 'installed' group by license; |
NewerOlder