Skip to content

Instantly share code, notes, and snippets.

View M4hd1BD's full-sized avatar
🤫
Grinding

Mahdi M4hd1BD

🤫
Grinding
View GitHub Profile
from odoo import models, fields, api
from odoo.exceptions import UserError
class SaleOrderLine(models.Model):
_inherit = "sale.order.line"
@api.model
def create(self, vals):
sale_order_line = super().create(vals)

Steps

  1. First prepare the data in the below format, note that the first one, Monday, is multi-slot and rest of them are single slot. So follow that for multi-slot.
{
    "monday" : {
        "enable" : "enable",
        "start" : {
                    "0" : "0:45",
                    "1" : "1:45"
@M4hd1BD
M4hd1BD / functions.php
Created May 1, 2022 09:17
Import Google Images with Directorist
// Import Google Content
function directorist_import_googlecontent($url = "", $post_id = 0)
{
if (!empty($url)) {
$data = directorist_file_get_contents_curl($url);
$wp_upload_dir = wp_upload_dir();
$attachment_id = 0;
$fp = $wp_upload_dir['basedir'] . '/logo-3.jpg';