Skip to content
Permalink
Browse files

Merge branch '11.0' of https://github.com/it-projects-llc/pos-addons

…into pos-addons-11.0-pos_product_sync
  • Loading branch information...
KolushovAlexandr committed Jul 16, 2019
2 parents 4f1c92e + 06d3843 commit e70b94c59b2efa64cd425d4bd87880b57eaea57c
@@ -1 +1,3 @@
# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html).

from . import models
@@ -1,6 +1,6 @@
# Copyright 2014-2018 Ivan Yelizariev <https://it-projects.info/team/yelizariev>
# Copyright 2017 Gabbasov Dinar <https://it-projects.info/team/GabbasovDinar>
# Copyright 2018 Kolushov Alexandr <https://it-projects.info/team/KolushovAlexandr>
# Copyright 2018-2019 Kolushov Alexandr <https://it-projects.info/team/KolushovAlexandr>
# Copyright 2018 Ildar Nasyrov <https://it-projects.info/team/iledarn>
# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html).
{
@@ -9,7 +9,7 @@
"category": "Point Of Sale",
# "live_test_url": "http://apps.it-projects.info/shop/product/DEMO-URL?version={ODOO_BRANCH}",
"images": [],
"version": "11.0.1.0.5",
"version": "11.0.1.1.0",
"application": False,

"author": "IT-Projects LLC, Ivan Yelizariev",
@@ -26,6 +26,7 @@
"external_dependencies": {"python": [], "bin": []},
'data': [
'data.xml',
'views/views.xml',
],
'qweb': [
'static/src/xml/pos.xml',
@@ -1,7 +1,7 @@
.. _changelog:
`1.1.0`
-------

Updates
=======
- **New:** Added option to show product quantities

`1.0.6`
-------
@@ -0,0 +1,2 @@
# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html).
from . import models
@@ -0,0 +1,10 @@
# Copyright 2019 Kolushov Alexandr <https://it-projects.info/team/KolushovAlexandr>
# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html).

from odoo import fields, models


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

show_qtys = fields.Boolean("Show Product Qtys", help="Show Product Qtys in POS", default=True)
@@ -1,11 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--Copyright 2014-2015 Ivan Yelizariev <https://it-projects.info/team/yelizariev>
Copyright 2018 Kolushov Alexandr <https://it-projects.info/team/KolushovAlexandr>
Copyright 2018-2019 Kolushov Alexandr <https://it-projects.info/team/KolushovAlexandr>
License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html). -->
<templates id="template" xml:space="preserve">
<t t-extend="Product">
<t t-jquery=".product-img" t-operation="append">
<t t-if="product.type == 'product'">
<t t-if="widget.pos.config.show_qtys &amp;&amp; product.type == 'product'">
<span t-attf-class="qty-tag #{product.qty_available lte 0 ? 'not-available':''}">
<t t-esc="product.qty_available"/>
</span>
@@ -17,7 +17,7 @@
this.attr('t-if', "line.get_quantity_str() !== '1' || line.selected || line.get_product().qty_available lt line.quantity ");
</t>
<t t-jquery="t[t-esc='line.get_quantity_str()']" t-operation="after">
<t t-if="line.get_product().type == 'product'">
<t t-if="widget.pos.config.show_qtys &amp;&amp; line.get_product().type == 'product'">
<t t-set='qty_available' t-value='line.get_product().qty_available'/>
(of <span t-attf-class="qty-info #{qty_available lt line.quantity ? 'not-available':''}"><t t-esc="qty_available"/></span>)
</t>
@@ -0,0 +1,24 @@
<?xml version="1.0" encoding="utf-8"?>
<!--Copyright 2019 Kolushov Alexandr <https://it-projects.info/team/KolushovAlexandr>
License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html).-->
<odoo>

<record id="view_pos_product_available_negative_config_form" model="ir.ui.view">
<field name="name">pos.pin.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="//field[@name='iface_big_scrollbars']/../.." position="after">
<div class="col-xs-12 col-md-6 o_setting_box" id="show_prod_qtys">
<div class="o_setting_left_pane">
<field name="show_qtys"/>
</div>
<div class="o_setting_right_pane">
<label for="show_qtys"/>
</div>
</div>
</xpath>
</field>
</record>

