NEW VAT by state (SQL) (#31627)

* NEW VAT by state (SQL)

* Revert fk_tva column in department table

* NEW department in vat rates dict
This commit is contained in:
lvessiller-opendsi 2024-11-07 20:55:50 +01:00 committed by GitHub
parent 0fb7771f2d
commit 9f76747aff
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 9 additions and 0 deletions

View File

@ -310,3 +310,8 @@ ALTER TABLE llx_propaldet ADD COLUMN subprice_ttc double(24,8) DEFAULT 0 after s
ALTER TABLE llx_propaldet ADD COLUMN multicurrency_subprice_ttc double(24,8) DEFAULT 0 after multicurrency_subprice;
ALTER TABLE llx_supplier_proposaldet ADD COLUMN subprice_ttc double(24,8) DEFAULT 0 after subprice;
ALTER TABLE llx_supplier_proposaldet ADD COLUMN multicurrency_subprice_ttc double(24,8) DEFAULT 0 after multicurrency_subprice;
-- Add VAT by department
ALTER TABLE llx_c_tva ADD COLUMN fk_department_buyer integer DEFAULT NULL AFTER fk_pays;
ALTER TABLE llx_c_tva ADD INDEX idx_tva_fk_department_buyer (fk_department_buyer);
ALTER TABLE llx_c_tva ADD CONSTRAINT fk_tva_fk_department_buyer FOREIGN KEY (fk_department_buyer) REFERENCES llx_c_departements (rowid);

View File

@ -20,3 +20,6 @@
ALTER TABLE llx_c_tva ADD UNIQUE INDEX uk_c_tva_id (entity, fk_pays, code, taux, recuperableonly);
-- ALTER TABLE llx_c_tva ADD UNIQUE INDEX uk_c_tva_id (fk_pays, code, recuperableonly); -- Not yet possible for compatibility reason, where old code is ''
ALTER TABLE llx_c_tva ADD INDEX idx_tva_fk_department_buyer (fk_department_buyer);
ALTER TABLE llx_c_tva ADD CONSTRAINT fk_tva_fk_department_buyer FOREIGN KEY (fk_department_buyer) REFERENCES llx_c_departements (rowid);

View File

@ -23,6 +23,7 @@ create table llx_c_tva
rowid integer NOT NULL AUTO_INCREMENT PRIMARY KEY,
entity integer DEFAULT 1 NOT NULL,
fk_pays integer NOT NULL,
fk_department_buyer integer DEFAULT NULL, -- Id of department for VAT rule or NULL to keep rule on country
code varchar(10) DEFAULT '', -- a key to describe vat entry, for example FR20
type_vat smallint NOT NULL DEFAULT 0, -- 0: all, 1: sell, 2: purchase
taux double NOT NULL,