🔥 Popup alert-message for exceding available quantity of#761
🔥 Popup alert-message for exceding available quantity of#761fedoranvar wants to merge 1 commit intoit-projects-llc:pos-addons-11.0-pos_product_syncfrom fedoranvar:pos-addons-11.0-pos_product_sync
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.
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.
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.
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
| 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.
Get rid of passing self to arguments
| }); | ||
| break; | ||
| if (line.product.type === 'product') { | ||
| if (line.product.id in unique_products) { |
There was a problem hiding this comment.
stop making new Pull Requests you miss my notes
There was a problem hiding this comment.
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.
also you may combine those two ifs in one
There was a problem hiding this comment.
-
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.
In order to avoid this error you may create a variable, and if the variable is true call sudo_custom after the cycle
KolushovAlexandr
left a comment
There was a problem hiding this comment.
Much better, only some stylistic remarks left
| 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.
- Function name mismatches with what it does
- You can take
orderlinesfrom inside of the func. Get rid of the argument. Don't forget to remove lines whereorderlinevariable was defined in the code for the func
| return; | ||
| } | ||
| var selected_orderline = order.get_selected_orderline(); | ||
| var orderlines = this.pos.get_order().get_orderlines(); |
There was a problem hiding this comment.
order variable is already defined
| var orderlines = self.pos.get_order().get_orderlines(); | ||
| if (product.type === 'product') { | ||
| if (product.qty_available <= 0) { | ||
| var that = this; |
ilmir-k
left a comment
There was a problem hiding this comment.
the version in manifest and changelog needs to be changed
product by orderlines