This file contains 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 cmd_send_notification(self): | |
action = self.env.ref('module_name.id_of_custom_action_window') | |
return { | |
'type': 'ir.actions.client', | |
'tag': 'display_notification', | |
'params': { | |
'title': _('Your Custom Notification Title'), | |
'message': '%s', | |
'links': [{ | |
'label': self.customer_id.name, |
This file contains 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 selenium import webdriver | |
from webdriver_manager.chrome import ChromeDriverManager | |
from selenium.webdriver.common.keys import Keys | |
import time | |
import pandas as pd | |
import random | |
driver = webdriver.Chrome(executable_path=ChromeDriverManager().install()) | |
driver.maximize_window() | |
col_name = ['url'] |
This file contains 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
import string, random | |
from django.utils.text import slugify | |
def random_string_generator(size=10, chars=string.ascii_lowercase + string.digits): | |
return ''.join(random.choice(chars) for _ in range(size)) | |
def unique_slug_generator(instance, new_slug=None): | |
if new_slug is not None: | |
slug = new_slug | |
else: |
This file contains 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
base_url = self.env['ir.config_parameter'].get_param('web.base.url') | |
if not 'localhost' in base_url: | |
if 'http://' in base_url: | |
base_url = base_url.replace('http://', 'https://') | |
base_url = base_url + '/web#id=' + str(self.id) + '&model=your.model.goes.here&view_type=form&cids=' |
This file contains 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
class res_company(models.Model): | |
_inherit = 'res.company' | |
@api.multi | |
def generate_qr(self, txt=''): | |
qr_code = qrcode.QRCode(version=4, box_size=4, border=1) | |
qr_code.add_data(txt) | |
qr_code.make(fit=True) | |
qr_img = qr_code.make_image() | |
im = qr_img._img.convert("RGB") |
This file contains 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 cmd_send_notification(self): | |
return { | |
'type': 'ir.actions.client', | |
'tag': 'display_notification', | |
'params': { | |
'title': _('Your Custom Notification Title'), | |
'message': 'Your Custom Message...', | |
'sticky': False, | |
} | |
} |
This file contains 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
class some_model(models.Model): | |
_name = "some.model" | |
STATES = [('Draft','Draft'),('Submit','Submit'),('Closed','Closed')] | |
# States that should be folded in Kanban view | |
# used by the `state_groups` method | |
FOLDED_STATES = [ | |
'Closed', | |
] |
NewerOlder