fix(core-flows,order): return damaged items (#8818)

This commit is contained in:
Carlos R. L. Rodrigues
2024-08-27 11:21:10 -03:00
committed by GitHub
parent 0c4f4c8a11
commit ff6fcfb139
5 changed files with 56 additions and 0 deletions

View File

@@ -3685,6 +3685,25 @@
"nullable": false,
"mappedType": "json"
},
"damaged_quantity": {
"name": "damaged_quantity",
"type": "numeric",
"unsigned": false,
"autoincrement": false,
"primary": false,
"nullable": false,
"default": "0",
"mappedType": "decimal"
},
"raw_damaged_quantity": {
"name": "raw_damaged_quantity",
"type": "jsonb",
"unsigned": false,
"autoincrement": false,
"primary": false,
"nullable": false,
"mappedType": "json"
},
"return_id": {
"name": "return_id",
"type": "text",

View File

@@ -0,0 +1,18 @@
import { Migration } from "@mikro-orm/migrations"
export class Migration20240827133639 extends Migration {
async up(): Promise<void> {
this.addSql(
'alter table if exists "return_item" add column if not exists "damaged_quantity" numeric not null default 0, add column if not exists "raw_damaged_quantity" jsonb not null;'
)
}
async down(): Promise<void> {
this.addSql(
'alter table if exists "return_item" drop column if exists "damaged_quantity";'
)
this.addSql(
'alter table if exists "return_item" drop column if exists "raw_damaged_quantity";'
)
}
}

View File

@@ -77,6 +77,12 @@ export default class ReturnItem {
@Property({ columnType: "jsonb" })
raw_received_quantity: BigNumberRawValue
@MikroOrmBigNumberProperty()
damaged_quantity: Number | number = 0
@Property({ columnType: "jsonb" })
raw_damaged_quantity: BigNumberRawValue
@ManyToOne(() => Return, {
columnType: "text",
fieldName: "return_id",