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.", }), ) }