diff --git a/modules/order/back/methods/order-row/specs/addToOrder.spec.js b/modules/order/back/methods/order-row/specs/addToOrder.spec.js index 13dfe26fb..e96798c95 100644 --- a/modules/order/back/methods/order-row/specs/addToOrder.spec.js +++ b/modules/order/back/methods/order-row/specs/addToOrder.spec.js @@ -15,7 +15,7 @@ describe('order addToOrder()', () => { orderFk: 20, items: [{ itemFk: 1, - quantity: 1, + quantity: 10, warehouseFk: 1 }] }; diff --git a/modules/order/back/methods/order/updateBasicData.js b/modules/order/back/methods/order/updateBasicData.js index 821f5c836..6a8148a21 100644 --- a/modules/order/back/methods/order/updateBasicData.js +++ b/modules/order/back/methods/order/updateBasicData.js @@ -37,9 +37,9 @@ module.exports = Self => { let validUpdateParams = [ 'clientFk', - 'address_id', + 'addressFk', 'landed', - 'agency_id', + 'agencyModeFk', 'note', ]; diff --git a/modules/order/back/models/order.json b/modules/order/back/models/order.json index 00cff995a..0ae4dfd7b 100644 --- a/modules/order/back/models/order.json +++ b/modules/order/back/models/order.json @@ -26,6 +26,20 @@ "columnName": "customer_id" } }, + "addressFk": { + "type": "Number", + "required": true, + "mysql": { + "columnName": "address_id" + } + }, + "agencyModeFk": { + "type": "Number", + "required": true, + "mysql": { + "columnName": "agency_id" + } + }, "companyFk": { "type": "Number", "required": true, @@ -75,7 +89,6 @@ }, "address": { "type": "belongsTo", - "required": true, "model": "Address", "foreignKey": "address_id" }, diff --git a/modules/order/front/basic-data/index.html b/modules/order/front/basic-data/index.html index bcfd8eb0f..50e8c9901 100644 --- a/modules/order/front/basic-data/index.html +++ b/modules/order/front/basic-data/index.html @@ -34,7 +34,7 @@ search-function="{or: [{id: $search}, {nickname: {like: '%'+$search+'%'}}]}" show-field="nickname" value-field="id" - field="$ctrl.order.address_id"> + field="$ctrl.order.addressFk"> {{::nickname}} @@ -52,7 +52,7 @@ search-function="{or: [{id: $search}, {name: {like: '%'+$search+'%'}}]}" show-field="name" value-field="id" - field="$ctrl.order.agency_id"> + field="$ctrl.order.agencyModeFk"> {{::id}}: {{::name}} diff --git a/modules/order/front/basic-data/index.js b/modules/order/front/basic-data/index.js index 6b77aa50b..e82d6a591 100644 --- a/modules/order/front/basic-data/index.js +++ b/modules/order/front/basic-data/index.js @@ -9,12 +9,12 @@ class Controller { $scope.addressModel.where = {clientFk: newValue.id}; $scope.addressModel.refresh(); if (isDirty) - this.order.address_id = newValue.defaultAddressFk; + this.order.addressFk = newValue.defaultAddressFk; isDirty = true; } else { $scope.addressModel.clear(); if (isDirty) - this.order.address_id = null; + this.order.addressFk = null; } }); } diff --git a/modules/order/front/basic-data/index.spec.js b/modules/order/front/basic-data/index.spec.js index 1b4516530..54809f6d4 100644 --- a/modules/order/front/basic-data/index.spec.js +++ b/modules/order/front/basic-data/index.spec.js @@ -16,7 +16,7 @@ describe('Order', () => { .respond([{id: 2, nickname: 'address 2'}]); $httpBackend.whenGET(/^\/api\/Clients/) .respond([{id: 1, defaultAddressFk: 1}]); - $scope.order = {clientFk: 1, address_id: 1}; + $scope.order = {clientFk: 1, addressFk: 1}; let $element = $compile('')($scope); $httpBackend.flush(); @@ -28,7 +28,7 @@ describe('Order', () => { controller.selection = {id: 2, defaultAddressFk: 2}; $scope.$digest(); - expect(controller.order.address_id).toEqual(2); + expect(controller.order.addressFk).toEqual(2); }); }); }); diff --git a/package-lock.json b/package-lock.json index 2d7618fbb..d3dc2c650 100644 --- a/package-lock.json +++ b/package-lock.json @@ -3762,7 +3762,7 @@ "dot-prop": { "version": "4.2.0", "resolved": "https://registry.npmjs.org/dot-prop/-/dot-prop-4.2.0.tgz", - "integrity": "sha512-tUMXrxlExSW6U2EXiiKGSBVdYgtV8qlHL+C10TsW4PURY/ic+eaysnSkwB4kA/mBlCyy/IKDJ+Lc3wbWeaXtuQ==", + "integrity": "sha1-HxngwuGqDjJ5fEl5nyg3rGr2nFc=", "dev": true, "requires": { "is-obj": "^1.0.0" @@ -3935,7 +3935,7 @@ }, "jsonfile": { "version": "2.4.0", - "resolved": "http://registry.npmjs.org/jsonfile/-/jsonfile-2.4.0.tgz", + "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-2.4.0.tgz", "integrity": "sha1-NzaitCi4e72gzIO1P6PWM6NcKug=", "dev": true, "requires": { @@ -7160,7 +7160,7 @@ "is-absolute": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/is-absolute/-/is-absolute-1.0.0.tgz", - "integrity": "sha1-OV4a6EsR8mrReV5zwXN45IowFXY=", + "integrity": "sha512-dOWoqflvcydARa360Gvv18DZ/gRuHKi2NU/wU5X1ZFzdYfH29nkiNZsF3mp4OJ3H4yo9Mx8A/uAGNzpzPN3yBA==", "dev": true, "requires": { "is-relative": "^1.0.0", @@ -7423,7 +7423,7 @@ "is-relative": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/is-relative/-/is-relative-1.0.0.tgz", - "integrity": "sha1-obtpNc6MXboei5dUubLcwCDiJg0=", + "integrity": "sha512-Kw/ReK0iqwKeu0MITLFuj0jbPAmEiOsIwyIXvvbfa6QfmN9pkD1M+8pdk7Rl/dTKbH34/XBFMbgD4iMJhLQbGA==", "dev": true, "requires": { "is-unc-path": "^1.0.0" @@ -7457,7 +7457,7 @@ "is-unc-path": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/is-unc-path/-/is-unc-path-1.0.0.tgz", - "integrity": "sha1-1zHoiY7QkKEsNSrS6u1Qla0yLJ0=", + "integrity": "sha512-mrGpVd0fs7WWLfVsStvgF6iEJnbjDFZh9/emhRDcGWTduTfNHd9CHeUwH3gYIjdbwo4On6hunkztwOaAw0yllQ==", "dev": true, "requires": { "unc-path-regex": "^0.1.2" @@ -7863,7 +7863,7 @@ "karma-chrome-launcher": { "version": "2.2.0", "resolved": "https://registry.npmjs.org/karma-chrome-launcher/-/karma-chrome-launcher-2.2.0.tgz", - "integrity": "sha512-uf/ZVpAabDBPvdPdveyk1EPgbnloPvFFGgmRhYLTDH7gEB4nZdSBk8yTU47w1g/drLSx5uMOkjKk7IWKfWg/+w==", + "integrity": "sha1-zxudBxNswY/iOTJ9JGVMPbw2is8=", "dev": true, "requires": { "fs-access": "^1.0.0", @@ -9671,7 +9671,7 @@ "dependencies": { "commander": { "version": "1.0.4", - "resolved": "http://registry.npmjs.org/commander/-/commander-1.0.4.tgz", + "resolved": "https://registry.npmjs.org/commander/-/commander-1.0.4.tgz", "integrity": "sha1-Xt6xruI8T7VBprcNaSq+8ZZpotM=", "dev": true, "requires": { @@ -11638,7 +11638,7 @@ }, "readable-stream": { "version": "1.1.14", - "resolved": "http://registry.npmjs.org/readable-stream/-/readable-stream-1.1.14.tgz", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-1.1.14.tgz", "integrity": "sha1-fPTFTvZI44EwhMY23SB54WbAgdk=", "dev": true, "requires": { @@ -11650,7 +11650,7 @@ }, "string_decoder": { "version": "0.10.31", - "resolved": "http://registry.npmjs.org/string_decoder/-/string_decoder-0.10.31.tgz", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-0.10.31.tgz", "integrity": "sha1-YuIDvEF2bGwoyfyEMB2rHFMQ+pQ=", "dev": true }, @@ -12901,7 +12901,7 @@ }, "string-width": { "version": "1.0.2", - "resolved": "http://registry.npmjs.org/string-width/-/string-width-1.0.2.tgz", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-1.0.2.tgz", "integrity": "sha1-EYvfW4zcUaKn5w0hHgfisLmxB9M=", "dev": true, "requires": { @@ -14368,7 +14368,7 @@ "touch": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/touch/-/touch-3.1.0.tgz", - "integrity": "sha512-WBx8Uy5TLtOSRtIq+M03/sKDrXCLHxwDcquSP2c43Le03/9serjQBIztjRz6FkJez9D/hleyAXTBGLwwZUw9lA==", + "integrity": "sha1-/jZfX3XsntTlaCXgu3bSSrdK+Ds=", "dev": true, "requires": { "nopt": "~1.0.10" @@ -15966,7 +15966,7 @@ "write-file-atomic": { "version": "2.3.0", "resolved": "https://registry.npmjs.org/write-file-atomic/-/write-file-atomic-2.3.0.tgz", - "integrity": "sha512-xuPeK4OdjWqtfi59ylvVL0Yn35SF3zgcAcv7rBPFHVaEapaDr4GdGgm3j7ckTwH9wHL7fGmgfAnb0+THrHb8tA==", + "integrity": "sha1-H/YVdcLipOjlENb6TiQ8zhg5mas=", "dev": true, "requires": { "graceful-fs": "^4.1.11",