mirror of
https://github.com/NaN-tic/ionic-tryton-inventory.git
synced 2023-12-14 07:13:00 +01:00
Upgrade last app_proxy changes
This commit is contained in:
parent
3a0a58618c
commit
2900c2de6d
|
@ -15,7 +15,7 @@
|
|||
<ion-list>
|
||||
<ion-item class="i.state" (click)="itemSelected($event, i)" *ngFor="let i of list_items">
|
||||
{{i['location.name']}}
|
||||
<p>{{i.date}}</p>
|
||||
<p>{{ i.date['day'] }}/{{ i.date['month'] }}/{{ i.date['year'] }}</p>
|
||||
</ion-item>
|
||||
</ion-list>
|
||||
|
||||
|
|
|
@ -36,10 +36,8 @@ export class InventoriesPage extends InfiniteList{
|
|||
this.method = "stock.inventory";
|
||||
|
||||
// TODO: might need to change and look for location
|
||||
this.domain = [new EncodeJSONRead().createDomain("state",
|
||||
"=", "draft")];
|
||||
this.fields = ["date", "company", "location.name", "location.code",
|
||||
"location.parent.name", "location", "state"];
|
||||
this.domain = [new EncodeJSONRead().createDomain("state", "=", "draft")];
|
||||
this.fields = ['date', 'location:["name", "code"]', 'state'];
|
||||
this.showLoading()
|
||||
this.loadData()
|
||||
}
|
||||
|
|
|
@ -30,7 +30,7 @@
|
|||
</ion-col>
|
||||
</ion-row>
|
||||
<ion-row class="success" *ngFor="let item of item_array; let i = index">
|
||||
<ion-col width-70>{{item.product.name}}</ion-col>
|
||||
<ion-col width-70>{{item.product.rec_name}}</ion-col>
|
||||
<ion-col width-20>
|
||||
<p class="quantity"> {{item.quantity}} </p>
|
||||
</ion-col>
|
||||
|
|
|
@ -171,8 +171,7 @@ export class InventoryListPage {
|
|||
let json_constructor = new EncodeJSONRead;
|
||||
let method = "stock.inventory.line";
|
||||
let fields = this.inventory_fields;
|
||||
let domain = [json_constructor.createDomain(
|
||||
"inventory", "=", inventory.id)];
|
||||
let domain = [json_constructor.createDomain("inventory", "=", inventory.id)];
|
||||
|
||||
json_constructor.addNode(method, domain, fields);
|
||||
let json = json_constructor.createJson();
|
||||
|
@ -183,9 +182,9 @@ export class InventoryListPage {
|
|||
for (let line of data[method]) {
|
||||
this.product = {
|
||||
name: line['product.name'],
|
||||
codes_number: [],
|
||||
rec_name: line.rec_name,
|
||||
id: line.product
|
||||
codes_number: [line['product.code']],
|
||||
rec_name: line['product.rec_name'],
|
||||
id: line['product.id']
|
||||
}
|
||||
product_ids.push(this.product.id)
|
||||
this.inventory_line = {
|
||||
|
@ -194,16 +193,16 @@ export class InventoryListPage {
|
|||
expected_quantity: line.expected_quantity,
|
||||
id: line.id
|
||||
}
|
||||
this.item_array.push(this.inventory_line)
|
||||
this.inventory.lines.push(this.inventory_line)
|
||||
this.item_array.push(this.inventory_line);
|
||||
this.inventory.lines.push(this.inventory_line);
|
||||
}
|
||||
this.events.publish("Fetch complete")
|
||||
this.hideLoading()
|
||||
this.hideLoading();
|
||||
/* We gather all the data to display it and then we get all the barcodes
|
||||
* This is so its gonna be faster to givve the user feedback by displaying
|
||||
* the products than waiting a longer for the barcodes
|
||||
*/
|
||||
this.search_code(product_ids)
|
||||
this.search_code(product_ids);
|
||||
},
|
||||
error => {
|
||||
})
|
||||
|
@ -217,8 +216,7 @@ export class InventoryListPage {
|
|||
let json_constructor = new EncodeJSONRead;
|
||||
let method = "product.code";
|
||||
let fields = ["product", "number"];
|
||||
let domain = [json_constructor.createDomain(
|
||||
"product", "in", product_ids)];
|
||||
let domain = [json_constructor.createDomain("product", "in", product_ids)];
|
||||
|
||||
json_constructor.addNode(method, domain, fields);
|
||||
let json = json_constructor.createJson();
|
||||
|
@ -250,11 +248,11 @@ export class InventoryListPage {
|
|||
public checkInput(event): boolean {
|
||||
if (this.barcode.length >= 5) {
|
||||
if (!this.setProductQuantity(this.barcode, 1)){
|
||||
if (!this.getProduct(this.barcode))
|
||||
if (!this.getProduct(this.barcode)){
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (this.barcode.length < 5) {
|
||||
} else if (this.barcode.length < 5) {
|
||||
// Should never show the alert
|
||||
if (!this.setProductQuantity(this.lastItem, Number(this.barcode))){
|
||||
alert('No se ha podido encontrar el producto')
|
||||
|
@ -276,7 +274,7 @@ export class InventoryListPage {
|
|||
if (set_quantity == NaN) return false;
|
||||
|
||||
for (let line of this.item_array) {
|
||||
if (line.product.codes_number.indexOf(item_code.toString()) >= 0) {
|
||||
if (line.product.codes_number.indexOf(item_code) >= 0) {
|
||||
if (this.barcode.length > 5) {
|
||||
line.quantity += set_quantity;
|
||||
this.lastItem = this.barcode;
|
||||
|
@ -311,8 +309,7 @@ export class InventoryListPage {
|
|||
let json_constructor = new EncodeJSONRead;
|
||||
let method = "product.product";
|
||||
let fields = ["name", "rec_name"];
|
||||
let domain = [json_constructor.createDomain(
|
||||
'rec_name', '=', barcode)];
|
||||
let domain = [json_constructor.createDomain('code', '=', barcode)];
|
||||
|
||||
json_constructor.addNode(method, domain, fields);
|
||||
let json = json_constructor.createJson();
|
||||
|
@ -374,8 +371,7 @@ export class InventoryListPage {
|
|||
}
|
||||
|
||||
public setDefaultFields(){
|
||||
this.inventory_fields = ["product.name", "product.rec_name", "product.codes",
|
||||
"product", "quantity", "expected_quantity"];
|
||||
this.inventory_fields = ['product:["rec_name", "name", "code"]', 'quantity', 'expected_quantity'];
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -428,10 +424,12 @@ export class InventoryListPage {
|
|||
* Hides the current loading component on the screen
|
||||
*/
|
||||
private hideLoading() {
|
||||
this.loading.dismiss();
|
||||
// Send event to cancel timeout
|
||||
this.events.publish("Loading done")
|
||||
//this.myInput2.setFocus();
|
||||
if (this.loading) {
|
||||
this.loading.dismiss();
|
||||
// Send event to cancel timeout
|
||||
this.events.publish("Loading done")
|
||||
//this.myInput2.setFocus();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -32,8 +32,7 @@ export class LocationInventoryPage extends InfiniteList implements AfterViewInit
|
|||
public navParams: NavParams, public events: Events) {
|
||||
super(navCtrl, trytond_provider, events)
|
||||
this.method = "stock.location";
|
||||
this.domain = [new EncodeJSONRead().createDomain("type",
|
||||
"=", "storage")];
|
||||
this.domain = [new EncodeJSONRead().createDomain("type", "=", "storage")];
|
||||
this.fields = ["name", "code"]
|
||||
this.loadData();
|
||||
this.blur_element = true;
|
||||
|
@ -88,8 +87,7 @@ export class LocationInventoryPage extends InfiniteList implements AfterViewInit
|
|||
goForward() {
|
||||
console.log("Searching for code", this.itemInput);
|
||||
let json_constructor = new EncodeJSONRead();
|
||||
let search_domain = [json_constructor.createDomain(
|
||||
"rec_name", "=", this.itemInput)]
|
||||
let search_domain = [json_constructor.createDomain("rec_name", "=", this.itemInput)]
|
||||
let fields = ['name', 'code']
|
||||
let method = "stock.location"
|
||||
json_constructor.addNode(method, search_domain, fields)
|
||||
|
|
Loading…
Reference in a new issue