odoo / odoo

Odoo. Open Source Apps To Grow Your Business.
https://www.odoo.com
Other
37.87k stars 24.59k forks source link

TypeError: Cannot read property 'taxes_id' of undefined #64823

Open mawke2020 opened 3 years ago

mawke2020 commented 3 years ago

Impacted versions:

Steps to reproduce:

Current behavior:

Expected behavior:

Video/Screenshot link (optional) error 2021-01-20-08-31-44.txt :

Support ticket number submitted via odoo.com/help (optional):

pedrobaeza commented 3 years ago

Hi, thanks for reporting. Are you able to reproduce the problem in runbot infrastructure (http://runbot.odoo.com/runbot - click on the blue door icon of the version row - admin/admin)?

If so, please explain with all the possible detailed steps to get to the error. Not having them, it's very difficult to hunt down the problem. Please don't be shy of adding details, and even better if you provide some screenshots or videos.

If not, this can be due to a configuration change, a custom/community module you have deployed in your DB or an outdated code. Please report back if it's the case.

For keeping a clean house in this issue tracker, if you don't answer in several days, this will be closed assuming it was one of the stated things.

mawke2020 commented 3 years ago

hi thanks for your replay

still im facing same problem when im using pos sale odoo 14 the TypeError: Cannot read property 'taxes_id' of undefined

https://user-images.githubusercontent.com/75810086/105321393-406eaf00-5b7c-11eb-938e-b1621a892251.mp4

error 2021-01-20-08-31-44.txt

pedrobaeza commented 3 years ago

Unless you reproduce it on runbot and give detailed steps that leads to it, this can't be considered as an Odoo issue, but your end's one.

tingasss commented 3 years ago

Hi @mawke2020,I currently have the same problem! you were able to solve the problem?

pbuitronf commented 3 years ago

@tingasss @mawke2020 I'm having the same issue. Were you able to fix it? Thanks

mhabboush97 commented 3 years ago

@pedrobaeza this issue is reproducible on runbot to reproduce archive a product that is sold in a pos order, then open the order management from pos ui The issue is that get_all_prices function tried to read taxes from product, but product is undefined since it is archived this behavior might also happen in orderline model initialization process. but no errors are thrown there

a side note, the way PoS process order history is buggy, it re-creates orders from data, so if you sold a product with 15% tax, then after a while you changed its tax to 10%, the order that have the product with 15% tax will appear as if it was sold with 10% tax, all fields will be incorrect, product price, order taxes & order total @caburj

pedrobaeza commented 3 years ago

OK, now with that steps it seems we have a reproducible path. @pimodoo maybe you can check this?

jeje1307 commented 3 years ago

I also got the same error on Odoo 14 POS, any news ?

Is there any workaround in the meantime ? Can access my POS anymore because of this error, even after uninstalling odoo and reinstalling it. Same for postgre. Even when restoring an old database, the error is still present. Any advice would be appreciated.

mhabboush97 commented 3 years ago

@jeje1307 this issue happens when you have archived/deleted product that is in a pos order with pos order management enabled A simple workaround is to modify the function 'get_all_prices'. At the beginning of the function, check if product is undefined, and is so just return immediately

jeje1307 commented 3 years ago

@mhabboush97 thank you for the information.

Anyone have a procedure (i'm New to odoo) where i can do that in Windows 10 ? Which file or is it in the software ? Or in a file in Python ? Sorry for the inconvenient, and thank you very much for your help.

mhabboush97 commented 3 years ago

@jeje1307 a very naïve and quick solution is to navigate here https://github.com/odoo/odoo/blob/b16413a5d2072efcae619f968ea9f772f6654efa/addons/point_of_sale/static/src/js/models.js#L2278 in your installation files, and add this after the above line if (!product ) return

jeje1307 commented 3 years ago

@mhabboush97 Thank you so much, it worked like a charm.

mhabboush97 commented 3 years ago

@pedrobaeza @pimodoo a similar error also happens when you previously sold a product with tracking enabled, then disabled tracking and opened order management. It happens because init from json will try to append the tracking lines to the order line, but will throw error because the product doesn't have pack_lot_lines (because currently tracking is set to none)

pedrobaeza commented 3 years ago

Well, you mustn't do such things and don't remove tracking when the product has been used.

mhabboush97 commented 3 years ago

@pedrobaeza not really, maybe if a product when out of stock, and before restocking it I don't want to track it anymore, happens? but that's just a side effect of a bigger problem, creating order lines from products themselves instead of reading the data from the server

pedrobaeza commented 3 years ago

You shouldn't do that, even if no current stock in physical locations, as there's still quants in other virtual locations.

jeje1307 commented 3 years ago

As you already know, i'm not a programmer, but from a user stand point, I can say, if a software allow you to brake it by using it. There is an issue. So indeed, creating order lines from products themselves instead of reading the data from the server is a big issue.

I downloaded Odoo community. Made a simple PoS with 10 articles, ran it 1 day and next day i already encouter such errors that make the PoS unavailable. Something should be done.

In any way, I admire you all, for working on such big project and always improving it.

@mhabboush97 adding this line of code : if (!product ) return Over the line you told me at L2278 made my PoS work again, but only for a day. Now, I encounter this error image , did i do something wrong ?

Here in text file : error 2021-03-09-15-08-51.txt

I should probably do a new clear install. When I reinstall Odoo on a virtual machine and restore my database, it work perfectly. When I uninstall it on my computer and reinstall it and restore the databse, the error is still there. I will figure something out.

Thank you in any case.

mhabboush97 commented 3 years ago

@jeje1307 this happens when you leave active order in a pos session, close the session, archive (other actions might trigger the error as well?) a product that is in an orderline in that active order, open the session again.

@pedrobaeza another issue to fix I think, right?

pedrobaeza commented 3 years ago

Although it's true that you can crash the system doing such things, adding a lot of constraints of don't things adds a code complexity that it's not too much rewarded due to all the possible failing conditions. For me, it's common sense to not do certain things that involve opened PoS sessions.

mhabboush97 commented 3 years ago

@pedrobaeza I recently encountered this issue when I leave product X in active PoS order and close the session, untick available_in_pos for product X, open the session again. Session doesn't open for same error in this ticket

pedrobaeza commented 3 years ago

For me it's the same: you shouldn't do such thing or expect side effects. Adding constraints for every possible user action is barely impossible and performance catastrophic. Just add to your knowledge that you can't do such thing, which is by logic.

I still let if Odoo team thinks this constraint still worths to be added even if we lose some performance.

mhabboush97 commented 3 years ago

@pedrobaeza what do you mean by such a thing? removing product from PoS? changing available pricelists when session is already closed? changing product taxes? changing product tracking? All those actions either directly or indirectly stops PoS from working Not to mention what I mentioned in https://github.com/odoo/odoo/issues/64823#issuecomment-790606185 and I am developer, so I can fix those issues for my clients, I am just notifying the Odoo team for some of the issues I find so they can provide better experience for end-users with no development background, but just wondering why little interest in fixing them

Yenthe666 commented 3 years ago

Debatable @pedrobaeza, Odoo POS does break easily on this kind of stuff. Let's ask @pimodoo

cameleonRuoi commented 3 years ago

it happens to me now, i just clear cache, and we don't use taxes so i set all sale taxe to false.

mamiu commented 3 years ago

Is there a solution now? I don't think it's that one although it works.

@pimodoo is assigned to this issue but hasn't commented on it yet. I'm keen to hear his assessment.

framirez07 commented 2 years ago

Clearing the browser cache worked for me.

krutin123 commented 2 years ago

@tingasss @mawke2020 I'm having the same issue. Were you able to fix it? Thanks

need to remove cache and cookies from browser