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

C++ Environment InitiatorVisual Studio Code C / C++ Environment Initiator

Visual Studio Code C / C++ Environment Initiator Latest Version : v 1.0.1(2021/11/08) .exe link here About : Visual Studio Code에서 C/C++환경을 MinGW GCC/G

Junho Yoon 2 Dec 19, 2021
A class to draw curves expressed as L-System production rules

A class to draw curves expressed as L-System production rules

Juna Salviati 6 Sep 09, 2022
This python module allows to extract data from the RAW-file-format produces by devices from Thermo Fisher Scientific.

fisher_py This Python module allows access to Thermo Orbitrap raw mass spectrometer files. Using this library makes it possible to automate the analys

8 Oct 14, 2022
CBO uses its Capital Tax model (CBO-CapTax) to estimate the effects of federal taxes on capital income from new investment

CBO’s CapTax Model CBO uses its Capital Tax model (CBO-CapTax) to estimate the effects of federal taxes on capital income from new investment. Specifi

Congressional Budget Office 7 Dec 16, 2022
Coronavirus Tracker API

Coronavirus Tracker API Provides up-to-date data about Coronavirus outbreak. Includes numbers about confirmed cases, deaths and recovered. Support mul

Francisco Laguna 1 Oct 31, 2020
Hartree-Fock Workshop for the Han-sur-Lesse Winterschool of 2021

Hartree-Fock course for the Han-sur-Lesse Winterschool of 2021 Requirements For going through these exercises, please install the Anaconda suite. Next

Ivo Filot 2 Nov 16, 2022
sfgp is a package that aggregates individual scripts and notebooks, primarily written for the basic analysis tasks of genetics and pharmacogenomics data.

sfgp is a package that aggregates individual scripts and notebooks, primarily written for the basic analysis tasks of genetics and pharmacogenomics data.

Vishal Sarsani 1 Mar 31, 2022
Ergonomic option parser on top of dataclasses, inspired by structopt.

oppapī Ergonomic option parser on top of dataclasses, inspired by structopt. Usage from typing import Optional from oppapi import from_args, oppapi @

yukinarit 4 Jul 19, 2022
This project intends to take the user's CEP (brazilian adress code) and return the local in which the CEP is placed.

This project aims to simply return the CEP's (the brazilian resident adress code) User of the application. The project uses a request and passes on to

Daniel Soares Saldanha 4 Nov 17, 2021
An optional component handler for hikari, inspired by discord.py's views.

hikari-miru An optional component handler for hikari, inspired by discord.py's views.

43 Dec 26, 2022
Extremely unfinished animation toolset for Blender 3.

AbraTools Alpha IMPORTANT: Code is a mess. Be careful using it in production. Bug reports, feature requests and PRs are appreciated. Download AbraTool

Abra 15 Dec 17, 2022
aaencode for python,把python代码转换为颜文字

py-aaencode aaencode for python,把python代码转换为颜文字 compile.py: 将python编译成颜文字,编译结果有随机性,可以选择BPE词表压缩代码 compile_min.py: 最小化的编译器 compiled_min.txt: 编译得到的最小的com

11 Dec 30, 2021
A python script for combining multiple native SU2 format meshes into one mesh file for multi-zone simulations.

A python script for combining multiple native SU2 format meshes into one mesh file for multi-zone simulations.

MKursatUzuner 1 Jan 20, 2022
🌈Python cheatsheet for all standard libraries(Continuously Updated)

Python Standard Libraries Cheatsheet Depend on Python v3.9.8 All code snippets have been tested to ensure they work properly. Fork me on GitHub. 中文 En

nick 12 Dec 27, 2022
Senator Stock Trading Tester

Senator Stock Trading Tester Program to compare stock performance of Senator's transactions vs when the sale is disclosed. Using to find if tracking S

Cole Cestaro 1 Dec 07, 2021
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
Pydesy package description (EN)

Pydesy package description (EN) Last version: 0.0.2 Geodetic library, which includes the following tasks: 1. Calculation of theodolite traverse (tachy

1 Feb 03, 2022
Labspy06 With Python

Labspy06 Profil Nama : Nafal mumtaz fuadi Nim : 312110457 Kelas : T1.21.A.2 Latihan 1 Ubahlah kode dibawah ini menjadi fungsi menggunakan lambda impor

Mas Nafal 1 Dec 12, 2021
A Dungeon and Dragons Toolkit using Python

Pythons-Dungeons A Dungeon and Dragons Toolkit using Python Rules: -When you are commiting please don't delete parts of the code that are important -A

2 Oct 21, 2021
[draft] tools for schnetpack

schnetkit some tooling for schnetpack EXPERIMENTAL/IN DEVELOPMENT DO NOT USE This is an early draft of some infrastructure built around schnetpack. In

Marcel 1 Nov 08, 2021