Skip to content

[9.0] [ADD] Self service scale for loose goods and products sold by weight#470

Closed
Fkawala wants to merge 11 commits intoOCA:9.0from
Fkawala:9.0-self-weight-pr
Closed

[9.0] [ADD] Self service scale for loose goods and products sold by weight#470
Fkawala wants to merge 11 commits intoOCA:9.0from
Fkawala:9.0-self-weight-pr

Conversation

@Fkawala
Copy link

@Fkawala Fkawala commented Mar 14, 2020

This add-on allows you to run a grocery in a Bring Your Own Container (BYOC) schema. With this add-on, your customers will be able to buy loose goods using their own reusable containers. This add-on also enables customers to weight their vegetables and fruits before they checkout. To weight fruit and vegetable before checkout will speed up the checkout and make your customer happier.

The self-service BYOC scheme has six steps:

  1. The customer weighs her-his pot and sticks the tare barcode onto the pot.
  2. The customer puts loose goods into the labeled pot.
  3. The customer scans the tare barcode. POS saves the tare value.
  4. The customer weighs the pot with loose goods inside. POS computes the price to pay from gross weight and tare weight.
  5. The customer gets a price barcode label indicating the price to pay.
  6. During checkout, the cashier swiftly scans the price barcode label.

This add-on requires you to have a barcode label printer and an electronic scale. Your customers are expected to use this add-on in a self-service way. This add-on adds multiple news screens that are displayed only on the selected POS.

This add-on displays only the products that are meant to be weighted with a scale.

This addon depends on:

  • point_of_sale
  • pos_barcode_tare

You can test with the following tare barcode: 0700000001235 it'll tare for 0.123kg.
Demo data include an article with a weight code bar: 2112345000008.

Below are screens for a POS with this add-on enabled.

The default screen:
default_screen

The product screen:
product_screen

The tare barcode scanning screen:
tare_scan_screen

A price barcode looks like:
barcode

The configuration screen of POS has one new option:
config

@OCA-git-bot
Copy link
Contributor

Hi @Fkawala,
some modules you are maintaining are being modified, check this out!

@Fkawala
Copy link
Author

Fkawala commented Mar 14, 2020

Hello @legalsylvain this is related to #436! Could you have a look whenever you have the time? Thank you in advance + have a nice day.

@Fkawala
Copy link
Author

Fkawala commented Mar 14, 2020

Hello @robinkeunen, if you have some spare time to review this PR that would be great! Thank you in advance!

@Fkawala
Copy link
Author

Fkawala commented Mar 15, 2020

FYI. this addon is conflicting with pos_empty_home. I'm not sure which is the best way to solve this conflict. One solution could be to update pos_empty_home for it to have an on/off toggle option in the POS model. I could code that if this is a good enough solution.

@Fkawala
Copy link
Author

Fkawala commented Mar 20, 2020

Hello @legalsylvain, I hope you're doing as well as possible given the current circumstances. Do you think that you'll have some spare time to spend on this? All the best and stay safe.

@legalsylvain
Copy link
Contributor

Huge work to review. I'll take a time this weel if possible.
I'm in favor to accept this PR, once reviewed, as it is on some "obosolete" v9 branch and to make some work and refactoring on 12 branch with pos_tare, and other module.
Kind regards.

@robinkeunen
Copy link

robinkeunen commented Mar 20, 2020

Hi @Fkawala, sorry for the late response, I got myself some new eyes (operation). I'll passed it on to the colleagues.

@Fkawala
Copy link
Author

Fkawala commented Mar 20, 2020

@robinkeunen I hope your new eyes are working fine! Thank you for the message to your colleagues.

@legalsylvain Thank you, I agree with you, clean merge+refacto for v12 is the best approach. To the best I can foresee, I'll have some time to spend on v12 related work during the coming months.

Thank you both and best regards

@vvrossem
Copy link

Hello @Fkawala, @robinkeunen told me about this PR, I will try to test and review the module this week ✌️

@Fkawala
Copy link
Author

Fkawala commented Mar 23, 2020

Howdy @vvrossem thank you in advance! Feel free to reach out if I can clarify anything on this PR. Have a nice day!

Copy link

@vvrossem vvrossem left a comment

Choose a reason for hiding this comment

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

Hello @Fkawala,
I hope you are doing well.
Great job. It's nice to see another point of view on the self-service scale: building a POC was my internship project!

Please find below some questions/comments:

  • The possibility to weigh multiple products and then print all the label at once is refreshing, but I am unsure it's compatible with printers that automatically unstick the label from the paper roll.
  • For security, close_button in the HeaderButtonWidget shouldn't be accessible to customers : they could close the POS session and enter in the backend.
  • Insignificant detail, but when no electronic scale is configured, the You did not configured this POS to use the electronic scale (...) popup is shown when selecting a product but not when taring a container

@vvrossem
Copy link

