fix(pos): resolve integration test failures for CFDI + accounting
- Fix sat_accounts.sql: split multi-row INSERT into individual statements so parent_id subqueries resolve correctly (was producing all NULLs) - Add tenant_config table to v1.0 schema (required by CFDI invoicing) - Seed tenant_config with RFC/regimen during tenant provisioning - Fix cancel_sale to pass complete sale data for accounting reversal - Fix CFDI XML builder: use `or` instead of dict.get() defaults to handle explicit None values from DB (clave_prod_serv, clave_unidad) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -165,6 +165,18 @@ def provision_tenant(name, rfc=None, owner_name="Admin", owner_email=None, owner
|
||||
(owner_id, perm)
|
||||
)
|
||||
|
||||
# Seed tenant_config with RFC and defaults
|
||||
if rfc:
|
||||
tenant_cur.execute("""
|
||||
INSERT INTO tenant_config (key, value) VALUES
|
||||
('tenant_rfc', %s),
|
||||
('tenant_razon_social', %s),
|
||||
('tenant_cp', '00000'),
|
||||
('cfdi_regimen_fiscal', '601'),
|
||||
('cfdi_serie', 'A')
|
||||
ON CONFLICT (key) DO NOTHING
|
||||
""", (rfc, name))
|
||||
|
||||
tenant_conn.commit()
|
||||
tenant_cur.close()
|
||||
tenant_conn.close()
|
||||
|
||||
Reference in New Issue
Block a user