Skip to content

Instantly share code, notes, and snippets.

View 3mrdev's full-sized avatar
👨‍💻
Messing things up

Amr Abd-Alkrim 3mrdev

👨‍💻
Messing things up
View GitHub Profile
@3mrdev
3mrdev / utils.py
Last active August 13, 2022 15:59
Controller to expose Odoo binary data to readable files extensions to be displayed on browsers and executed by urls in web page (Images/Audio/PDFs..etc)
# -*- coding: utf-8 -*-
import json
import logging
import base64
from odoo import http, tools, _
from odoo.http import request
_logger = logging.getLogger(__name__)
class UtilsApi(http.Controller):
@3mrdev
3mrdev / index.html
Created July 23, 2022 13:38
FireBits Odoo app store description template
<section class="oe_container oe_dark">
<div class="col-md-12">
<h2 class="oe_slogan" style="font-size: 35px;color:#781E4F"><b>Odoo 15</b></h2>
</div>
</section>
<section class="oe_container">
<div class="oe_row oe_spaced">
<div class="oe_span12">
@3mrdev
3mrdev / list_view_button.js
Last active June 11, 2022 06:59
Add a new button in top of the list view in Odoo when clicked it will call a method in your model
odoo.define('your_module.new_button', function (require) {
"use strict";
/**
* Button 'Create' is replaced by Custom Button
**/
var core = require('web.core');
var ListController = require('web.ListController');
ListController.include({
renderButtons: function($node) {
@3mrdev
3mrdev / view_inherit.xml
Created June 9, 2022 16:36
Odoo view inheritance through XPath
<record id="your_model_view_form_firebits" model="ir.ui.view">
<field name="name">your_model.view.form.inherit.firebits</field>
<field name="model">your_model</field>
<field name="priority" eval="25"/>
<field name="inherit_id" ref="your_model_view_external_id"/>
<field name="arch" type="xml">
<xpath expr="//div[hasclass('your_class')]" position="inside">
# your field
</xpath>
</field>
@3mrdev
3mrdev / component.js
Created June 9, 2022 00:25
Odoo OWL Component Example + Owl Component Inheritance (Patching Owl Components)
odoo.define('my.component', function (require) {
"use strict";
const { Component, useState } = owl;
const { xml } = owl.tags;
const { patch } = require('web.utils');
// import { patch } from "@web/core/utils/patch";
class MyComponent extends Component {
@3mrdev
3mrdev / config.php
Created June 9, 2022 00:08
Odoo XMLRPC Example using PHP
<?php
// like import file
require_once('lib/ripcord.php');
// define variables to use in future
$url = "http://localhost:8015";
$db = "o14_api";
$username = "admin";
$password = "admin";
@3mrdev
3mrdev / odoo-server
Created June 8, 2022 18:41
Odoo background service example for Ubuntu Linux. Put it in /etc/init.d path
# Should-Stop: $network
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Enterprise Business Applications
# Description: ODOO Business Applications
### END INIT INFO
PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/bin
DAEMON=/odoo/odoo-server/odoo-bin
NAME=odoo-server
DESC=odoo-server
@3mrdev
3mrdev / domain.py
Last active August 3, 2021 09:00
On Change Domain by a method (Odoo)
@api.onchange('partner_type')
def onchange_partner_type(self):
domain = []
return {'domain': {'partner_id': domain}}
@3mrdev
3mrdev / wizard.py
Created June 8, 2021 23:41
Odoo Wizards
from odoo import models, fields, api
class PopupWizard(models.TransientModel):
_name = 'popup.wizard'
title = fields.Char()
start_date = fields.Datetime()
def confirm(self):
pass
@3mrdev
3mrdev / cd.yaml
Last active June 7, 2021 12:43
Github Actions SSH Deploy Workflow
name: Remote ssh command
on:
push:
branches: [ main ]
jobs:
build:
name: Build