self_weighing or self_weighting ? 🤔

@Fkawala
Copy link
Author

Fkawala commented Mar 27, 2020

Hello @vvrossem , I'm doing well :) I hope you're doing good as well. Thank you for the thoughtful review, this is very useful. Please find below my inline response to your comments.

  • The possibility to weigh multiple products and then print all the labels at once is refreshing, but I am unsure it's compatible with printers that automatically unstick the label from the paper roll.

Our printer put itself on hold until the user has taken the printed label. I know that all the printers out there won't behave the same. I'll add a setting field to enable/disable that feature.

  • For security, close_button in the HeaderButtonWidget shouldn't be accessible to customers: they could close the POS session and enter in the backend.

Good point, I'll disable it. For security reasons, we plan to open this POS using a dedicated odoo account with very restricted rights.

  • Insignificant detail, but when no electronic scale is configured, the You did not configure this POS to use the electronic scale (...) popup is shown when selecting a product but not when taring a container.

Good catch! I'll fix that.

@Fkawala
Copy link
Author

Fkawala commented Mar 27, 2020

self_weighing or self_weighting ? 🤔

Arg weighing and not weighting ... will fix!

@Fkawala Fkawala requested a review from vvrossem March 27, 2020 18:58
@Fkawala
Copy link
Author

Fkawala commented Mar 28, 2020

Hello @legalsylvain, I went through our discussion about merging #447 and #436 we had during the code review of #447.

Back then you suggested we should include information needed to reconstruct the gross weight on each order line. I think this requirement is now fulfilled. The tare weight is now displayed on each order line. This is also the case for the pos_barcode_tare addon.

FWIW the barcode label also shows the net weight and the tare weight (see example below).

barcode

I would like to get started on the migration of this addon to v12. As you suggested we could refactorize code from this PR, the pos_barcode_tare addon and your #436 PR in one single addon for v12. I'm not familiar enough with your code to evaluate how complex the refactorization will be. Would you have any suggestions on how we/I should proceed to get the refactorization work started?

Thank you and have a nice rest of the weekend!

@Fkawala
Copy link
Author

Fkawala commented Apr 3, 2020

Hello @vvrossem I hope you're doing good. By any chance would you have five extra minutes to spend reviewing the change I did? All the issues you've raised are solved and I did a fair bit of work on the documentation.

@Fkawala
Copy link
Author

Fkawala commented May 3, 2020

Hello @vvrossem, I'm trying to make this add-on work with a label printer (eg. zebra gk4200) that would be connected via USB to the self-service weighing station. I see two options:

  1. Define a new add-on hw_printer. That add-on would be based on hw_escpos but would be a mere wrapper around pycups. That add-on would have a single /printHTTP verb and would contain no specific logic related to the self-weighing task.

  2. Hack my way in using base_report_to_printer to trigger a printing on the label printer, but that entails numerous questions I have no answers for.

Could you please share your thoughts on this? Am I missing a third option there? If not which option would you vote for?

Thank you in advance for your guidance and time!

ps; @legalsylvain @robinkeunen any comments will be warmly welcomed.

@Fkawala
Copy link
Author

Fkawala commented May 11, 2020

Hello @vvrossem, I'm trying to make this add-on work with a label printer (eg. zebra gk4200) that would be connected via USB to the self-service weighing station. I see two options:

  1. Define a new add-on hw_printer. That add-on would be based on hw_escpos but would be a mere wrapper around pycups. That add-on would have a single /printHTTP verb and would contain no specific logic related to the self-weighing task.
  2. Hack my way in using base_report_to_printer to trigger a printing on the label printer, but that entails numerous questions I have no answers for.

Could you please share your thoughts on this? Am I missing a third option there? If not which option would you vote for?

Thank you in advance for your guidance and time!

ps; @legalsylvain @robinkeunen any comments will be warmly welcomed.

@vvrossem I'm starting to work on this today and will implement option 1. Please do let me know if you would not pursue option 1. Thank you and have a great day.

@vvrossem
Copy link

@Fkawala I would definitely pursue option 1. When I was working on a self-service scale POC, I noted the importance to build a hw_zpl2 module to load on a posbox[less] in order to communicate with a zebra printer. Thank you so much for your time and contribution on this !
PS : I will review this PR at the end of the day, I haven't had found the time so far

@Fkawala
Copy link
Author

Fkawala commented May 11, 2020

@Fkawala I would definitely pursue option 1. When I was working on a self-service scale POC, I noted the importance to build a hw_zpl2 module to load on a posbox[less] in order to communicate with a zebra printer. Thank you so much for your time and contribution on this !
PS : I will review this PR at the end of the day, I haven't had found the time so far

Hello @vvrossem! I'm happy to learn I'm heading in the good direction :) No rush for the review this work is on hold until I figure out the label printer part of it. Have a nice day!

@Fkawala
Copy link
Author

