Complete ORM core: _inherits, Related write-back, Copy, constraints
Batch 1 (quick-fixes): - Field.Copy attribute + IsCopyable() method for copy control - Constraints now run in Write() (was only Create — bug fix) - Readonly fields silently skipped in Write() - active_test: auto-filter archived records in Search() Batch 2 (Related field write-back): - preprocessRelatedWrites() follows FK chain and writes to target model - Enables Settings page to edit company name/address/etc. - Loop protection via _write_related_depth context counter Batch 3 (_inherits delegation): - SetupAllInherits() generates Related fields from parent models - preprocessInheritsCreate() auto-creates parent records on Create - Declared on res.users, res.company, product.product - Called in LoadModules before compute setup Batch 4 (Copy method): - Recordset.Copy(defaults) with blacklist, IsCopyable check - M2M re-linking, rec_name "(copy)" suffix - Replaces simplified copy case in server dispatch Batch 5 (Onchange compute): - RunOnchangeComputes() triggers dependent computes on field change - Virtual record (ID=-1) with client values in cache - Integrated into onchange RPC handler Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -11,6 +11,7 @@ func initResCompany() {
|
||||
m := orm.NewModel("res.company", orm.ModelOpts{
|
||||
Description: "Companies",
|
||||
Order: "sequence, name",
|
||||
Inherits: map[string]string{"res.partner": "partner_id"},
|
||||
})
|
||||
|
||||
// -- Identity --
|
||||
|
||||
@@ -16,6 +16,7 @@ func initResUsers() {
|
||||
m := orm.NewModel("res.users", orm.ModelOpts{
|
||||
Description: "Users",
|
||||
Order: "login",
|
||||
Inherits: map[string]string{"res.partner": "partner_id"},
|
||||
})
|
||||
|
||||
// -- Authentication --
|
||||
|
||||
@@ -131,6 +131,7 @@ func initProductProduct() {
|
||||
m := orm.NewModel("product.product", orm.ModelOpts{
|
||||
Description: "Product",
|
||||
Order: "default_code, name, id",
|
||||
Inherits: map[string]string{"product.template": "product_tmpl_id"},
|
||||
})
|
||||
|
||||
m.AddFields(
|
||||
|
||||
Reference in New Issue
Block a user