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:
Marc
2026-04-12 18:41:57 +02:00
parent 2c7c1e6c88
commit 66383adf06
87 changed files with 14696 additions and 654 deletions

View File

@@ -66,8 +66,39 @@ func initResUsers() {
String: "Share User", Compute: "_compute_share", Store: true,
Help: "External user with limited access (portal/public)",
}),
orm.Char("signup_token", orm.FieldOpts{String: "Signup Token"}),
orm.Datetime("signup_expiration", orm.FieldOpts{String: "Signup Token Expiration"}),
)
// _compute_share: portal/public users have share=true (not in group_user).
// Mirrors: odoo/addons/base/models/res_users.py Users._compute_share()
m.RegisterMethod("_compute_share", func(rs *orm.Recordset, args ...interface{}) (interface{}, error) {
env := rs.Env()
// Look up group_user ID
var groupUserID int64
err := env.Tx().QueryRow(env.Ctx(),
`SELECT g.id FROM res_groups g
JOIN ir_model_data imd ON imd.res_id = g.id AND imd.model = 'res.groups'
WHERE imd.module = 'base' AND imd.name = 'group_user'`).Scan(&groupUserID)
if err != nil {
return nil, nil // Can't determine, skip
}
for _, id := range rs.IDs() {
var inGroup bool
err := env.Tx().QueryRow(env.Ctx(),
`SELECT EXISTS(
SELECT 1 FROM res_groups_res_users_rel
WHERE res_groups_id = $1 AND res_users_id = $2
)`, groupUserID, id).Scan(&inGroup)
if err != nil {
continue
}
env.Model("res.users").Browse(id).Write(orm.Values{"share": !inGroup})
}
return nil, nil
})
// -- Methods --
// action_get returns the "Change My Preferences" action for the current user.