-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[14.0][ADD] pos_disable_pricelist_selection
- Loading branch information
i1
authored and
diga
committed
May 4, 2022
1 parent
47aa8c3
commit 01af69b
Showing
17 changed files
with
166 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
**This file is going to be generated by oca-gen-addon-readme.** | ||
|
||
*Manual changes will be overwritten.* | ||
|
||
Please provide content in the ``readme`` directory: | ||
|
||
* **DESCRIPTION.rst** (required) | ||
* INSTALL.rst (optional) | ||
* CONFIGURE.rst (optional) | ||
* **USAGE.rst** (optional, highly recommended) | ||
* DEVELOP.rst (optional) | ||
* ROADMAP.rst (optional) | ||
* HISTORY.rst (optional, recommended) | ||
* **CONTRIBUTORS.rst** (optional, highly recommended) | ||
* CREDITS.rst (optional) | ||
|
||
Content of this README will also be drawn from the addon manifest, | ||
from keys such as name, authors, maintainers, development_status, | ||
and license. | ||
|
||
A good, one sentence summary in the manifest is also highly recommended. | ||
|
||
|
||
Automatic changelog generation | ||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
|
||
`HISTORY.rst` can be auto generated using `towncrier <https://pypi.org/project/towncrier>`_. | ||
|
||
Just put towncrier compatible changelog fragments into `readme/newsfragments` | ||
and the changelog file will be automatically generated and updated when a new fragment is added. | ||
|
||
Please refer to `towncrier` documentation to know more. | ||
|
||
NOTE: the changelog will be automatically generated when using `/ocabot merge $option`. | ||
If you need to run it manually, refer to `OCA/maintainer-tools README <https://github.com/OCA/maintainer-tools>`_. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
from . import models |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
{ | ||
"name": "Disable Pricelist selection button in POS", | ||
"version": "14.0.1.0.0", | ||
"summary": "Disable Pricelist selection button in POS", | ||
"author": "Ooops, Cetmix, Odoo Community Association (OCA)", | ||
"contributors": "Cetmix", | ||
"license": "LGPL-3", | ||
"category": "Purchase", | ||
"website": "https://github.com/OCA/pos", | ||
"depends": ["point_of_sale"], | ||
"external_dependencies": {}, | ||
"demo": [], | ||
"data": ["views/assets.xml", "views/pos_config_view.xml"], | ||
"qweb": ["static/src/xml/ClientDetailsEdit.xml"], | ||
"installable": True, | ||
"application": False, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
from . import pos_config |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
from odoo import fields, models | ||
|
||
|
||
class PosConfig(models.Model): | ||
_inherit = "pos.config" | ||
|
||
hide_pricelist_button = fields.Boolean( | ||
default=False, | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
* No configuration is required |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
* Ooops404 <https://www.ooops404.com/> | ||
* Cetmix <https://cetmix.com/> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
Disable Pricelist selection button in POS | ||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
|
||
* Disable Pricelist selection button in POS |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
14.0.1.0.0 | ||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
|
||
* Initial release |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
* In POS configuration enable multiple pricelists | ||
* There will be a checkbox "Hide Pricelist Button" | ||
* If checked pricelist selection button will be hidden in POS Screen |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
28 changes: 28 additions & 0 deletions
28
pos_disable_pricelist_selection/static/src/js/ProductScreen.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
odoo.define("pos_disable_pricelist_selection.ProductScreen", function (require) { | ||
"use strict"; | ||
|
||
const ProductScreen = require("point_of_sale.ProductScreen"); | ||
const Registries = require("point_of_sale.Registries"); | ||
|
||
const PosProductScreen = (ProductScreen) => | ||
class extends ProductScreen { | ||
constructor() { | ||
super(...arguments); | ||
_.each(this.constructor.controlButtons, function (button) { | ||
if (button.name === "SetPricelistButton") { | ||
button.condition = function () { | ||
return ( | ||
this.env.pos.config.use_pricelist && | ||
this.env.pos.pricelists.length > 1 && | ||
!this.env.pos.config.hide_pricelist_button | ||
); | ||
}; | ||
} | ||
}); | ||
} | ||
}; | ||
|
||
Registries.Component.extend(ProductScreen, PosProductScreen); | ||
|
||
return ProductScreen; | ||
}); |
20 changes: 20 additions & 0 deletions
20
pos_disable_pricelist_selection/static/src/xml/ClientDetailsEdit.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
<?xml version="1.0" encoding="UTF-8" ?> | ||
<templates id="template" xml:space="preserve"> | ||
|
||
<t | ||
t-name="ClientDetailsEdit" | ||
t-inherit="point_of_sale.ClientDetailsEdit" | ||
t-inherit-mode="extension" | ||
owl="1" | ||
> | ||
<xpath | ||
expr="//div[@t-if='env.pos.pricelists.length gt 1']" | ||
position="attributes" | ||
> | ||
<attribute | ||
name="t-if" | ||
>env.pos.pricelists.length gt 1 and !env.pos.config.hide_pricelist_button</attribute> | ||
</xpath> | ||
</t> | ||
|
||
</templates> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<?xml version="1.0" encoding="utf-8" ?> | ||
<odoo> | ||
<template id="assets" inherit_id="point_of_sale.assets"> | ||
<xpath expr="." position="inside"> | ||
<script | ||
type="text/javascript" | ||
src="/pos_disable_pricelist_selection/static/src/js/ProductScreen.js" | ||
/> | ||
</xpath> | ||
</template> | ||
</odoo> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
<?xml version="1.0" encoding="utf-8" ?> | ||
<odoo> | ||
<record id="pos_config_view_form" model="ir.ui.view"> | ||
<field name="name">pos.config.form.view</field> | ||
<field name="model">pos.config</field> | ||
<field name="inherit_id" ref="point_of_sale.pos_config_view_form" /> | ||
<field name="arch" type="xml"> | ||
<xpath | ||
expr="//div[@id='pricelist_setting']//div[@class='content-group mt16']" | ||
position="inside" | ||
> | ||
<div class="row mt16"> | ||
<label | ||
string="Hide Pricelist Button" | ||
for="hide_pricelist_button" | ||
class="col-lg-3 o_light_label" | ||
/> | ||
<field name="hide_pricelist_button" /> | ||
</div> | ||
</xpath> | ||
</field> | ||
</record> | ||
</odoo> |
1 change: 1 addition & 0 deletions
1
setup/pos_disable_pricelist_selection/odoo/addons/pos_disable_pricelist_selection
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
../../../../pos_disable_pricelist_selection |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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, | ||
) |