Merge pull request 'fix_record_direct_problem' (#382) from fix_record_direct_problem into @hera/dev

Reviewed-on: daoyoucloud/tachycode#382
Reviewed-by: sealday <zhanglin@daoyoucloud.com>
This commit is contained in:
sealday 2024-03-15 13:54:00 +08:00
commit 8f1b7693a8

View File

@ -27,8 +27,10 @@ export class RecordService {
if (!values) { if (!values) {
return; return;
} }
if (values.record_category === RecordTypes.purchaseDirect || values.record_category === RecordTypes.rentDirect) {
await this.createRecord(model, values, transaction, context, null); await this.createRecord(model, values, transaction, context, null);
} }
}
/** /**
* *
*/ */
@ -648,7 +650,7 @@ export class RecordService {
async createRecord(model, values, transaction, context, updateData) { async createRecord(model, values, transaction, context, updateData) {
delete values.number; delete values.number;
delete values.id; delete values.id;
values.vehicles.forEach((item) => delete item.record_vehicles); values.vehicles?.forEach((item) => delete item.record_vehicles);
//采购直发单 //采购直发单
if (values.record_category === RecordTypes.purchaseDirect && values.category === RecordCategory.purchase2lease) { if (values.record_category === RecordTypes.purchaseDirect && values.category === RecordCategory.purchase2lease) {
const inProject = await this.db.getModel('project').findOne({ const inProject = await this.db.getModel('project').findOne({