"""
Constants and enums for Odoo MCP.
Centralizes all Odoo model names, field mappings, and enumeration values.
"""
from __future__ import annotations
from enum import StrEnum
from typing import Final
# =============================================================================
# Odoo Model Names
# =============================================================================
class OdooModel(StrEnum):
"""Odoo model technical names."""
# Projects
PROJECT = "project.project"
TASK = "project.task"
# Time tracking
ANALYTIC_LINE = "account.analytic.line"
ANALYTIC_ACCOUNT = "account.analytic.account"
# Expenses
EXPENSE = "hr.expense"
EXPENSE_SHEET = "hr.expense.sheet"
# Contacts
PARTNER = "res.partner"
# Sales & Invoicing
SALE_ORDER = "sale.order"
SALE_ORDER_LINE = "sale.order.line"
INVOICE = "account.move"
INVOICE_LINE = "account.move.line"
# Products
PRODUCT = "product.product"
PRODUCT_TEMPLATE = "product.template"
PRODUCT_CATEGORY = "product.category"
# HR
EMPLOYEE = "hr.employee"
DEPARTMENT = "hr.department"
LEAVE = "hr.leave"
LEAVE_TYPE = "hr.leave.type"
LEAVE_ALLOCATION = "hr.leave.allocation"
# Resources
CALENDAR = "resource.calendar"
CALENDAR_LEAVES = "resource.calendar.leaves"
# System
CURRENCY = "res.currency"
ATTACHMENT = "ir.attachment"
USER = "res.users"
# =============================================================================
# Expense States
# =============================================================================
class ExpenseState(StrEnum):
"""Expense report states."""
DRAFT = "draft"
REPORTED = "reported"
APPROVED = "approved"
DONE = "done"
REFUSED = "refused"
EXPENSE_STATE_LABELS: Final[dict[str, str]] = {
ExpenseState.DRAFT: "Draft",
ExpenseState.REPORTED: "Submitted",
ExpenseState.APPROVED: "Approved",
ExpenseState.DONE: "Paid",
ExpenseState.REFUSED: "Refused",
}
VALID_EXPENSE_STATES: Final[frozenset[str]] = frozenset(ExpenseState)
# =============================================================================
# Invoice Types
# =============================================================================
class InvoiceType(StrEnum):
"""Invoice move types."""
OUT_INVOICE = "out_invoice" # Customer invoice
IN_INVOICE = "in_invoice" # Vendor bill
OUT_REFUND = "out_refund" # Customer credit note
IN_REFUND = "in_refund" # Vendor credit note
INVOICE_TYPE_LABELS: Final[dict[str, str]] = {
InvoiceType.OUT_INVOICE: "Customer Invoice",
InvoiceType.IN_INVOICE: "Vendor Bill",
InvoiceType.OUT_REFUND: "Customer Credit Note",
InvoiceType.IN_REFUND: "Vendor Credit Note",
}
# =============================================================================
# Sale Order States
# =============================================================================
class SaleOrderState(StrEnum):
"""Sale order states."""
DRAFT = "draft"
SENT = "sent"
SALE = "sale"
DONE = "done"
CANCEL = "cancel"
SALE_ORDER_STATE_LABELS: Final[dict[str, str]] = {
SaleOrderState.DRAFT: "Quotation",
SaleOrderState.SENT: "Quotation Sent",
SaleOrderState.SALE: "Sales Order",
SaleOrderState.DONE: "Locked",
SaleOrderState.CANCEL: "Cancelled",
}
# =============================================================================
# Leave States
# =============================================================================
class LeaveState(StrEnum):
"""Leave request states."""
DRAFT = "draft"
CONFIRM = "confirm"
VALIDATE = "validate"
REFUSE = "refuse"
LEAVE_STATE_LABELS: Final[dict[str, str]] = {
LeaveState.DRAFT: "Draft",
LeaveState.CONFIRM: "To Approve",
LeaveState.VALIDATE: "Approved",
LeaveState.REFUSE: "Refused",
}
# =============================================================================
# Payment Modes
# =============================================================================
class PaymentMode(StrEnum):
"""Expense payment modes."""
COMPANY = "company_account"
EMPLOYEE = "own_account"
# =============================================================================
# Default Values
# =============================================================================
DEFAULT_LIMIT: Final[int] = 50
DEFAULT_OFFSET: Final[int] = 0
MAX_LIMIT: Final[int] = 500