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>
This commit is contained in:
62
addons/mail/models/mail_activity.go
Normal file
62
addons/mail/models/mail_activity.go
Normal file
@@ -0,0 +1,62 @@
|
||||
package models
|
||||
|
||||
import "odoo-go/pkg/orm"
|
||||
|
||||
// initMailActivity registers the mail.activity model.
|
||||
// Mirrors: odoo/addons/mail/models/mail_activity.py MailActivity
|
||||
func initMailActivity() {
|
||||
m := orm.NewModel("mail.activity", orm.ModelOpts{
|
||||
Description: "Activity",
|
||||
Order: "date_deadline ASC",
|
||||
})
|
||||
|
||||
m.AddFields(
|
||||
orm.Char("res_model", orm.FieldOpts{
|
||||
String: "Related Document Model",
|
||||
Required: true,
|
||||
Index: true,
|
||||
}),
|
||||
orm.Integer("res_id", orm.FieldOpts{
|
||||
String: "Related Document ID",
|
||||
Required: true,
|
||||
Index: true,
|
||||
}),
|
||||
orm.Many2one("activity_type_id", "mail.activity.type", orm.FieldOpts{
|
||||
String: "Activity Type",
|
||||
OnDelete: orm.OnDeleteRestrict,
|
||||
}),
|
||||
orm.Char("summary", orm.FieldOpts{String: "Summary"}),
|
||||
orm.Text("note", orm.FieldOpts{String: "Note"}),
|
||||
orm.Date("date_deadline", orm.FieldOpts{
|
||||
String: "Due Date",
|
||||
Required: true,
|
||||
Index: true,
|
||||
}),
|
||||
orm.Many2one("user_id", "res.users", orm.FieldOpts{
|
||||
String: "Assigned to",
|
||||
Required: true,
|
||||
Index: true,
|
||||
}),
|
||||
orm.Selection("state", []orm.SelectionItem{
|
||||
{Value: "overdue", Label: "Overdue"},
|
||||
{Value: "today", Label: "Today"},
|
||||
{Value: "planned", Label: "Planned"},
|
||||
}, orm.FieldOpts{String: "State", Default: "planned"}),
|
||||
orm.Boolean("done", orm.FieldOpts{String: "Done", Default: false}),
|
||||
// Odoo 19: deadline_range for flexible deadline display
|
||||
orm.Integer("deadline_range", orm.FieldOpts{
|
||||
String: "Deadline Range (Days)", Help: "Number of days before/after deadline for grouping",
|
||||
}),
|
||||
)
|
||||
|
||||
// action_done: mark activity as done
|
||||
// Mirrors: odoo/addons/mail/models/mail_activity.py action_done
|
||||
m.RegisterMethod("action_done", func(rs *orm.Recordset, args ...interface{}) (interface{}, error) {
|
||||
env := rs.Env()
|
||||
for _, id := range rs.IDs() {
|
||||
env.Tx().Exec(env.Ctx(),
|
||||
`UPDATE mail_activity SET done = true WHERE id = $1`, id)
|
||||
}
|
||||
return true, nil
|
||||
})
|
||||
}
|
||||
Reference in New Issue
Block a user