In this repo i inherit the pos module and added QR code to pos receipt

Overview

odoo-pos-inherit

In this repo i inherit the pos module and added QR code to pos receipt

1- Create new Odoo Module using command line

$ python odoo-bin scaffold <module name> <where to put it>

2- Inherit OrderReceipt JS Screen in odoo

1 - Create new js class and put this code that defin a function referenced to

odoo.define('point_of_sale.OrderReceipt', function (require) {
    'use strict';

    const PosComponent = require('point_of_sale.PosComponent');
    const Registries = require('point_of_sale.Registries');

    function myFunction(text) {
        return text
    }

    class OrderReceipt extends PosComponent {


        constructor() {
            console.log("eslam faisal constructor")
            super(...arguments);
            this._receiptEnv = this.props.order.getOrderReceiptEnv();
        }

        willUpdateProps(nextProps) {
            this._receiptEnv = nextProps.order.getOrderReceiptEnv();
        }

        get receipt() {
            return this.receiptEnv.receipt;
        }

        clientName(receipt) {
            return receipt.client.name
        }

        get orderlines() {
            return this.receiptEnv.orderlines;
        }

        get paymentlines() {
            return this.receiptEnv.paymentlines;
        }

        get isTaxIncluded() {
            return Math.abs(this.receipt.subtotal - this.receipt.total_with_tax) <= 0.000001;
        }

        get receiptEnv() {
            return this._receiptEnv;
        }

        isSimple(line) {
            return (
                line.discount === 0 &&
                line.is_in_unit &&
                line.quantity === 1 &&
                !(
                    line.display_discount_policy == 'without_discount' &&
                    line.price < line.price_lst
                )
            );
        }
    }

    OrderReceipt.template = 'OrderReceipt';

    Registries.Component.add(OrderReceipt);

    return OrderReceipt;
});

2- Add new Order Receipt that you created recently to JS directory in your module pos inherit

3- Create a #data.xml file to xpath the new JS file screen and define it in manifest.py file and make the module depends on point_of_sale

">
xml version="1.0" encoding="utf-8"?>
<odoo>
    <data>

        <template id="assets" inherit_id="point_of_sale.assets">
            <xpath expr="//script[@src='/point_of_sale/static/src/js/Screens/ReceiptScreen/OrderReceipt.js']"
                   position="replace">
                <script type="text/javascript" src="/pos_inherit/static/src/js/OrderReceipt.js"/>
            xpath>

        template>

    data>
odoo>

3- Inherit OrderReceipt XML file

1 - Create new xml file pos_receipt.xml and register it in manifest.py but in qweb section post inherit 2

2- inherit pos receipt screen xml by xpath 3 - use t tag for access JS values 4 - use api.qrserver.com public api to get the QR code with given data

Served for
">
xml version="1.0" encoding="UTF-8"?>
<templates id="template" xml:space="preserve">
    <t t-name="OrderReceipt" t-inherit="point_of_sale.OrderReceipt" t-inherit-mode="extension" owl="1">
        <xpath expr="//div[hasclass('pos-receipt-order-data')]" position="after">

            <img id="qr_image"
                 style="width:180px;height:180px; margin-left:60px;margin-top:16px;"/>

            <script>
                let image = document.getElementById('qr_image');
                let qrData = " :اسم المورد "+ " <t t-esc="receipt.company.name"/>";
                qrData += "%0A";
                qrData += "الرقم الضريبي: "+ "<t t-esc="receipt.company.vat"/>";
                qrData += "%0A";
                qrData += ":التاريخ "+ "<t t-esc="receipt.date.localestring"/>";
                qrData += "%0A";
                qrData += "المبلغ الكلي: "+ "<t t-esc="receipt.total_with_tax"/>";
                qrData += "%0A";
                qrData += "العميل: "+ "<t t-esc="receipt.client.name"/>";
                qrData += "%0A";
                qrData += "الرقم الضريبي: "+ "<t t-esc="receipt.client.vat"/>";
                image.src = "https://api.qrserver.com/v1/create-qr-code/?data="+qrData;
                script>
        xpath>

        <xpath expr="//div[hasclass('cashier')]" position="after">
        <div>Served for <t t-esc="receipt.client.name"/>div>

        xpath>
    t>
templates>

#Finally then create pos order with client IMG-20180516-WA0055

A Red Team tool for exfiltrating sensitive data from Jira tickets.

Jir-thief This Module will connect to Jira's API using an access token, export to a word .doc, and download the Jira issues that the target has access

Antonio Piazza 82 Dec 12, 2022
Generate your personal 8-bit avatars using Cellular Automata, a mathematical model that simulates life, survival, and extinction

