Skip to content

Commit

Permalink
[ADD] pos_product_quick_info: Add new module to display product witho…
Browse files Browse the repository at this point in the history
…ut add in to card
  • Loading branch information
GabbasovDinar committed Jan 19, 2023
1 parent dbf3aa3 commit d4c5ffc
Show file tree
Hide file tree
Showing 18 changed files with 132 additions and 0 deletions.
1 change: 1 addition & 0 deletions pos_product_quick_info/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
wait a bot :)
1 change: 1 addition & 0 deletions pos_product_quick_info/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import models
20 changes: 20 additions & 0 deletions pos_product_quick_info/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"name": "PoS Product Quick Info",
"version": "16.0.1.0.0",
"summary": "Display product info by one click in Point of Sale",
"author": "Cetmix, Odoo Community Association (OCA)",
"category": "Point Of Sale",
"license": "AGPL-3",
"depends": ["point_of_sale"],
"website": "https://github.com/OCA/pos",
"maintainers": ["GabbasovDinar", "CetmixGitDrone"],
"data": ["views/res_config_settings_view.xml"],
"assets": {
"point_of_sale.assets": [
"pos_product_quick_info/static/src/css/pos.css",
"pos_product_quick_info/static/src/js/Screens/ProductScreen/ProductItem.js",
"pos_product_quick_info/static/src/xml/Screens/ProductScreen/ProductItem.xml",
],
},
"installable": True,
}
2 changes: 2 additions & 0 deletions pos_product_quick_info/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
from . import pos_config
from . import res_config_settings
7 changes: 7 additions & 0 deletions pos_product_quick_info/models/pos_config.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
from odoo import fields, models


class PosConfig(models.Model):
_inherit = "pos.config"

display_quick_product_info = fields.Boolean(default=True)
9 changes: 9 additions & 0 deletions pos_product_quick_info/models/res_config_settings.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
from odoo import fields, models


class ResConfigSettings(models.TransientModel):
_inherit = "res.config.settings"

pos_display_quick_product_info = fields.Boolean(
related="pos_config_id.display_quick_product_info", readonly=False
)
5 changes: 5 additions & 0 deletions pos_product_quick_info/readme/CONFIGURE.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
* Go to Point Of Sale / Configuration / Point of Sale
* Check the box 'Display Quick Product Info'

.. figure:: ../static/img/config.png
:width: 800 px
2 changes: 2 additions & 0 deletions pos_product_quick_info/readme/CONTRIBUTORS.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
* Cetmix <https://cetmix.com/>
* Dinar Gabbasov
2 changes: 2 additions & 0 deletions pos_product_quick_info/readme/DESCRIPTION.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
This module allows you to view information about a product without adding it to cart:
.. image:: ../static/img/info.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added pos_product_quick_info/static/img/config.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added pos_product_quick_info/static/img/info.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
7 changes: 7 additions & 0 deletions pos_product_quick_info/static/src/css/pos.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
.pos .product-list .quick-info {
position: absolute;
top: 0px;
left: 0px;
padding: 5px;
font-size: 24px;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
odoo.define("pos_product_quick_info.ProductItem", function (require) {
"use strict";

const ProductItem = require("point_of_sale.ProductItem");
const Registries = require("point_of_sale.Registries");

const QuickInfoProductItem = (ProductItem) =>
class QuickInfoProductItem extends ProductItem {
async onProductInfoClick(event) {
event.stopPropagation();
return await super.onProductInfoClick(...arguments);
}
};

Registries.Component.extend(ProductItem, QuickInfoProductItem);

return QuickInfoProductItem;
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<?xml version="1.0" encoding="UTF-8" ?>
<templates id="template" xml:space="preserve">

<t
t-name="ProductItem"
t-inherit="point_of_sale.ProductItem"
t-inherit-mode="extension"
owl="1"
>
<xpath expr="//div[hasclass('product-img')]" position="before">
<span
t-if="env.pos.config.display_quick_product_info"
class="quick-info"
t-on-click="onProductInfoClick"
>
<i
class="fa fa-info-circle"
role="img"
aria-label="Info"
title="Info"
/>
</span>
</xpath>
</t>

</templates>
25 changes: 25 additions & 0 deletions pos_product_quick_info/views/res_config_settings_view.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<?xml version="1.0" encoding="utf-8" ?>
<odoo>

<record id="res_config_settings_view_form" model="ir.ui.view">
<field name="name">res.config.settings.view.form</field>
<field name="model">res.config.settings</field>
<field name="inherit_id" ref="point_of_sale.res_config_settings_view_form" />
<field name="arch" type="xml">
<xpath expr="//div[@id='pos_interface_section']" position="inside">
<div class="col-12 col-lg-6 o_setting_box">
<div class="o_setting_left_pane">
<field name="pos_display_quick_product_info" />
</div>
<div class="o_setting_right_pane">
<label for="pos_display_quick_product_info" />
<div class="text-muted">
Display product info by one click
</div>
</div>
</div>
</xpath>
</field>
</record>

</odoo>
6 changes: 6 additions & 0 deletions setup/pos_product_quick_info/setup.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import setuptools

setuptools.setup(
setup_requires=['setuptools-odoo'],
odoo_addon=True,
)

0 comments on commit d4c5ffc

Please sign in to comment.