Merge pull request 'fixes #6169 invoiceIn con valores predeterminados' (!1728) from 6169---invoice-in-basic-data--dms-refactor into dev
gitea/salix/pipeline/head This commit looks good
Details
gitea/salix/pipeline/head This commit looks good
Details
Reviewed-on: #1728 Reviewed-by: Juan Ferrer <juan@verdnatura.es>
This commit is contained in:
commit
08e97b6a19
|
@ -67,17 +67,22 @@ class Controller extends Section {
|
||||||
}
|
}
|
||||||
|
|
||||||
openCreateDialog() {
|
openCreateDialog() {
|
||||||
this.dms = {
|
const params = {filter: {
|
||||||
reference: null,
|
where: {code: 'invoiceIn'}
|
||||||
warehouseId: null,
|
}};
|
||||||
companyId: null,
|
this.$http.get('DmsTypes/findOne', {params}).then(res => {
|
||||||
dmsTypeId: null,
|
this.dms = {
|
||||||
description: null,
|
reference: this.invoiceIn.supplierRef,
|
||||||
hasFile: true,
|
warehouseId: this.vnConfig.warehouseFk,
|
||||||
hasFileAttached: true,
|
companyId: this.vnConfig.companyFk,
|
||||||
files: null
|
dmsTypeId: res.data.id,
|
||||||
};
|
description: this.invoiceIn.supplier.name,
|
||||||
this.$.dmsCreateDialog.show();
|
hasFile: true,
|
||||||
|
hasFileAttached: true,
|
||||||
|
files: null
|
||||||
|
};
|
||||||
|
this.$.dmsCreateDialog.show();
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
downloadFile(dmsId) {
|
downloadFile(dmsId) {
|
||||||
|
|
|
@ -6,6 +6,7 @@ class Controller extends Section {
|
||||||
this.invoiceIn = {};
|
this.invoiceIn = {};
|
||||||
if (this.$params && this.$params.supplierFk)
|
if (this.$params && this.$params.supplierFk)
|
||||||
this.invoiceIn.supplierFk = this.$params.supplierFk;
|
this.invoiceIn.supplierFk = this.$params.supplierFk;
|
||||||
|
this.invoiceIn.issued = Date.vnNew();
|
||||||
}
|
}
|
||||||
|
|
||||||
get companyFk() {
|
get companyFk() {
|
||||||
|
|
|
@ -1,52 +0,0 @@
|
||||||
import './index.js';
|
|
||||||
import watcher from 'core/mocks/watcher';
|
|
||||||
|
|
||||||
describe('InvoiceIn', () => {
|
|
||||||
describe('Component vnInvoiceInCreate', () => {
|
|
||||||
let controller;
|
|
||||||
let $element;
|
|
||||||
|
|
||||||
beforeEach(ngModule('invoiceIn'));
|
|
||||||
|
|
||||||
beforeEach(inject(($componentController, $rootScope) => {
|
|
||||||
const $scope = $rootScope.$new();
|
|
||||||
$scope.watcher = watcher;
|
|
||||||
$element = angular.element('<vn-invoice-in-create></vn-invoice-in-create>');
|
|
||||||
controller = $componentController('vnInvoiceInCreate', {$element, $scope});
|
|
||||||
controller.$params = {};
|
|
||||||
}));
|
|
||||||
|
|
||||||
afterEach(() => {
|
|
||||||
$element.remove();
|
|
||||||
});
|
|
||||||
|
|
||||||
describe('onInit()', () => {
|
|
||||||
it(`should defined the controller's invoiceIn property`, () => {
|
|
||||||
expect(controller.invoiceIn).toBeUndefined();
|
|
||||||
|
|
||||||
controller.$onInit();
|
|
||||||
|
|
||||||
expect(controller.invoiceIn).toEqual({});
|
|
||||||
});
|
|
||||||
|
|
||||||
it(`should define invoiceIn and it's supplierFk when received via params`, () => {
|
|
||||||
controller.$params.supplierFk = 'supplierId';
|
|
||||||
|
|
||||||
controller.$onInit();
|
|
||||||
|
|
||||||
expect(controller.invoiceIn.supplierFk).toEqual('supplierId');
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
describe('onSubmit()', () => {
|
|
||||||
it(`should redirect to basic data by calling the $state.go function`, () => {
|
|
||||||
jest.spyOn(controller.$state, 'go');
|
|
||||||
|
|
||||||
controller.onSubmit();
|
|
||||||
|
|
||||||
expect(controller.$state.go).toHaveBeenCalledWith('invoiceIn.card.basicData', {id: 1234});
|
|
||||||
});
|
|
||||||
});
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
Loading…
Reference in New Issue