</odoo>
@@ -1,14 +1,14 @@
# Copyright 2016 Stanislav Krotov <https://it-projects.info/team/ufaks>
# Copyright 2017 Ivan Yelizariev <https://it-projects.info/team/yelizariev>
# Copyright 2018 Kolushov Alexandr <https://it-projects.info/team/KolushovAlexandr>
# Copyright 2018-2019 Kolushov Alexandr <https://it-projects.info/team/KolushovAlexandr>
# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html).
{
"name": """Restrict out-of-stock POS Orders""",
"name": 'Restrict out-of-stock POS Orders',
'summary': 'Only supervisor can approve POS Order with out-of-stock product',
"category": "Point Of Sale",
# "live_test_url": "http://apps.it-projects.info/shop/product/DEMO-URL?version={ODOO_BRANCH}",
# "live_test_url": "http://apps.it-projects.info/shop/product/DEMO-URL?version=11.0",
"images": [],
"version": "11.0.1.0.1",
"version": "11.0.1.1.0",
"application": False,

"author": "IT-Projects LLC, Ivan Yelizariev",
@@ -1,7 +1,9 @@
.. _changelog:
`1.1.0`
-------

Updates
=======
- **Fix:** Cashier was changed after giving the authorization of the sale
- **New:** Added option 'Ask Managers Permission to proceed order with negative stock products'
- **New:** Added option 'Show Warning on adding out of stock products'

`1.0.1`
-------
@@ -1,7 +1,7 @@
# Copyright 2016 Stanislav Krotov <https://it-projects.info/team/ufaks>
# Copyright 2016 manawi <https://github.com/manawi>
# Copyright 2019 Kolushov Alexandr <https://it-projects.info/team/KolushovAlexandr>
# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html).

from odoo import models, fields, api


@@ -15,6 +15,14 @@ def _default_negative_stock_user(self):
negative_order_group_id = fields.Many2one(
'res.groups', string='Negative Order Group', default=_default_negative_stock_user,
help='Group allows to sell products which are out of a stock.')
negative_order_manager_permission = fields.Boolean(
"Managers Permission",
help="Ask Managers Permission to proceed order with negative stock products",
default=True)
negative_order_warning = fields.Boolean(
"Show Warning",
help="Show Warning on adding out of stock products",
default=False)


class PosOrder(models.Model):
@@ -27,5 +35,5 @@ class PosOrder(models.Model):
@api.model
def _order_fields(self, ui_order):
res = super(PosOrder, self)._order_fields(ui_order)
res['negative_stock_user_id'] = ui_order['negative_stock_user_id']
res['negative_stock_user_id'] = ui_order.get('negative_stock_user_id', False)
return res
@@ -1,5 +1,5 @@
/* Copyright 2016 Stanislav Krotov <https://it-projects.info/team/ufaks>
Copyright 2018 Kolushov Alexandr <https://it-projects.info/team/KolushovAlexandr>
Copyright 2018-2019 Kolushov Alexandr <https://it-projects.info/team/KolushovAlexandr>
License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html). */
odoo.define('pos_product_available_negative.pos', function (require) {
"use strict";
@@ -13,6 +13,9 @@ odoo.define('pos_product_available_negative.pos', function (require) {
validate_order: function(force_validation) {
var self = this;
var _super = this._super;
if (!this.pos.config.negative_order_manager_permission) {
return this._super(force_validation);
}
var order = this.pos.get_order();
var orderlines = order.get_orderlines();
var has_negative_product = false;
@@ -23,7 +26,8 @@ odoo.define('pos_product_available_negative.pos', function (require) {
self.gui.sudo_custom({
'title': _t('Order has out-of-stock product and must be approved by supervisor'),
'special_group': this.pos.config.negative_order_group_id[0],
'arguments': {'ask_untill_correct': true},
'do_not_change_cashier': true,
'product-imgarguments': {'ask_untill_correct': true},
}).done(function(user){
order.negative_stock_user_id = user;
_super.call(self, force_validation);
@@ -41,9 +45,34 @@ odoo.define('pos_product_available_negative.pos', function (require) {
models.Order = models.Order.extend({
export_as_JSON: function () {
var json = _super_order.export_as_JSON.apply(this, arguments);
json.negative_stock_user_id = this.negative_stock_user_id ? this.negative_stock_user_id.id : false;
json.negative_stock_user_id = this.negative_stock_user_id
? this.negative_stock_user_id.id
: false;
return json;
}
});

screens.ProductListWidget.include({
init: function(parent, options) {
var self = this;
this._super(parent,options);
if (!this.pos.config.negative_order_warning) {
return;
}

var click_product_handler_super = this.click_product_handler;
this.click_product_handler = function(){
var product = self.pos.db.get_product_by_id(this.dataset.productId);
if (product.type === 'product' && product.qty_available <= 0) {
var that = this;
return self.gui.show_popup('alert',{
'title': _t('The product is out of stock'),
'body': _t("It's unavailable to add the product"),
});
}
_.bind(click_product_handler_super, this)();
};
},
});

});
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<!--Copyright 2016 Stanislav Krotov <https://it-projects.info/team/ufaks>
Copyright 2018 Kolushov Alexandr <https://it-projects.info/team/KolushovAlexandr>
Copyright 2018-2019 Kolushov Alexandr <https://it-projects.info/team/KolushovAlexandr>
License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html).-->
<odoo>

@@ -9,12 +9,32 @@
<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="//field[@name='journal_ids']/../../.." position="before">
<div class="col-xs-12 col-md-6 o_setting_box" id="payment_methods">
<div class="o_setting_right_pane">
<label for="negative_order_group_id"/>
<div class="content-group mt16">
<field name="negative_order_group_id"/>
<xpath expr="//div[@id='inventory_location']" position="after">
<h2 name="order">Out of Stock Products</h2>
<div class="row mt16 o_settings_container">
<div class="col-xs-12 col-md-6 o_setting_box" id="negative_order_group_id">
<div class="o_setting_right_pane">
<label for="negative_order_group_id"/>
<div class="content-group mt16">
<field name="negative_order_group_id"/>
</div>
</div>
</div>

<div class="col-xs-12 col-md-6 o_setting_box" id="negative_order_manager_permission">
<div class="o_setting_left_pane">
<field name="negative_order_manager_permission"/>
</div>
<div class="o_setting_right_pane">
<label for="negative_order_manager_permission"/>
</div>
</div>
<div class="col-xs-12 col-md-6 o_setting_box" id="negative_order_warning">
<div class="o_setting_left_pane">
<field name="negative_order_warning"/>
</div>
<div class="o_setting_right_pane">
<label for="negative_order_warning"/>
</div>
</div>
</div>

0 comments on commit e70b94c

Please sign in to comment.
You can’t perform that action at this time.