-
Notifications
You must be signed in to change notification settings - Fork 57
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
🔥 Popup alert-message for exceding available quantity of #761
base: pos-addons-11.0-pos_product_sync
Are you sure you want to change the base?
🔥 Popup alert-message for exceding available quantity of #761
Conversation
'special_group': this.pos.config.negative_order_group_id[0], | ||
'do_not_change_cashier': true, | ||
'product-imgarguments': {'ask_untill_correct': true}, | ||
}).done(function(user){ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Functions declared within loops referencing an outer scoped variable may lead to confusing semantics. (order, _super, self, force_validation)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
take it easy, sharik
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In order to avoid this error you may create a variable, and if the variable is true call sudo_custom
after the cycle
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
check
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
2 installable modules are updated:
├─ pos_product_available_negative/
| └─ static/
| └─ src/
| └─ js/
| └─ pos.js
└─ pos_product_sync/
└─ doc/
└─ changelog.rst
Not installable modules remain unchanged.
sent by ✌️ Odoo Review Bot
@@ -9,6 +10,27 @@ odoo.define('pos_product_available_negative.pos', function (require) { | |||
var core = require('web.core'); | |||
var _t = core._t; | |||
|
|||
models.PosModel = models.PosModel.extend({ | |||
check_qty_of_orderlines: function(self, product, quantity_to_add) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Get rid of passing self
to arguments
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
check
}); | ||
break; | ||
if (line.product.type === 'product') { | ||
if (line.product.id in unique_products) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
stop making new Pull Requests you miss my notes
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if(unique_products[line.product.id]) { ....
Try to find an example when your method might lead to an error.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
also you may combine those two ifs in one
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
-
Was making new PR's in order to understand the reason of travis's errors about branch commits
-
unique_products - is a dictionary got implementation of using it in (https://stackoverflow.com/questions/1208222/how-to-do-associative-array-hashing-in-javascript)
product.id - is a unique value, so errors may be if line.product.id - undefined
in normal case:
-- if we met this stockable product for the first time, so create new property in dictionary of this value, else add value to already existent property -
Refactored that block of code
'special_group': this.pos.config.negative_order_group_id[0], | ||
'do_not_change_cashier': true, | ||
'product-imgarguments': {'ask_untill_correct': true}, | ||
}).done(function(user){ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In order to avoid this error you may create a variable, and if the variable is true call sudo_custom
after the cycle
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Much better, only some stylistic remarks left
@@ -9,6 +10,25 @@ odoo.define('pos_product_available_negative.pos', function (require) { | |||
var core = require('web.core'); | |||
var _t = core._t; | |||
|
|||
models.PosModel = models.PosModel.extend({ | |||
check_qty_of_orderlines: function(orderlines, product, quantity_to_add) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- Function name mismatches with what it does
- You can take
orderlines
from inside of the func. Get rid of the argument. Don't forget to remove lines whereorderline
variable was defined in the code for the func
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
check
return; | ||
} | ||
var selected_orderline = order.get_selected_orderline(); | ||
var orderlines = this.pos.get_order().get_orderlines(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
order variable is already defined
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
check
var orderlines = self.pos.get_order().get_orderlines(); | ||
if (product.type === 'product') { | ||
if (product.qty_available <= 0) { | ||
var that = this; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
that
is not used anywhere
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
check
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the version in manifest and changelog needs to be changed
product by orderlines