Massive module expansion: Stock, CRM, HR — +2895 LOC

Stock (1193→2867 LOC):
- Valuation layers (FIFO consumption, product valuation history)
- Landed costs (split by equal/qty/cost/weight/volume, validation)
- Stock reports (by product, by location, move history, valuation)
- Forecasting (on_hand + incoming - outgoing per product)
- Batch transfers (confirm/assign/done with picking delegation)
- Barcode interface (scan product/lot/package/location, qty increment)

CRM (233→1113 LOC):
- Sales teams with dashboard KPIs (opportunity count/amount/unassigned)
- Team members with lead capacity + round-robin auto-assignment
- Lead extended: activities, UTM tracking, scoring, address fields
- Lead methods: merge, duplicate, schedule activity, set priority/stage
- Pipeline analysis (stages, win rate, conversion, team/salesperson perf)
- Partner onchange (auto-populate contact from partner)

HR (223→520 LOC):
- Leave management: hr.leave.type, hr.leave, hr.leave.allocation
  with full approval workflow (draft→confirm→validate/refuse)
- Attendance: check in/out with computed worked_hours
- Expenses: hr.expense + hr.expense.sheet with state machine
- Skills/Resume: skill types, employee skills, resume lines
- Employee extensions: skills, attendance, leave count links

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Marc
2026-04-03 23:21:52 +02:00
parent 0a76a2b9aa
commit bdb97f98ad
16 changed files with 2895 additions and 0 deletions

View File

@@ -0,0 +1,59 @@
package models
import "odoo-go/pkg/orm"
// initHrExpense registers the hr.expense and hr.expense.sheet models.
// Mirrors: odoo/addons/hr_expense/models/hr_expense.py
func initHrExpense() {
orm.NewModel("hr.expense", orm.ModelOpts{
Description: "Expense",
Order: "date desc, id desc",
}).AddFields(
orm.Char("name", orm.FieldOpts{String: "Description", Required: true}),
orm.Many2one("employee_id", "hr.employee", orm.FieldOpts{String: "Employee", Required: true}),
orm.Many2one("product_id", "product.product", orm.FieldOpts{String: "Expense Type"}),
orm.Date("date", orm.FieldOpts{String: "Date", Required: true}),
orm.Monetary("total_amount", orm.FieldOpts{String: "Total", Required: true, CurrencyField: "currency_id"}),
orm.Monetary("unit_amount", orm.FieldOpts{String: "Unit Price", CurrencyField: "currency_id"}),
orm.Float("quantity", orm.FieldOpts{String: "Quantity", Default: 1}),
orm.Many2one("currency_id", "res.currency", orm.FieldOpts{String: "Currency"}),
orm.Many2one("company_id", "res.company", orm.FieldOpts{String: "Company"}),
orm.Many2one("sheet_id", "hr.expense.sheet", orm.FieldOpts{String: "Expense Report"}),
orm.Many2one("account_id", "account.account", orm.FieldOpts{String: "Account"}),
orm.Selection("state", []orm.SelectionItem{
{Value: "draft", Label: "To Submit"},
{Value: "reported", Label: "Submitted"},
{Value: "approved", Label: "Approved"},
{Value: "done", Label: "Paid"},
{Value: "refused", Label: "Refused"},
}, orm.FieldOpts{String: "Status", Default: "draft"}),
orm.Selection("payment_mode", []orm.SelectionItem{
{Value: "own_account", Label: "Employee (to reimburse)"},
{Value: "company_account", Label: "Company"},
}, orm.FieldOpts{String: "Payment By", Default: "own_account"}),
orm.Text("description", orm.FieldOpts{String: "Notes"}),
orm.Binary("receipt", orm.FieldOpts{String: "Receipt"}),
)
orm.NewModel("hr.expense.sheet", orm.ModelOpts{
Description: "Expense Report",
Order: "create_date desc",
}).AddFields(
orm.Char("name", orm.FieldOpts{String: "Report Name", Required: true}),
orm.Many2one("employee_id", "hr.employee", orm.FieldOpts{String: "Employee", Required: true}),
orm.Many2one("manager_id", "hr.employee", orm.FieldOpts{String: "Manager"}),
orm.One2many("expense_line_ids", "hr.expense", "sheet_id", orm.FieldOpts{String: "Expenses"}),
orm.Monetary("total_amount", orm.FieldOpts{String: "Total", Compute: "_compute_total", Store: true, CurrencyField: "currency_id"}),
orm.Many2one("currency_id", "res.currency", orm.FieldOpts{String: "Currency"}),
orm.Many2one("company_id", "res.company", orm.FieldOpts{String: "Company"}),
orm.Selection("state", []orm.SelectionItem{
{Value: "draft", Label: "Draft"},
{Value: "submit", Label: "Submitted"},
{Value: "approve", Label: "Approved"},
{Value: "post", Label: "Posted"},
{Value: "done", Label: "Paid"},
{Value: "cancel", Label: "Refused"},
}, orm.FieldOpts{String: "Status", Default: "draft"}),
orm.Many2one("account_move_id", "account.move", orm.FieldOpts{String: "Journal Entry"}),
)
}