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

Point Of Sale Fiscal don`t working #9815

Closed
ilyasProgrammer opened this Issue Nov 30, 2015 · 2 comments

Comments

Projects
None yet
3 participants
@ilyasProgrammer

ilyasProgrammer commented Nov 30, 2015

Problem:
Point of sale ignoring fiscal.

Steps to reproduce problem:

  1. Create two tax (e.g. 10% and 15%) including in price.
  2. Create the product and set up tax for it that included in price.
  3. Create new fiscal and do tax mapping 10% replacing 15%.
  4. Create new Point Of Sale Sale and add created taxes.
  5. Open POS and ad that product in order.
  6. Than apply fiscal on it.
  7. Payment. Cash. Validate.
  8. Close POS.
  9. Push Validate and Close.
    You will got ISSUE "Cannot create unbalanced journal entry."

Reason of ISSUE as i presume (look up method "_create_account_move_line" in point_of_sale.py):
In point_of_sale.py line:

for tax in account_tax_obj.browse(cr, uid, taxes, context=context).compute_all(line.price_unit * (100.0-line.discount) / 100.0, cur, line.qty)['taxes']:

as result ignoring fiscal.

Fix way as i suppose:

#Add this before call compute_all
+taxes = account_tax_obj.browse(cr, uid, taxes, context=context)
+m_price = line.price_unit * (100.0-line.discount) / 100.0
+m_fiscal = order.fiscal_position_id
+   if m_fiscal:
+       taxes = m_fiscal.map_tax(taxes)
#And replace like this
-for tax in account_tax_obj.browse(cr, uid, taxes, context=context).compute_all(line.price_unit * (100.0-line.discount) / 100.0, cur, line.qty)['taxes']:
+for tax in taxes.compute_all(m_price, cur, line.qty, product=line.product_id, partner=line.order_id.partner_id or False)['taxes']:

Its analogy of _amount_line_tax in pos_order class.

Than you got it to work properly. But i have tested it superficially so its has to be done deeply.

@jorenvo jorenvo self-assigned this Dec 1, 2015

@jorenvo jorenvo closed this in d37c8ef Dec 1, 2015

@jorenvo

This comment has been minimized.

Show comment
Hide comment
@jorenvo

jorenvo Dec 1, 2015

Contributor

Thanks for the report, it's fixed. You were right btw, we did not use the mapped taxes when creating the account moves, because of this the pos would attempt to create unbalanced lines (where paid != amount of order), which caused the problem.

Contributor

jorenvo commented Dec 1, 2015

Thanks for the report, it's fixed. You were right btw, we did not use the mapped taxes when creating the account moves, because of this the pos would attempt to create unbalanced lines (where paid != amount of order), which caused the problem.

jorenvo added a commit to odoo-dev/odoo that referenced this issue Dec 1, 2015

[FIX] point_of_sale: use mapped taxes when creating account moves
We have a tax_ids_after_fiscal_position field on pos.order.line that
contains the mapped taxes. We should use that to create the account
moves. Otherwise the Point of Sale will create unbalanced journal
entries.

Fixes odoo#9815
@flotho

This comment has been minimized.

Show comment
Hide comment
@flotho

flotho Jan 28, 2016

Contributor

I think it probably coming from a bad way taxes are handled : #10648

Contributor

flotho commented Jan 28, 2016

I think it probably coming from a bad way taxes are handled : #10648

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment