Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix wrong price on supplier order line #8224

Merged

Conversation

aconits
Copy link

@aconits aconits commented Feb 23, 2018

Fix

If we create a supplier order from supplier proposal and the product had buy prices, the best price is used

@@ -1089,7 +1089,7 @@
$lines[$i]->localtax1_tx,
$lines[$i]->localtax2_tx,
$lines[$i]->fk_product > 0 ? $lines[$i]->fk_product : 0,
$productsupplier->product_fourn_price_id,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we do'nt use the best supplier price here, it means we must also not use the $productsupplier->ref_supplier just after ?
And also, it means the
$result = $productsupplier->find_min_price_product_fournisseur(...
that is before is not required ?

This may be used when we create the supplier order from customer order (to buy what we have sell). In such a case, setting price by default to best price is good.
I think we should add a condition to use "0" only when creating from a supplier proposal

@eldy eldy added the PR waiting more user feedbacks We are waiting feedback of someone or more testers to validate this PR label Feb 25, 2018
@aconits
Copy link
Author

aconits commented Mar 2, 2018

This addline come from 'create order' button on supplier proposal and we got some new price ref

Now:
$productsupplier->find_min_price_product_fournisseur() this come to be useless and I'll remove
I have checked for $productsupplier->ref_supplier and we can remove too because this value is never used in the addline() method

@eldy
Copy link
Member

eldy commented Mar 2, 2018

Are you sure this part of code is not also used from the 'create order' button on customer order ?

@aconits
Copy link
Author

aconits commented Mar 5, 2018

I have looked in commande/card.php and don't find any button to create a "supplier proposal"
But I update my PR for more simplicity and manage the case:

  • I remove $productsupplier->find_min_price_product_fournisseur() because it's useless
  • The 8th parameter ($fk_prod_fourn_price) is never save and we dont really need it here (if we come from customer order, let's use $prod->get_buyprice() in the addline() method)
  • The 9th parameter, I give $lines[$i]->ref_fourn (from supplier proposal this attribute is set and other case this one should be empty)

If we come from supplier proposal we should skip in the addline() method the calculation about the best supplier price and use it for the others cases
I add $label as parameter to fill the good column in database like the addline from user interface

@aconits
Copy link
Author

aconits commented Apr 6, 2018

Hi @eldy did you read my last comment ? What do you think about it ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
PR waiting more user feedbacks We are waiting feedback of someone or more testers to validate this PR
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants