Skip to content

Conversation

@mihien
Copy link

@mihien mihien commented Sep 27, 2025

Copy link

@polchampion polchampion left a comment

Choose a reason for hiding this comment

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

@mihien failed test on runboat : there are pos lines with quantity zero but no warning is shown

@mihien
Copy link
Author

mihien commented Oct 8, 2025

@mihien failed test on runboat : there are pos lines with quantity zero but no warning is shown

@polchampion You first have to check the option "Require Product Quantity" in the pos settings to activate it. The option was already in the settings in 12.0 but wasn't used in the module's logic. Whether you checked it or not, quantities of 0 used to result in a popup either way. If that's better, I could have it turned on by default when installing the module or if we want the same behaviour as in 12.0, I can remove the option from the settings entirely

Copy link

@polchampion polchampion left a comment

Choose a reason for hiding this comment

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

@mihien sucessfully tested, can you add a "configuration" section in the readme so that it's clear how it needs to be set up ?

also, why put this in the session properties and not in the general pos settings? it seems not to respect the general logic

@mihien mihien force-pushed the 16.0-mig-pos_require_product_quantity branch from b15ee4f to 9f89d78 Compare October 24, 2025 08:05
@mihien
Copy link
Author

mihien commented Oct 24, 2025

@mihien sucessfully tested, can you add a "configuration" section in the readme so that it's clear how it needs to be set up ?

also, why put this in the session properties and not in the general pos settings? it seems not to respect the general logic

@polchampion I've set the setting to true by default, so that there is no need for a configuration anymore and took the opportunity to move it to the general pos settings as well.

@polchampion
Copy link

I've set the setting to true by default, so that there is no need for a configuration anymore and took the opportunity to move it to the general pos settings as well.

perfect thank you!

class ResConfigSettings(models.TransientModel):
_inherit = "res.config.settings"

require_product_quantity = fields.Boolean(
Copy link
Member

Choose a reason for hiding this comment

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

the res.config.settings field should be prefixed with pos_.

const PosRequireProductQuantityProductScreen = (OriginalProductScreen) =>
class extends OriginalProductScreen {
async _onClickPay() {
const result = super._onClickPay(...arguments);
Copy link
Member

Choose a reason for hiding this comment

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

i think that this should be called after the rest of the checks, because it will try to switch to the payment screen. if a check fails, it is better to not run this code at all. this way, there is even no need to switch back to the ProductScreen in case of error.

Copy link
Author

Choose a reason for hiding this comment

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

Would it be okay to do an empty return when a case fails and return the call to super otherwise?

Copy link
Member

Choose a reason for hiding this comment

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

actually, the parent method doesn’t return anything, so yes, you can do an empty return (to exit the function) after showing the popup, and otherwise simply call super._onClickPay(...arguments); without returning its value.

@mihien mihien force-pushed the 16.0-mig-pos_require_product_quantity branch 2 times, most recently from 63df7e3 to a49bf1a Compare November 12, 2025 09:47
@mihien mihien force-pushed the 16.0-mig-pos_require_product_quantity branch from a49bf1a to 41f2d0b Compare November 12, 2025 10:12
@mihien mihien requested a review from huguesdk November 12, 2025 10:13
Copy link
Member

@huguesdk huguesdk left a comment

Choose a reason for hiding this comment

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

lgtm, thanks!

@OCA-git-bot
Copy link
Contributor

This PR has the approved label and has been created more than 5 days ago. It should therefore be ready to merge by a maintainer (or a PSC member if the concerned addon has no declared maintainer). 🤖

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.