Fix: [ bug #1624 ] POS set buy price for margin
Use lowest buying price for margin when selling with POS or external module. A POS user does not worry about suppliers.
This commit is contained in:
parent
18406fc550
commit
b1a4b8e7d0
@ -15,6 +15,7 @@ English Dolibarr ChangeLog
|
||||
- Fix: [ bug #1622 ] Requesting holiday than spans across two years cause high CPU usage by Apache
|
||||
- Fix: [ bug #1595 ] Selected boolean extrafield in intervention creation page, does not save state
|
||||
- Fix: Show sender Country on PDF docs when sender Country <> receiver Country
|
||||
- Fix: [ bug #1624 ] Use lowest buying price for margin when selling with POS
|
||||
|
||||
***** ChangeLog for 3.6.1 compared to 3.6.* *****
|
||||
For users:
|
||||
|
||||
@ -413,7 +413,15 @@ class Propal extends CommonObject
|
||||
|
||||
|
||||
// infos marge
|
||||
$this->line->fk_fournprice = $fk_fournprice;
|
||||
if (!empty($fk_product) && empty($fk_fournprice) && empty($pa_ht)) {
|
||||
// by external module, take lowest buying price
|
||||
include_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.product.class.php';
|
||||
$productFournisseur = new ProductFournisseur($this->db);
|
||||
$productFournisseur->find_min_price_product_fournisseur($fk_product);
|
||||
$this->line->fk_fournprice = $productFournisseur->product_fourn_price_id;
|
||||
} else {
|
||||
$this->line->fk_fournprice = $fk_fournprice;
|
||||
}
|
||||
$this->line->pa_ht = $pa_ht;
|
||||
|
||||
// Mise en option de la ligne
|
||||
@ -565,7 +573,15 @@ class Propal extends CommonObject
|
||||
$this->line->skip_update_total = $skip_update_total;
|
||||
|
||||
// infos marge
|
||||
$this->line->fk_fournprice = $fk_fournprice;
|
||||
if (!empty($fk_product) && empty($fk_fournprice) && empty($pa_ht)) {
|
||||
// by external module, take lowest buying price
|
||||
include_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.product.class.php';
|
||||
$productFournisseur = new ProductFournisseur($this->db);
|
||||
$productFournisseur->find_min_price_product_fournisseur($fk_product);
|
||||
$this->line->fk_fournprice = $productFournisseur->product_fourn_price_id;
|
||||
} else {
|
||||
$this->line->fk_fournprice = $fk_fournprice;
|
||||
}
|
||||
$this->line->pa_ht = $pa_ht;
|
||||
|
||||
$this->line->date_start=$date_start;
|
||||
|
||||
@ -1214,7 +1214,15 @@ class Commande extends CommonOrder
|
||||
$this->line->date_end=$date_end;
|
||||
|
||||
// infos marge
|
||||
$this->line->fk_fournprice = $fk_fournprice;
|
||||
if (!empty($fk_product) && empty($fk_fournprice) && empty($pa_ht)) {
|
||||
// by external module, take lowest buying price
|
||||
include_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.product.class.php';
|
||||
$productFournisseur = new ProductFournisseur($this->db);
|
||||
$productFournisseur->find_min_price_product_fournisseur($fk_product);
|
||||
$this->line->fk_fournprice = $productFournisseur->product_fourn_price_id;
|
||||
} else {
|
||||
$this->line->fk_fournprice = $fk_fournprice;
|
||||
}
|
||||
$this->line->pa_ht = $pa_ht;
|
||||
|
||||
// TODO Ne plus utiliser
|
||||
@ -2421,7 +2429,15 @@ class Commande extends CommonOrder
|
||||
$this->line->skip_update_total=$skip_update_total;
|
||||
|
||||
// infos marge
|
||||
$this->line->fk_fournprice = $fk_fournprice;
|
||||
if (!empty($fk_product) && empty($fk_fournprice) && empty($pa_ht)) {
|
||||
//by external module, take lowest buying price
|
||||
include_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.product.class.php';
|
||||
$productFournisseur = new ProductFournisseur($this->db);
|
||||
$productFournisseur->find_min_price_product_fournisseur($fk_product);
|
||||
$this->line->fk_fournprice = $productFournisseur->product_fourn_price_id;
|
||||
} else {
|
||||
$this->line->fk_fournprice = $fk_fournprice;
|
||||
}
|
||||
$this->line->pa_ht = $pa_ht;
|
||||
|
||||
// TODO deprecated
|
||||
|
||||
@ -2213,7 +2213,15 @@ class Facture extends CommonInvoice
|
||||
$this->line->skip_update_total = $skip_update_total;
|
||||
|
||||
// infos marge
|
||||
$this->line->fk_fournprice = $fk_fournprice;
|
||||
if (!empty($fk_product) && empty($fk_fournprice) && empty($pa_ht)) {
|
||||
// POS or external module, take lowest buying price
|
||||
include_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.product.class.php';
|
||||
$productFournisseur = new ProductFournisseur($this->db);
|
||||
$productFournisseur->find_min_price_product_fournisseur($fk_product);
|
||||
$this->line->fk_fournprice = $productFournisseur->product_fourn_price_id;
|
||||
} else {
|
||||
$this->line->fk_fournprice = $fk_fournprice;
|
||||
}
|
||||
$this->line->pa_ht = $pa_ht;
|
||||
|
||||
if (is_array($array_option) && count($array_option)>0) {
|
||||
@ -3477,6 +3485,14 @@ class FactureLigne extends CommonInvoiceLine
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
// POS or by external module, take lowest buying price
|
||||
if (!empty($this->fk_product) && empty($this->fk_fournprice) && empty($this->pa_ht)) {
|
||||
include_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.product.class.php';
|
||||
$productFournisseur = new ProductFournisseur($this->db);
|
||||
$productFournisseur->find_min_price_product_fournisseur($this->fk_product);
|
||||
$this->fk_fournprice = $productFournisseur->product_fourn_price_id;
|
||||
}
|
||||
|
||||
$this->db->begin();
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user