feat: fix R1 pedimento duplication and improve invoice report exports
- Fix bidirectional R1 resolution in all report query builders (Temporary, Definitive, Repair, Export, ExportRepair): use JOIN on pedimento_rectification_origin in both directions so the rectified pedimento number is resolved correctly and not duplicated. - Restore original CSV export format (ValorComercialMN, ValorMPTemp, ValorAgre as separate columns); compute them from item_line_financials SUM instead of invoice-level header totals which were always 0. - Rename CSV column "PEDIMENTO RECTIFICACION" to "PEDIMENTO R1" in both backend csv_utils.py and frontend manual download. - Harden temporary invoice update validator to safely handle null compliance_mx / logistics objects without crashing. - Add R1 rectification fields (es_rectificacion, pedimento_original, etc.) to the pedimento other-data form and initialize their default state. - Remove default companyId parameter from pedimentosApi methods to avoid hardcoded company ID 1. - Minor: whitespace cleanup, error handler adjustments, keyboard manager fix.
This commit is contained in:
@@ -319,6 +319,7 @@ export interface UpdateInvoiceData {
|
||||
cfdi_uuid?: string | null;
|
||||
path_pdf?: string | null;
|
||||
path_xml?: string | null;
|
||||
is_updated?: boolean | null;
|
||||
compliance_mx?: Partial<InvoiceComplianceMx> | null;
|
||||
financials?: Partial<InvoiceFinancials> | null;
|
||||
logistics?: Partial<InvoiceLogistics>[] | null;
|
||||
|
||||
@@ -10,12 +10,12 @@ export interface PedimentoDates {
|
||||
pedimento_date?: string | null;
|
||||
payment_date?: string | null;
|
||||
rectification_payment_date?: string | null;
|
||||
extraction_date?: string | null;
|
||||
extraction_date?: string | null;
|
||||
submission_date?: string | null;
|
||||
eucan_date?: string | null;
|
||||
original_date?: string | null;
|
||||
start_date?: string | null;
|
||||
end_date?: string | null;
|
||||
original_date?: string | null;
|
||||
start_date?: string | null;
|
||||
end_date?: string | null;
|
||||
}
|
||||
|
||||
export interface PedimentoPayments {
|
||||
@@ -279,9 +279,9 @@ export const pedimentosApi = {
|
||||
* @param filters - Filtros opcionales
|
||||
* @param companyId - ID de la compañía (por defecto 1)
|
||||
*/
|
||||
list: (page = 1, pageSize = 50, filters?: PedimentoFilters, companyId = 1) => {
|
||||
list: (page = 1, pageSize = 50, filters?: PedimentoFilters, companyId?: number) => {
|
||||
let url = `/v1/a76/pedimentos/?company_id=${companyId}&page=${page}&page_size=${pageSize}`;
|
||||
|
||||
|
||||
if (filters?.status) {
|
||||
url += `&status=${encodeURIComponent(filters.status)}`;
|
||||
}
|
||||
@@ -291,7 +291,7 @@ export const pedimentosApi = {
|
||||
if (filters?.year) {
|
||||
url += `&year=${encodeURIComponent(filters.year)}`;
|
||||
}
|
||||
|
||||
|
||||
return api.get<PedimentoListResponse>(url);
|
||||
},
|
||||
|
||||
@@ -300,14 +300,14 @@ export const pedimentosApi = {
|
||||
* @param id - ID del pedimento
|
||||
* @param companyId - ID de la compañía (por defecto 1)
|
||||
*/
|
||||
get: (id: number, companyId = 1) => api.get<Pedimento>(`/v1/a76/pedimentos/${id}/?company_id=${companyId}`),
|
||||
get: (id: number, companyId?: number) => api.get<Pedimento>(`/v1/a76/pedimentos/${id}/?company_id=${companyId}`),
|
||||
|
||||
/**
|
||||
* Crea un nuevo pedimento
|
||||
* @param data - Datos del pedimento a crear
|
||||
* @param companyId - ID de la compañía (por defecto 1)
|
||||
*/
|
||||
create: (data: CreatePedimentoData, companyId = 1) =>
|
||||
create: (data: CreatePedimentoData, companyId?: number) =>
|
||||
api.post<Pedimento>(`/v1/a76/pedimentos/?company_id=${companyId}`, data),
|
||||
|
||||
/**
|
||||
@@ -316,7 +316,7 @@ export const pedimentosApi = {
|
||||
* @param data - Datos a actualizar
|
||||
* @param companyId - ID de la compañía (por defecto 1)
|
||||
*/
|
||||
update: (id: number, data: UpdatePedimentoData, companyId = 1) =>
|
||||
update: (id: number, data: UpdatePedimentoData, companyId?: number) =>
|
||||
api.put<Pedimento>(`/v1/a76/pedimentos/${id}/?company_id=${companyId}`, data),
|
||||
|
||||
/**
|
||||
@@ -324,5 +324,5 @@ export const pedimentosApi = {
|
||||
* @param id - ID del pedimento a eliminar
|
||||
* @param companyId - ID de la compañía (por defecto 1)
|
||||
*/
|
||||
delete: (id: number, companyId = 1) => api.delete(`/v1/a76/pedimentos/${id}?company_id=${companyId}`)
|
||||
delete: (id: number, companyId?: number) => api.delete(`/v1/a76/pedimentos/${id}?company_id=${companyId}`)
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user