Files
goodie/addons/mail/models/mail_message.go
Marc 66383adf06 feat: Portal, Email Inbound, Discuss + module improvements
- Portal: /my/* routes, signup, password reset, portal user support
- Email Inbound: IMAP polling (go-imap/v2), thread matching
- Discuss: mail.channel, long-polling bus, DM, unread count
- Cron: ir.cron runner (goroutine scheduler)
- Bank Import, CSV/Excel Import
- Automation (ir.actions.server)
- Fetchmail service
- HR Payroll model
- Various fixes across account, sale, stock, purchase, crm, hr, project

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-12 18:41:57 +02:00

54 lines
1.8 KiB
Go

package models
import "odoo-go/pkg/orm"
// initMailMessage registers the mail.message model.
// Mirrors: odoo/addons/mail/models/mail_message.py
func initMailMessage() {
m := orm.NewModel("mail.message", orm.ModelOpts{
Description: "Message",
Order: "id desc",
RecName: "subject",
})
m.AddFields(
orm.Char("subject", orm.FieldOpts{String: "Subject"}),
orm.Datetime("date", orm.FieldOpts{String: "Date"}),
orm.Text("body", orm.FieldOpts{String: "Contents"}),
orm.Selection("message_type", []orm.SelectionItem{
{Value: "comment", Label: "Comment"},
{Value: "notification", Label: "System notification"},
{Value: "email", Label: "Email"},
{Value: "user_notification", Label: "User Notification"},
}, orm.FieldOpts{String: "Type", Required: true, Default: "comment"}),
orm.Many2one("author_id", "res.partner", orm.FieldOpts{
String: "Author",
Index: true,
Help: "Author of the message.",
}),
orm.Char("model", orm.FieldOpts{
String: "Related Document Model",
Index: true,
}),
orm.Integer("res_id", orm.FieldOpts{
String: "Related Document ID",
Index: true,
}),
orm.Many2one("parent_id", "mail.message", orm.FieldOpts{
String: "Parent Message",
OnDelete: orm.OnDeleteSetNull,
}),
orm.Boolean("starred", orm.FieldOpts{String: "Starred"}),
orm.Char("email_from", orm.FieldOpts{String: "From", Help: "Email address of the sender."}),
orm.Char("reply_to", orm.FieldOpts{String: "Reply To", Help: "Reply-To address."}),
orm.Char("record_name", orm.FieldOpts{
String: "Message Record Name",
Help: "Name of the document the message is attached to.",
}),
orm.Many2many("attachment_ids", "ir.attachment", orm.FieldOpts{
String: "Attachments",
Help: "Attachments linked to this message.",
}),
)
}