fix: item category with item form.

This commit is contained in:
Ahmed Bouhuolia
2020-11-11 11:50:23 +02:00
parent aabd42a7a1
commit 3616b31270
2 changed files with 5 additions and 5 deletions

View File

@@ -139,7 +139,7 @@ function ItemFormPrimarySection({
categoriesList={categoriesList} categoriesList={categoriesList}
selecetedCategoryId={values.category_id} selecetedCategoryId={values.category_id}
onCategorySelected={(category) => { onCategorySelected={(category) => {
setFieldValue('item_category_id', category.id); setFieldValue('category_id', category.id);
}} }}
popoverProps={{ minimal: true }} popoverProps={{ minimal: true }}
/> />

View File

@@ -80,7 +80,7 @@ export default class ItemsCategoriesController extends BaseController {
return [ return [
check('name').exists().trim().escape(), check('name').exists().trim().escape(),
check('parent_category_id') check('parent_category_id')
.optional({ nullable: true, checkFalsy: true }) .optional({ nullable: true })
.isNumeric() .isNumeric()
.toInt(), .toInt(),
check('description') check('description')
@@ -88,15 +88,15 @@ export default class ItemsCategoriesController extends BaseController {
.trim() .trim()
.escape(), .escape(),
check('sell_account_id') check('sell_account_id')
.optional({ nullable: true, checkFalsy: true }) .optional({ nullable: true })
.isNumeric() .isNumeric()
.toInt(), .toInt(),
check('cost_account_id') check('cost_account_id')
.optional() .optional({ nullable: true })
.isNumeric() .isNumeric()
.toInt(), .toInt(),
check('inventory_account_id') check('inventory_account_id')
.optional() .optional({ nullable: true })
.isNumeric() .isNumeric()
.toInt(), .toInt(),
] ]