webERP Forum

Full Version: Add New Item to Stock
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
When I try to add an item, I capture the data in the form and submit it throws me this error:

Database Error : The item could not be added because
Field 'lastcostupdate' doesn't have a default value

Database SQL Failure : The SQL that was used to add the item failed was
INSERT INTO stockmaster (stockid, description, longdescription, categoryid, units, mbflag, eoq, discontinued, controlled, serialised, perishable, volume, kgs, barcode, discountcategory, taxcatid, decimalplaces, shrinkfactor, pansize) VALUES ('1000', 'Test Part', 'Purchase Part Test', 'PLANT', 'each', 'B', '1', '0', '0', '0', '0', '1', '1', '1000', '', '1', '0', '0', '0')


Someone could say that is what is wrong ?

This is my form:

Item Code: 1000
Part Description: TEST
Part Description: PART TEST
Imagen File:
Category: Plant and Equipment
Economi Order Quantity: 0
Packaged Volume: 0
Packaged Weight: 0
Units of Measure: 0
Assembly, kit, manufactured or service: Purchased
Current or Obsolet: Current
Batch, Serial or Lot Control: No Control
Serialised: No
Perishable: No
Decimal Place for display Quantity: 0
Bar Code: 1000
Discount Category:
Tax Category: Taxable Sypply
Pan Size: 0
Shrinkage Factor: 0

Depresiation Type: Straight Line
Annual Depresiation Percentege:

Thanks for your help...
Hi,
Is it a new installed system? What is the version?

Best regards!
Exson
(04-28-2012 12:55 AM)Exsonqu_Qu Wrote: [ -> ]Hi,
Is it a new installed system? What is the version?

Best regards!
Exson

Hi Exson

Yes it is a new installed system, the version is webERP v4.07.7

Best regards!
Dragunmx
Problem is caused by the table stockmaster definition. The column lastcostupdate is set for a default value of NULL but it is also checked for not allowing null values and since it is not specified in the insert, bang zoom to the moon, the insert fails. Simplest fix is to remove the null value not allowed option from the field. This fixes the error (tested on my webERP v4.07.8).

ALTER TABLE `weberpdemo`.`stockmaster` MODIFY COLUMN `lastcostupdate` DATE;

JC
(05-01-2012 12:48 PM)MTPubRadio Wrote: [ -> ]Problem is caused by the table stockmaster definition. The column lastcostupdate is set for a default value of NULL but it is also checked for not allowing null values and since it is not specified in the insert, bang zoom to the moon, the insert fails. Simplest fix is to remove the null value not allowed option from the field. This fixes the error (tested on my webERP v4.07.8).

ALTER TABLE `weberpdemo`.`stockmaster` MODIFY COLUMN `lastcostupdate` DATE;

JC

That fixed it. Thanks a lot MTPubRadio.
Will update the sql upgrade to default this field in future ... thanks for the report
Reference URL's