Fix P0-P2 bugs: sale.order M2M, display_name, DefaultGet
P0: Fix sale.order creation (was completely broken) - Corrected M2M junction table name from sale_order_line_account_tax_rel to account_tax_sale_order_line_rel (ORM sorts alphabetically) - Added fallback in BeforeCreate if sequence generation fails P1: Add display_name as magic field on ALL models - Added to addMagicFields() in pkg/orm/model.go (like Python BaseModel) - Computed on-the-fly in Read() from recName field, no DB column - Removed explicit display_name from res.partner (now auto-inherited) P2: Add DefaultGet hooks for sale.order and purchase.order - Sets company_id, currency_id, date_order/date_planned from environment - Follows same pattern as account.move's DefaultGet Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -20,7 +20,6 @@ func initResPartner() {
|
||||
// -- Identity --
|
||||
m.AddFields(
|
||||
orm.Char("name", orm.FieldOpts{String: "Name", Required: true, Index: true}),
|
||||
orm.Char("display_name", orm.FieldOpts{String: "Display Name", Compute: "_compute_display_name", Store: true}),
|
||||
orm.Char("ref", orm.FieldOpts{String: "Reference", Index: true}),
|
||||
orm.Selection("type", []orm.SelectionItem{
|
||||
{Value: "contact", Label: "Contact"},
|
||||
|
||||
Reference in New Issue
Block a user