diff --git a/app/DataMapper/Tax/TaxModel.php b/app/DataMapper/Tax/TaxModel.php index 89872290cfd3..1d6be0261666 100644 --- a/app/DataMapper/Tax/TaxModel.php +++ b/app/DataMapper/Tax/TaxModel.php @@ -55,7 +55,7 @@ class TaxModel { $this->regions->EU->has_sales_above_threshold = false; - $this->regions->EU->tax_all = false; + $this->regions->EU->tax_all_subregions = false; $this->regions->EU->vat_threshold = 10000; $this->euSubRegions(); diff --git a/app/DataMapper/Tax/tax_model.yaml b/app/DataMapper/Tax/tax_model.yaml index 1288ad6320ff..3a1dd31f91d0 100644 --- a/app/DataMapper/Tax/tax_model.yaml +++ b/app/DataMapper/Tax/tax_model.yaml @@ -1,7 +1,7 @@ region: US: - tax_all: false - seller_region: CA + tax_all_subregions: false + seller_subregion: CA has_sales_above_threshold: false subregions: AL: diff --git a/app/Factory/ProductFactory.php b/app/Factory/ProductFactory.php index fbdd90d13264..08e5c5a2b9f6 100644 --- a/app/Factory/ProductFactory.php +++ b/app/Factory/ProductFactory.php @@ -35,7 +35,8 @@ class ProductFactory $product->custom_value3 = ''; $product->custom_value4 = ''; $product->is_deleted = 0; - + $product->tax_id = 1; + return $product; } } diff --git a/database/migrations/2023_03_24_054758_add_client_is_exempt_from_taxes.php b/database/migrations/2023_03_24_054758_add_client_is_exempt_from_taxes.php index 0f340053f1b4..9de246de581d 100644 --- a/database/migrations/2023_03_24_054758_add_client_is_exempt_from_taxes.php +++ b/database/migrations/2023_03_24_054758_add_client_is_exempt_from_taxes.php @@ -2,6 +2,7 @@ use App\Models\Client; use App\Models\Company; +use App\Models\Product; use Illuminate\Support\Facades\Schema; use Illuminate\Database\Schema\Blueprint; use Illuminate\Database\Migrations\Migration; @@ -26,6 +27,10 @@ return new class extends Migration $table->dropColumn('tax_all_products'); }); + Schema::table('products', function (Blueprint $table) { + $table->unsignedInteger('tax_id')->nullable(); // the product tax constant + }); + Company::query() ->cursor() ->each(function ($company) { @@ -40,6 +45,13 @@ return new class extends Migration $client->save(); }); + Product::query() + ->cursor() + ->each(function ($product) { + $product->tax_id = 1; + $product->save(); + }); + } /**