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

[16.0][ADD] website_sale_product_compatibility and website_sale_product_contract_gift #351

Open
wants to merge 17 commits into
base: 16.0
Choose a base branch
from

Conversation

remytms
Copy link
Member

@remytms remytms commented Jan 19, 2025

Description

Move compatibility features in a new module.

Create gift module.

Odoo task (if applicable)

task

Checklist before approval

  • Tests are present (or not needed).
  • Credits/copyright have been changed correctly.
  • Change log snippet is present.
  • (If a new module) Moving this to OCA has been considered.

This module is a base module for adding compatibility check between
product in a sale order for the e-commerce.

This comes with the refactoring of the module
website_sale_restrict_sepa_dd.
Add product contract that can be set as gift and therefore generate some
specific compatibilities and flow.
@remytms remytms force-pushed the 16.0-add-website_sale_product_contract_gift branch from 647cecb to 96eeae1 Compare February 11, 2025 10:33
@remytms remytms force-pushed the 16.0-add-website_sale_product_contract_gift branch from b0ed365 to 187c521 Compare February 19, 2025 13:49
@remytms remytms force-pushed the 16.0-add-website_sale_product_contract_gift branch from 187c521 to a3d82cd Compare February 20, 2025 11:37
remytms added 3 commits March 5, 2025 21:56
Create new partner or match existing partner when creating contract for
gift.

Create user when the invoice is generated at the gift date.

Missing sending an email to the user for telling them they get a gift.
@remytms remytms marked this pull request as ready for review March 5, 2025 21:32
:retrun: warning message to be shown on the web interface.
"""
self.ensure_one()
return ""
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 returning None is more clean than an empty string.

Copy link
Member Author

Choose a reason for hiding this comment

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

Feel strange to return None when you attend to receive a string in return. Or I should check type of returned object when using this method.

Copy link
Member

Choose a reason for hiding this comment

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

the empty string in this case is actually used as a special value: if it is an empty string, it means that there is no problem: it is thus never used as a string.

replacing it with None will not break the existing code that is checking whether the return value is truthy. but it will allow to write it in a cleaner (more explicit) way:

if warning is None:

there are only 2 cases to handle:

  1. the return value is None, meaning that there is no warning.
  2. there is a warning.

to me, None means “there is no warning”, while the current code feels more like “there is an empty warning” (which makes not much sense). with this change, it even allows to have a warning with an empty message (not very useful, but it illustrates the difference).

Comment on lines 66 to 76
<!-- Replace confirm button -->
<xpath expr="//a[@href='/shop/confirm_order']" position="attributes">
<attribute name="style">display: none;</attribute>
</xpath>

<xpath expr="//a[@href='/shop/confirm_order']" position="after">
<button id="gift_form_confirm_button" class="btn btn-primary mb32">
Confirm
<i class="fa fa-chevron-right" />
</button>
</xpath>
Copy link
Member

Choose a reason for hiding this comment

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

hiding a button with css and adding another one is kind of ugly. can’t the original button be used differently instead (by overriding some maybe)?

Copy link
Member Author

Choose a reason for hiding this comment

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

I’ve not yet find a better method for this particular purpose.

Copy link
Member

Choose a reason for hiding this comment

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

why not use position="replace" then?

@remytms remytms force-pushed the 16.0-add-website_sale_product_contract_gift branch from c525269 to b42a8c1 Compare March 19, 2025 16:46
@remytms remytms force-pushed the 16.0-add-website_sale_product_contract_gift branch from b42a8c1 to 73590a1 Compare March 19, 2025 16:47
@remytms remytms force-pushed the 16.0-add-website_sale_product_contract_gift branch from 73590a1 to 209a068 Compare March 20, 2025 14:23
@remytms remytms requested a review from huguesdk March 20, 2025 16:04
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.

3 participants