Browse Source

Merge PR #349 into 11.0

Signed-off-by legalsylvain
pull/393/head
OCA-git-bot 5 years ago
parent
commit
228b3c5651
  1. 77
      pos_fix_search_limit/README.rst
  2. 0
      pos_fix_search_limit/__init__.py
  3. 18
      pos_fix_search_limit/__manifest__.py
  4. 14
      pos_fix_search_limit/i18n/pos_fix_search_limit.pot
  5. BIN
      pos_fix_search_limit/static/description/icon.png
  6. 49
      pos_fix_search_limit/static/src/js/pos_fix_search_limit.js
  7. 11
      pos_fix_search_limit/views/pos_fix_limit.xml
  8. 2
      setup/_metapackage/VERSION.txt
  9. 1
      setup/_metapackage/setup.py
  10. 1
      setup/pos_fix_search_limit/odoo/addons/pos_fix_search_limit
  11. 2
      setup/pos_fix_search_limit/setup.cfg
  12. 6
      setup/pos_fix_search_limit/setup.py

77
pos_fix_search_limit/README.rst

@ -0,0 +1,77 @@
.. image:: https://img.shields.io/badge/license-AGPL--3-blue.png
:target: https://www.gnu.org/licenses/agpl
:alt: License: AGPL-3
====================
Pos Fix Search Limit
====================
This module makes the distinction between the limit of search results
and the limit of product displayed.
Without this module, if you have many products, all the searches are limited
to 100 firsts results.
This module increase the limit of search results to a high number
and keep the number of product displayed to 100.
Usage
=====
This module is a dependecy of other modules like pos_product_template.
.. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas
:alt: Try me on Runbot
:target: https://runbot.odoo-community.org/runbot/184/10.0
Known issues / Roadmap
======================
* Display a last element like "More products" to let the user know his search has been truncated.
* Truncate the list of partners with the display limit.
Bug Tracker
===========
Bugs are tracked on `GitHub Issues
<https://github.com/OCA/{project_repo}/issues>`_. In case of trouble, please
check there if your issue has already been reported. If you spotted it first,
help us smash it by providing detailed and welcomed feedback.
Credits
=======
Images
------
* Odoo Community Association: `Icon <https://odoo-community.org/logo.png>`_.
Contributors
------------
* Raphaël Reverdy <raphael.reverdy@akretion.com> (https://www.akretion.com)
Do not contact contributors directly about support or help with technical issues.
Funders
-------
The development of this module has been financially supported by:
* Akretion
Maintainer
----------
.. image:: https://odoo-community.org/logo.png
:alt: Odoo Community Association
:target: https://odoo-community.org
This module is maintained by the OCA.
OCA, or the Odoo Community Association, is a nonprofit organization whose
mission is to support the collaborative development of Odoo features and
promote its widespread use.
To contribute to this module, please visit https://odoo-community.org.

0
pos_fix_search_limit/__init__.py

18
pos_fix_search_limit/__manifest__.py

@ -0,0 +1,18 @@
# Copyright 2018 Akretion
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
{
"name": "Pos Fix Search Limit",
"summary": "Increase search in the PoS",
"version": "11.0.1.0.0",
"category": "Point of Sale",
"author": "Akretion, Odoo Community Association (OCA)",
"license": "AGPL-3",
"application": False,
"installable": True,
"depends": [
"point_of_sale",
],
"data": [
"views/pos_fix_limit.xml",
]
}

14
pos_fix_search_limit/i18n/pos_fix_search_limit.pot

@ -0,0 +1,14 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 11.0\n"
"Report-Msgid-Bugs-To: \n"
"Last-Translator: <>\n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: \n"

BIN
pos_fix_search_limit/static/description/icon.png

After

Width: 128  |  Height: 128  |  Size: 9.2 KiB

49
pos_fix_search_limit/static/src/js/pos_fix_search_limit.js

@ -0,0 +1,49 @@
/* Copyright 2018 Akretion - Raphaël Reverdy
License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl). */
odoo.define("pos_fix_search_limit.db", function (require) {
"use strict";
var PosDB = require("point_of_sale.DB");
PosDB.include({
limit: 314159265, // the maximum number of results returned by a search
});
});
odoo.define('pos_fix_search_limit.product_list', function(require) {
"use strict";
var screens = require('point_of_sale.screens');
var core = require('web.core');
var qweb = core.qweb;
screens.ProductListWidget.include({
displayLimit: 100, //number of elements displayed
renderElement: function() {
//Limit the number of elements to displayLimit (instead of db.limit)
// (db.limit has been increased to return more results)
// (but we still want to limit the display)
//And make use of document fragment, because better perfs
var self = this;
var i = 0;
var len = Math.min(this.product_list.length, this.displayLimit);
var frag = document.createDocumentFragment();
var product_node = null;
var el_str = qweb.render(this.template, {widget: this});
var el_node = document.createElement('div');
el_node.innerHTML = el_str;
el_node = el_node.childNodes[1];
if(this.el && this.el.parentNode){
this.el.parentNode.replaceChild(el_node,this.el);
}
this.el = el_node;
var list_container = el_node.querySelector('.product-list');
for(i=0; i < len; i++){
product_node = this.render_product(this.product_list[i]);
product_node.addEventListener('click',this.click_product_handler);
frag.appendChild(product_node);
}
list_container.appendChild(frag);
}
});
});

11
pos_fix_search_limit/views/pos_fix_limit.xml

@ -0,0 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<template id="assets" name="pos_fix_search_limit assets" inherit_id="point_of_sale.assets">
<xpath expr="." position="inside">
<script type="text/javascript" src="/pos_fix_search_limit/static/src/js/pos_fix_search_limit.js"></script>
</xpath>
</template>
</odoo>

2
setup/_metapackage/VERSION.txt

@ -1 +1 @@
11.0.20190310.0
11.0.20190816.0

1
setup/_metapackage/setup.py

@ -9,6 +9,7 @@ setuptools.setup(
version=version,
install_requires=[
'odoo11-addon-pos_config_show_accounting',
'odoo11-addon-pos_fix_search_limit',
'odoo11-addon-pos_lot_selection',
'odoo11-addon-pos_loyalty',
'odoo11-addon-pos_margin',

1
setup/pos_fix_search_limit/odoo/addons/pos_fix_search_limit

@ -0,0 +1 @@
../../../../pos_fix_search_limit

2
setup/pos_fix_search_limit/setup.cfg

@ -0,0 +1,2 @@
[bdist_wheel]
universal=1

6
setup/pos_fix_search_limit/setup.py

@ -0,0 +1,6 @@
import setuptools
setuptools.setup(
setup_requires=['setuptools-odoo'],
odoo_addon=True,
)
Loading…
Cancel
Save