GithubHelp home page GithubHelp logo

Comments (24)

guewen avatar guewen commented on August 23, 2024 2

Worth to note this module has another big design issue. It replaces the Manyone towards pos.category on the field product_template.pos_categ_id by a Many2one towards product.category. As soon as you will want to upgrade the base module point_of_sale, this one will try to create a Foreign Key towards product.category and fail (letting the database blocked in an intermediate state) because the ids might not exist in this table.

IMO this module should either be reworked in a clean way, either be removed.

from pos.

StefanRijnhart avatar StefanRijnhart commented on August 23, 2024 1

In case you were wondering like I was, this problem did not affect 8.0 or 9.0. The bug was introduced here, during the migration to 10.0, by not returning a call to super but returning only a reference to the super method instead: https://github.com/OCA/pos/pull/158/files#diff-a2bb6a42189587ba52241d71ea03f98eL104

Thank you @flotho for doing all this investigation and pinpointing the problem to this particular module.

from pos.

flotho avatar flotho commented on August 23, 2024

Hi,
I made additionnal tests :

  • OCA/pos : 10.0 ddfab70 OCA Transbot updated translations from Transifex
  • odoo/odoo : 10.0 89cade3bffc [FIX] pos_restaurant: wrap product names on OrderChangeReceipt

Same result, all the FK disappearing from tables, Does anyone reproduce this ?

from pos.

pedrobaeza avatar pedrobaeza commented on August 23, 2024

Which module from OCA/pos? Check in runbot if it happens the same.

from pos.

flotho avatar flotho commented on August 23, 2024

I'm trying each module one by one to identify

from pos.

flotho avatar flotho commented on August 23, 2024

Well it looks like that pos_remove_category caused the problem. I'll recheck

from pos.

flotho avatar flotho commented on August 23, 2024

Well, I confirm that having the module pos_remove_category cause the problem. I made those tests :

  • Creating db with adding module from oca/pos one by one, retsart odoo between each addition
    ** => everything work fine except when pos_remove_category is present in the addons path
  • Creating db with all the module except pos_remove_category
    ** => Everything Ok
  • creating db with only pos_remove_categ => make FK disappear

i'm suspecting the ir.module.module dependency so that I tried to comment the init part.

There's something I can't log/ identify more without your support. Thanks in advance.
regards

from pos.

flotho avatar flotho commented on August 23, 2024

@pedrobaeza it's not really easy for me to try on runbot because no error make the creation failed. Sadly there also nothing special in the logs. The db is created but the table structure haven't got anymore FK. I discovered that when a product.template has been deleted and its associated product.product still living its own ....
not easy to debug this one

from pos.

legalsylvain avatar legalsylvain commented on August 23, 2024

Thanks @flotho for reporting this problem.

This line seems to create your bug. (not tested)
https://github.com/OCA/pos/blob/10.0/pos_remove_pos_category/models/product.py#L89

Solution 1 : full refactoring
My point of view is that this module is not very clean, and should be refactored :

  • do not alter database.
  • while loading product, remove pos_categ_id field, add the product_categ_id, and at the end of the load, initialize the pos_categ_id with the product_categ_id
  • drop auto_end function and all product overload.
  • product_category.available_in_pos : could be computed. (optional) (if category has products that can be sold in PoS.)

Solution 2 : more easy.

  • disable _auto_end function. (The module will not work anymore correctly), but the repo will be safe.

@simone, @sylvainc. Could you take a look ?

Note : this problem is present on odoo8 too.
https://github.com/OCA/pos/blob/8.0/pos_remove_pos_category/product.py#L105

from pos.

flotho avatar flotho commented on August 23, 2024

Hi everyone,
Additionnal question, once this module is not present in the addons_path, do you think that an -u all will re-add all the FK on an already created database?
regards

from pos.

pedrobaeza avatar pedrobaeza commented on August 23, 2024

Yeah, this is very critical. Who was the original author/migrator? Is he/she (or anyone else) going to attend this? If not, we should remove it.

from pos.

sylvainc avatar sylvainc commented on August 23, 2024

from pos.

legalsylvain avatar legalsylvain commented on August 23, 2024

Done : PR to review :
8.0 : #201
9.0 : #202
10.0 : #203

from pos.

flotho avatar flotho commented on August 23, 2024

Thanks folks, needless to say that it had badside effects on my actual prod databases. Hopefully, -u all re-added all the FK.
regards

from pos.

simahawk avatar simahawk commented on August 23, 2024

@flotho thanks for spotting this! 👍 for removal.

from pos.

legalsylvain avatar legalsylvain commented on August 23, 2024

Thanks @StefanRijnhart for this explanation.

from pos.

simahawk avatar simahawk commented on August 23, 2024

holy 💩 I'm gonna bury myself... 😢
sorry for the mess guys... 🔫

from pos.

Cedric-Pigeon avatar Cedric-Pigeon commented on August 23, 2024

@pedrobaeza @sylvainc @flotho @legalsylvain @simahawk Can you restore this addon. The fix is proposed for a long time and works fine... #182

from pos.

pedrobaeza avatar pedrobaeza commented on August 23, 2024

Please restore the addon and add the patch in your PR, and if everything is correct, we merge at once.

from pos.

Cedric-Pigeon avatar Cedric-Pigeon commented on August 23, 2024

Please revert your merge, it is more simple. I pointed everyone in my PR months ago.

from pos.

pedrobaeza avatar pedrobaeza commented on August 23, 2024

Sorry, but we can't allowed a module that breaks whole installation. Restore it in your PR and when merged, everything will work correctly. You can press yourself in revert commit, and GitHub will propose a new PR. Cherry-pick your commit in top of it and it's done.

from pos.

Cedric-Pigeon avatar Cedric-Pigeon commented on August 23, 2024

Ok you are right. I renamed my PR description and add the revert of the removal.

from pos.

pedrobaeza avatar pedrobaeza commented on August 23, 2024

Thanks for the understanding, @Cedric-Pigeon

from pos.

sylvainc avatar sylvainc commented on August 23, 2024

Thanks you all

from pos.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.