Fkawala commented May 13, 2020

Hello, @legalsylvain I see you contributed to https://github.com/akretion/pywebdriver/. I think this is exactly what I need to send raw data to the label printer. Would you have any thoughts to share on that? Would it be a problem for this addon to depend on pywebdriver to send raw data with the label printer? Thank you in advance for your inputs!

@legalsylvain
Copy link
Contributor

Hi @Fkawala. Indeed, pywebdriver is a possibility. Well, in fact for each communication between Odoo and a device, there is two part : a front end part and the hardware part. The front end communicates the hardware part, with an http request. For exemple

for each connexion, pywebdriver can replace the hw_ part.

So, in this module pos_self_weighing you could make http request, and then in a hardware part handle the communication :
-> via an odoo module hw_zp12 that will be installed in you Iot / Pos Box.
-> or via a new feature in pywebdriver.

Please before develop hardware communication, please ping akretion team, that have still worked on zebra. see for exemple @PierrickBrun comment here : pywebdriver/pywebdriver#49 (comment)

kind regards.

@Fkawala
Copy link
Author

Fkawala commented May 14, 2020

Hi @Fkawala. Indeed, pywebdriver is a possibility. Well, in fact for each communication between Odoo and a device, there is two part : a front end part and the hardware part. The front end communicates the hardware part, with an http request. For exemple

for each connexion, pywebdriver can replace the hw_ part.

So, in this module pos_self_weighing you could make http request, and then in a hardware part handle the communication :
-> via an odoo module hw_zp12 that will be installed in you Iot / Pos Box.
-> or via a new feature in pywebdriver.

Please before develop hardware communication, please ping akretion team, that have still worked on zebra. see for exemple @PierrickBrun comment here : akretion/pywebdriver#49 (comment)

kind regards.

Hello Sylvain,

Thanks for the thoughtful answer, that is very much appreciated.

My understanding (was/still is) that the pywebdriver has a CUPS driver. I plan to use that driver as it, without any modification. I should be able to do that because the zebra printer works with CUPS "out of the box". The only caveat is to use the ZPL-II language and configure pycups to send raw data. The ZPL-II encoded label would be generated in this module (pos_self_weighing).

Can you foresee any problem with that approach?

Thank you & have a nice day

@PierrickBrun
Copy link

Hi @Fkawala we already did this to print labels using ZPL on a Zebra printer, so this is a working approach.

We used https://github.com/akretion/ak-odoo-incubator/tree/10.0/proxy_action to help us doing that

@Fkawala
Copy link
Author

Fkawala commented May 14, 2020

Hi @Fkawala we already did this to print labels using ZPL on a Zebra printer, so this is a working approach.

We used https://github.com/akretion/ak-odoo-incubator/tree/10.0/proxy_action to help us doing that

Thank you @PierrickBrun, great to know I'm not the first one going that way! Have a nice day!

@legalsylvain
Copy link
Contributor

Hi. @PierrickBrun do you mean this module will depend on proxy_action ?
If yes, it should be in OCA too. Is it planned ?

Regarding the design. This module will work in a first time only with pywebdriver that is not under the OCA umbrella. (But quasi : developped by GRAP, Akretion, Acsone, that are active members).
If such design is selected and if i understand correctly, you should write in the roadmap that a hw_pz should be developped.
Kind regards.

@Fkawala
Copy link
Author

Fkawala commented May 14, 2020

@legalsylvain Do you think we should rather have code duplication and stay under the OCA umbrella? To me, it does not look like a lot of work. I'm keen on having a minimal piece of code (a hw_xyz module, implying code duplication), and a roadmap item to switch to pywebdriver whenever it has been moved under the OCA umbrella. I'm very open to whatever solution, but I like to wrap up the work in a relatively short timeline. We would like to try the first version in our shop by the end of the month.

@legalsylvain
Copy link
Contributor

Not sure to understand correctly.
I was proposing only to developp the pos_self_weighting module, calling pywebdriver, and adding in the roadmap that it could be great to developp the hw_ module for people that don't use pywebdriver.
But a lot of module are depending on extra python libraries or package. So it's OK I think.
regarding proxy_action, if your module has to depend on it, yes it should be under OCA umbrella, but I don't think it's a problem. @PierrickBrun : what is the roadmap, regarding this incubated module ?

kind regards.

@legalsylvain
Copy link
Contributor

Hi @Fkawala. don't know if you know this module, but you maybe should take a look on this module :
coopiteasy#8

@legalsylvain
Copy link
Contributor

this PR is still active ?

@legalsylvain legalsylvain added this to the 9.0 milestone Aug 10, 2020
@Fkawala
Copy link
Author

Fkawala commented Aug 27, 2020

this PR is still active ?

Nop, I'll do a new one for v12.0 only. The new code will depend on pos_tare and pos_tare_generate_barcode. I'll close this. Thank you for asking :)

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.

6 participants