Try the interactive demo here ✨ ✨ Sprites-as-a-Service is an open-source web application that allows you to generate custom 8-bit sprites using Cellul

Lj Miranda 265 Dec 26, 2022
It's an .exe file that can notify your chia profit and warning message every time automatically.

chia-Notify-with-Line 警示程式 It's an .exe file that can notify your chia profit and warning message every time automatically. 這是我自行設計的小程式,有轉成.exe檔了,可以在沒

You,Yu 1 Oct 28, 2021
A practice program to find the LCM i.e Lowest Common Multiplication of two numbers using python without library.

Finding-LCM-using-python-from-scratch Here, I write a practice program to find the LCM i.e Lowest Common Multiplication of two numbers using python wi

Sachin Vinayak Dabhade 4 Sep 24, 2021
A simple script written using symbolic python that takes as input a desired metric and automatically calculates and outputs the Christoffel Pseudo-Tensor, Riemann Curvature Tensor, Ricci Tensor, Scalar Curvature and the Kretschmann Scalar

A simple script written using symbolic python that takes as input a desired metric and automatically calculates and outputs the Christoffel Pseudo-Tensor, Riemann Curvature Tensor, Ricci Tensor, Scal

2 Nov 27, 2021
Pseudometa's dotfiles

pseudometa's dotfiles Table of Contents Why this repository? How this Repository works Special Explanations Got an idea for an improvement? Contact Wh

pseudometa 23 Dec 27, 2022
It was created to conveniently respond to events such as donation, follow, and hosting using the Alert Box provided by twip to streamers

This library is not an official library of twip. It was created to conveniently respond to events such as donation, follow, and hosting using the Alert Box provided by twip to streamers.

junah201 8 Nov 19, 2022
How to access and display MyEnergi data

MyEnergi-Python-Example How to access and display MyEnergi data Windows PC Install a version of Python typically 3.10 The Python code here needs addit

G6EJD 8 Nov 28, 2022
Minimal, super readable string pattern matching for python.

simplematch Minimal, super readable string pattern matching for python. import simplematch simplematch.match("He* {planet}!", "Hello World!") {"p

Thomas Feldmann 147 Dec 01, 2022
A companion web application to connect stash to deovr

stash-vr-companion This is a companion web application to connect stash to deovr. Stash is a self hosted web application to manage your porn collectio

19 Sep 29, 2022
An html wrapper for python

MessySoup What is it? MessySoup is a python wrapper for html elements. While still a ways away, the main goal is to be able to build a wesbite straigh

4 Jan 05, 2022
this is a basic python project that I made using python

this is a basic python project that I made using python. This project is only for practice because my python skills are still newbie.

Elvira Firmansyah 2 Dec 14, 2022
A topology optimization framework written in Taichi programming language, which is embedded in Python.

Taichi TopOpt (Under Active Development) Intro A topology optimization framework written in Taichi programming language, which is embedded in Python.

Li Zhehao 41 Nov 17, 2022
A code base for python programs the goal is to integrate all the useful and essential functions

Base Dev EN This GitHub will be available in French and English FR Ce GitHub sera disponible en français et en anglais Author License Screen EN 🇬🇧 D

Pikatsuto 1 Mar 07, 2022
GitHub Actions Version Updater Updates All GitHub Action Versions in a Repository and Creates a Pull Request with the Changes.

GitHub Actions Version Updater GitHub Actions Version Updater is GitHub Action that is used to update other GitHub Actions in a Repository and create

Maksudul Haque 42 Dec 22, 2022
Python script that automates the tasks involved in starting a new coding project

Auto Project Builder Automates the repetitive tasks while starting a new project Installation Use the REQUIREMENTS.txt file to install the dependencie

Prathap S S 1 Feb 03, 2022
A Sophisticated And Beautiful Doxing Tool

Garuda V1.1 A Sophisticated And Beautiful Doxing Tool Works on Android[Termux] | Linux | Windows Don't Forget to give it a star ❗ How to use ❓ First o

The Cryptonian 67 Jan 10, 2022
A community based economy bot with python works only with python 3.7.8 as web3 requires cytoolz

A community based economy bot with python works only with python 3.7.8 as web3 requires cytoolz has some issues building with python 3.10

4 Jan 01, 2022
List of all D&D 5e monsters: WotC + popular third-party sourcebooks

Xio's Guide to Monsters If you're a DM like me, and you have multiple sources of D&D 5e monsters that include WotC as well as third-party suppliers, y

20 Jan 06, 2023
Simple python bot, that notifies about new manga chapters through Telegram.

Simple python bot, that notifies about new manga chapters through Telegram.

Dmitry Kopturov 1 Dec 05, 2021