fix: order product

This commit is contained in:
ilham
2021-12-15 08:51:05 +07:00
parent e8bbc1e554
commit 53575f36d6
9 changed files with 125 additions and 54 deletions

View File

@@ -83,6 +83,14 @@ export class UsersService {
dataCoaWallet.coaEntityManager = manager;
await this.coaService.create(dataCoaWallet);
const dataCoaAR = new InputCoaDto();
dataCoaAR.user = userData;
dataCoaAR.balanceType = balanceType.DEBIT;
dataCoaAR.relatedUserId = superior.id;
dataCoaAR.type = coaType.ACCOUNT_RECEIVABLE;
dataCoaAR.coaEntityManager = manager;
await this.coaService.create(dataCoaAR);
if (createUserDto.superior) {
const dataCoaAP = new InputCoaDto();
dataCoaAP.user = userData;
@@ -91,14 +99,6 @@ export class UsersService {
dataCoaAP.type = coaType.ACCOUNT_PAYABLE;
dataCoaAP.coaEntityManager = manager;
await this.coaService.create(dataCoaAP);
const dataCoaAR = new InputCoaDto();
dataCoaAR.user = userData;
dataCoaAR.balanceType = balanceType.DEBIT;
dataCoaAR.relatedUserId = superior.id;
dataCoaAR.type = coaType.ACCOUNT_RECEIVABLE;
dataCoaAR.coaEntityManager = manager;
await this.coaService.create(dataCoaAR);
}
});
@@ -169,7 +169,7 @@ export class UsersService {
where: {
username: username,
},
relations: ['roles'],
relations: ['superior', 'roles', 'partner'],
});
} catch (e) {
if (e instanceof EntityNotFoundError) {