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

[v9]Invoices generated from POS are not keeping the right taxes in the invoice #10648

Closed
flotho opened this issue Jan 27, 2016 · 13 comments
Closed
Assignees

Comments

@flotho
Copy link
Contributor

flotho commented Jan 27, 2016

Hi,

I'm working on latest v9, in multi company environment.
Company A parent of company B
A product set with 2 different taxes, one for each company
I create a user with only company B access and accounting rights (BTW, same problem with or without this access right)
First I have this behavior that I consider as a real issue : #10647

On a second part, there is a more consequent issue. In the invoice created for the company B there are some Taxes used for the company A. So there is a mix and so it's impossible to validate the invoice. I was wondering if the logged-in company of the administrator could interfere and actually no, if there are multiple invoices set up on the product, the invoice used is always the one of the company A (parent of B)

Hi @nim-odoo Could it be reviewed? I have other issues (#10572 for example) with multi company and would like to be sure that no bug is hiding in the hood

Thanks

@nim-odoo nim-odoo self-assigned this Jan 28, 2016
@flotho
Copy link
Contributor Author

flotho commented Jan 28, 2016

Additionnal info here, I'm using the option that share the products between companies, yet the products are associated to the companyA.
Maybe it could be an part of the answer

@flotho
Copy link
Contributor Author

flotho commented Jan 28, 2016

I also tried something else. With the demo datas, I added a tax for the child company and add it on a product.
With the demo user when I create the pos.order it keeps the both account_taxes!
Amazing

@fpoyer
Copy link

fpoyer commented Jan 28, 2016

Hi,

I'm working on a java API for Odoo (using Apache XML RPC Client) that I test against a demo database, and indeed I don't receive the correct taxes for products in multi-companies cases...

@bwilmus
Copy link

bwilmus commented Jan 28, 2016

I also tried something else. With the demo datas, I added a tax for the child company and add it on a product. With the demo user when I create the pos.order it keeps the both account_taxes!

Same here!
Very strange behavior...

@nim-odoo
Copy link
Contributor

Thanks for reporting, I am having a look at it

@flotho
Copy link
Contributor Author

flotho commented Jan 28, 2016

The taxes sent form the POS to the server are multiple.
It looks like the POS load all the taxes without considering the company of the POS.
How to filter this? Passing context in some function somewhere?
regards

@flotho
Copy link
Contributor Author

flotho commented Jan 28, 2016

couldn't we add a domain on the models account.tax : https://github.com/odoo/odoo/blob/9.0/addons/point_of_sale/static/src/js/models.js#L206

@flotho
Copy link
Contributor Author

flotho commented Jan 28, 2016

Changing the global access rule on account.tax solve the problem but it's not really a good way to do this.
I set :
['|',('company_id','=',False),('company_id','in',[user.company_id.id])]
instead of
['|',('company_id','=',False),('company_id','child_of',[user.company_id.id])]
So the problem is really with the context/domain passed from the POS.

@flotho
Copy link
Contributor Author

flotho commented Jan 29, 2016

Those parts are definitively not doing what expected :

Nowhere company is forced and nowhere taxes are depending properly from the company

@nim-odoo
Copy link
Contributor

The issues probably come from the following commit: a29e291

The PoS user might not be an accountant, so the invoice is created with the SUPERUSER_ID, i.e. the administrator. That would explain why the administrator is the user who created the invoice, and why all taxes appear (record rules don't apply to the SUPERUSER).

@nim-odoo
Copy link
Contributor

@flotho : could you try with these commits #10676

@flotho
Copy link
Contributor Author

flotho commented Jan 30, 2016

Hi @nim-odoo ,

I'm not totally confident with you patch, I'm wondering why you limit your filter on the superuser environment.
Actuallly, when you have multiple companies, you can see thaxes from your child even if you're not an admin. Even if I'm not approving this way of doing (everything in accounting SHOULD be independent and no child_of SHOULD be used in access rules), it still part of the standard so if you're a user form the top level company, all the taxes you'll get will come form all you childs, and you are not super user.
Could you please consider to ALWAYS filter on the current company of the user.

Could you please reopen this one?

@flotho
Copy link
Contributor Author

flotho commented Jan 30, 2016

Additionnaly this behaviour should be also reported in all the orders :

odony referenced this issue Feb 3, 2016
In a multi-company environment, a user from company A which is a parent
of the company B has access to taxes from both companies. The
consequence is that the method _set_taxes will automatically add the
taxes from both companies.
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

No branches or pull requests

4 participants