Merge pull request #33342 from atm-corentin/FIX_default_VAT_code

FIX|Fix # Set field default vat code because it was not set for Variant product
This commit is contained in:
Laurent Destailleur 2025-03-05 15:08:14 +01:00 committed by GitHub
commit c3baca7910
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 3 additions and 3 deletions

View file

@ -1121,6 +1121,7 @@ class Product extends CommonObject
$sql .= ", batch_mask";
$sql .= ", fk_unit";
$sql .= ", mandatory_period";
if (!empty($this->default_vat_code)) $sql.=", default_vat_code";
$sql .= ") VALUES (";
$sql .= "'".$this->db->idate($this->date_creation)."'";
$sql .= ", ".(!empty($this->entity) ? (int) $this->entity : (int) $conf->entity);
@ -1152,8 +1153,8 @@ class Product extends CommonObject
$sql .= ", '".$this->db->escape($this->batch_mask)."'";
$sql .= ", ".($this->fk_unit > 0 ? ((int) $this->fk_unit) : 'NULL');
$sql .= ", '".$this->db->escape((string) $this->mandatory_period)."'";
if (!empty($this->default_vat_code)) $sql.=", '".$this->db->escape($this->default_vat_code)."'";
$sql .= ")";
dol_syslog(get_class($this)."::Create", LOG_DEBUG);
$result = $this->db->query($sql);

View file

@ -577,7 +577,6 @@ class ProductCombination
} else {
$new_price += $variation_price;
}
$ret = $child->updatePrice($new_price, $new_type, $user, $new_vat, $new_min_price, $i, $new_npr, $new_psq, 0, array(), $parent->default_vat_code);
if ($ret < 0) {
@ -607,7 +606,7 @@ class ProductCombination
$new_price += $this->variation_price;
}
$ret = $child->updatePrice($new_price, $new_type, $user, $new_vat, $new_min_price, 1, $new_npr, $new_psq);
$ret = $child->updatePrice($new_price, $new_type, $user, $new_vat, $new_min_price, 1, $new_npr, $new_psq,0, array(), $parent->default_vat_code);
if ($ret < 0) {
$this->db->rollback();