feat: ability to publish and draft inventory adjustment transactions.

This commit is contained in:
a.bouhuolia
2021-01-11 21:05:23 +02:00
parent bbd4ee5962
commit 463c748717
8 changed files with 142 additions and 21 deletions

View File

@@ -20,7 +20,7 @@ export default class InventoryAdjustment extends TenantModel {
* Virtual attributes.
*/
static get virtualAttributes() {
return ['inventoryDirection'];
return ['inventoryDirection', 'isPublished'];
}
/**
@@ -30,6 +30,14 @@ export default class InventoryAdjustment extends TenantModel {
return InventoryAdjustment.getInventoryDirection(this.type);
}
/**
* Detarmines whether the adjustment is published.
* @return {boolean}
*/
get isPublished() {
return !!this.publishedAt;
}
static getInventoryDirection(type) {
const directions = {
'increment': 'IN',