Punto 7: gerencia puede corregir tickets sin cancelarlos (lineas, precios, descuento y notas) con ajuste automatico de monedero e inventario
This commit is contained in:
@@ -365,6 +365,8 @@ export interface ConfigAuditResponse {
|
||||
page: number;
|
||||
page_size: number;
|
||||
total_pages: number;
|
||||
/** Módulos posibles según la selección del modelo (fallback: MODULOS local) */
|
||||
modulos?: { value: string; label: string }[];
|
||||
message?: string;
|
||||
}
|
||||
|
||||
@@ -474,6 +476,33 @@ export interface SaleLine {
|
||||
is_prescribed?: boolean;
|
||||
prescribed_by_id?: number | null;
|
||||
prescribed_by?: string | null;
|
||||
/** La línea vendió un paquete de sesiones: cantidad y precio no se editan
|
||||
* libremente (el saldo del paciente depende de ellos). */
|
||||
paquete_id?: number | null;
|
||||
paquete?: string;
|
||||
sesiones?: number;
|
||||
}
|
||||
|
||||
/** Edición de un ticket ya emitido (gerencia): reemplaza líneas e importes. */
|
||||
export interface SaleEditLine {
|
||||
id?: number;
|
||||
service_id?: number | null;
|
||||
item_id?: number | null;
|
||||
paquete_id?: number | null;
|
||||
description: string;
|
||||
quantity: number;
|
||||
price_unit: number;
|
||||
prescribed_by_id?: number | null;
|
||||
}
|
||||
|
||||
export interface SaleEditResult {
|
||||
prev_total: number;
|
||||
total: number;
|
||||
diff: number;
|
||||
points_adjusted: number;
|
||||
stock_moves: number;
|
||||
packages_cancelled: number;
|
||||
warnings: string[];
|
||||
}
|
||||
|
||||
export interface CommissionRow {
|
||||
@@ -1892,6 +1921,18 @@ export const odooApi = {
|
||||
return data;
|
||||
},
|
||||
|
||||
/** Corrige un ticket ya emitido sin cancelarlo (gerencia / admin). */
|
||||
async updateSale(id: number, payload: {
|
||||
motivo: string;
|
||||
lines?: SaleEditLine[];
|
||||
discount?: number;
|
||||
notes?: string;
|
||||
date?: string;
|
||||
}): Promise<{ status: string; sale: Sale; result: SaleEditResult }> {
|
||||
const { data } = await axios.put(`${ODOO_BASE}/skeen/frontend/v1/sales/${id}`, payload);
|
||||
return data;
|
||||
},
|
||||
|
||||
// Última venta del paciente con precios actuales del catálogo (POS: repetir venta)
|
||||
async getLastSale(patientId: number): Promise<LastSaleResponse> {
|
||||
const { data } = await axios.get(`${ODOO_BASE}/skeen/frontend/v1/sales/last`, { params: { patient_id: patientId } });
|
||||
|
||||
Reference in New Issue
Block a user