Ticket #1153 (new defect)

Opened 2 years ago

Last modified 2 years ago

field value is set, after calling new() in parent-child situation

Reported by: kweinert Assigned to: somebody
Priority: minor Milestone: 0.8.3
Component: biz Version: 0.8.2
Keywords: Cc:

Description

In a master-detail situation with foreign key constraint master.key == details.key_ref. master.key is not primary key and hence not autopopulated.

When I call master.new(), then master.key is set to 0. I was expecting it to be None, since I did not specify any default value. Test case attached (test_default).

This happens sometimes to fields that are not under a foreign key contraint, too; but I am currently not able to make a test case for this.

Kind regards, Karsten Weinert.

Attachments

test_ParentChildWithRefToNonPK.py (5.2 kB) - added by kweinert on 05/20/08 05:19:05.
test case

Change History

05/20/08 05:19:05 changed by kweinert

  • attachment test_ParentChildWithRefToNonPK.py added.

test case

05/20/08 05:29:53 changed by ed

This behavior is by design. Columns in new records are defaulted to their "empty" value for their data type. If you need to initialize values for columns other than an autopopulated PK, you need to write that code in the bizobj's onNew() method, or set it in the DefaultValues? property.