Skip to content

Commit

Permalink
NEW VAT by state (SQL) (#31627)
Browse files Browse the repository at this point in the history
* NEW VAT by state (SQL)

* Revert fk_tva column in department table

* NEW department in vat rates dict
  • Loading branch information
lvessiller-opendsi authored Nov 7, 2024
1 parent 0fb7771 commit 9f76747
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 0 deletions.
5 changes: 5 additions & 0 deletions htdocs/install/mysql/migration/20.0.0-21.0.0.sql
Original file line number Diff line number Diff line change
Expand Up @@ -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);
3 changes: 3 additions & 0 deletions htdocs/install/mysql/tables/llx_c_tva.key.sql
Original file line number Diff line number Diff line change
Expand Up @@ -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);
1 change: 1 addition & 0 deletions htdocs/install/mysql/tables/llx_c_tva.sql
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit 9f76747

Please sign in to comment.