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: vat management for credit notes (and negative quantities) #5380

Closed
wants to merge 5 commits into from
Closed

FIX: vat management for credit notes (and negative quantities) #5380

wants to merge 5 commits into from

Conversation

altairis-tof
Copy link
Contributor

in vat reports, vat was positive even if total_ht was negative, so vat reports were false (case of credit notes)

@altairis-tof
Copy link
Contributor Author

TODO: find why total_vat is stored in absolute value in invoice table

@altairis-tof
Copy link
Contributor Author

i got it ! when you edit a credit note line, if you put a positive price, this price is converted to negative but vat remains positive !

@altairis-tof altairis-tof changed the title FIX: vat should be same sign as total FIX: vat management for credit notes (and negative quantities) Jun 21, 2016
@eldy eldy added the Priority - High / Blocking This is a security hole or a bug that make a feature not possible to use or very expected feature. label Jun 23, 2016
$this->line->total_tva = $total_tva;
$this->line->total_localtax1 = $total_localtax1;
$this->line->total_localtax2 = $total_localtax2;
$this->line->total_tva = (($this->type==self::TYPE_CREDIT_NOTE||$qty<0)?-abs($total_tva):$total_tva); // For credit note and if qty is negative, total is negative
Copy link
Member

Choose a reason for hiding this comment

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

Fix into function addline looks good to me. However this part seems to be here to manage corrupted data in base due to old bug ? Right ? If i am right, it should be fixed by a sql request and not into core code. For example by adding the sql that fix data into file repair.sql

@eldy eldy closed this in 9b50150 Jun 23, 2016
@eldy eldy removed the Priority - High / Blocking This is a security hole or a bug that make a feature not possible to use or very expected feature. label Jun 23, 2016
@altairis-tof
Copy link
Contributor Author

i disagree.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants