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 11 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
@@ -0,0 +1 @@
Form to order subscription product
Copy link
Member

Choose a reason for hiding this comment

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

this doesn’t match the module summary. moreover, this module needs a little more explanation for the reader to understand what its purpose is.

suggestion: This is a utility module that can be used by other modules to check whether different products are allowed to be added to the same e-commerce sale order.

Copy link
Member

Choose a reason for hiding this comment

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

the name of the class should be updated.

Copy link
Member

Choose a reason for hiding this comment

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

this file shouldn’t be in this module.


:product_id: The id of the product to check compatibility.
:rtype: str
:retrun: warning message to be shown on the web interface.
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
:retrun: warning message to be shown on the web interface.
:return: warning message to be shown on the web interface.

: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.

Comment on lines +91 to +94
invoices.mapped("line_ids")
.mapped("contract_line_id")
.mapped("contract_id")
.mapped("is_gift")
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
invoices.mapped("line_ids")
.mapped("contract_line_id")
.mapped("contract_id")
.mapped("is_gift")
invoices.line_ids.contract_line_id.contract_id
.mapped("is_gift")

Comment on lines +9 to +11
<b>Date of the gift:</b> <span
t-field="website_sale_order.gift_date"
/>
Copy link
Member

Choose a reason for hiding this comment

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

what is the difference between gift_date and date_for_gift?

</template>

<template id="checkout" inherit_id="website_sale.checkout">
<!-- Add date for gift formular -->
Copy link
Member

Choose a reason for hiding this comment

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

formularform

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)?

expr="//div[hasclass('oe_cart')]//h3[@class='o_page_header mt16 mb4']"
position="after"
>
<h3
Copy link
Member

Choose a reason for hiding this comment

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

two <h3> one right after the other seems strange. i think it should either be a <h4> or the existing <h3> should be modified.

Error when computing gift_date on an order without gift product.
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