FIX having mixed POS orders with lot lines and without.

This commit is contained in:
Jared Kipe
2018-12-11 11:23:17 -08:00
parent 2e5fa6e5ab
commit 9428370987
2 changed files with 34 additions and 23 deletions

View File

@@ -52,12 +52,15 @@ odoo.define("pos_product_catch_weight.models", function (require) {
get_base_price: function(){
var rounding = this.pos.currency.rounding;
var valid_product_lot = this.pack_lot_lines.get_valid_lots();
var lot_ratio_sum = 0.0;
for (var i=0; valid_product_lot && i < valid_product_lot.length; i++) {
lot_ratio_sum += valid_product_lot[i].get('lot_catch_weight_ratio');
if (this.pack_lot_lines && this.pack_lot_lines.get_valid_lots) {
var valid_product_lot = this.pack_lot_lines.get_valid_lots();
for (var i=0; i < valid_product_lot.length; i++) {
lot_ratio_sum += valid_product_lot[i].get('lot_catch_weight_ratio');
}
}
var qty = this.get_quantity();
if (lot_ratio_sum != 0.0) {
qty = lot_ratio_sum;
@@ -66,11 +69,15 @@ odoo.define("pos_product_catch_weight.models", function (require) {
},
get_all_prices: function(){
var valid_product_lot = this.pack_lot_lines.get_valid_lots();
var lot_ratio_sum = 0.0;
for (var i=0; valid_product_lot && i < valid_product_lot.length; i++) {
lot_ratio_sum += valid_product_lot[i].get('lot_catch_weight_ratio');
if (this.pack_lot_lines && this.pack_lot_lines.get_valid_lots) {
var valid_product_lot = this.pack_lot_lines.get_valid_lots();
for (var i=0; i < valid_product_lot.length; i++) {
lot_ratio_sum += valid_product_lot[i].get('lot_catch_weight_ratio');
}
}
var qty = this.get_quantity();
var qty_ratio = 1.0
if (lot_ratio_sum != 0.0) {

View File

@@ -24,30 +24,34 @@
<t t-extend="Orderline">
<t t-jquery=".info-list" t-operation="append">
<t t-set="lots" t-value="line.pack_lot_lines.get_valid_lots()"/>
<t t-if="lots" t-foreach="lots" t-as="lot">
<li class="info">
-- <t t-esc="lot.get_lot_name()"/>
<t t-if="lot.get('lot_catch_weight_uom_id')">
@ <t t-esc="lot.get('lot_catch_weight')"/>
<t t-esc="lot.get('lot_catch_weight_uom_id')[1]"/>
</t>
</li>
<t t-if="line.pack_lot_lines and line.pack_lot_lines.get_valid_lots">
<t t-set="lots" t-value="line.pack_lot_lines.get_valid_lots()"/>
<t t-if="lots" t-foreach="lots" t-as="lot">
<li class="info">
-- <t t-esc="lot.get_lot_name()"/>
<t t-if="lot.get('lot_catch_weight_uom_id')">
@ <t t-esc="lot.get('lot_catch_weight')"/>
<t t-esc="lot.get('lot_catch_weight_uom_id')[1]"/>
</t>
</li>
</t>
</t>
</t>
</t>
<t t-extend="PosTicket">
<t t-jquery=".receipt-orderlines tr td:nth-child(1)" t-operation="append">
<br/>
<t t-set="lots" t-value="orderline.pack_lot_lines.get_valid_lots()"/>
<t t-if="lots" t-foreach="lots" t-as="lot">
-- <t t-esc="lot.get_lot_name()"/>
<t t-if="lot.get('lot_catch_weight_uom_id')">
@ <t t-esc="lot.get('lot_catch_weight')"/>
<t t-esc="lot.get('lot_catch_weight_uom_id')[1]"/>
</t>
<t t-if="orderline.pack_lot_lines and orderline.pack_lot_lines.get_valid_lots">
<br/>
<t t-set="lots" t-value="orderline.pack_lot_lines.get_valid_lots()"/>
<t t-if="lots" t-foreach="lots" t-as="lot">
-- <t t-esc="lot.get_lot_name()"/>
<t t-if="lot.get('lot_catch_weight_uom_id')">
@ <t t-esc="lot.get('lot_catch_weight')"/>
<t t-esc="lot.get('lot_catch_weight_uom_id')[1]"/>
</t>
<br/>
</t>
</t>
</t>
</t>