Skip to content

Enhance Appointment Filters: Type, Appointment Schedule, and Payment Step #692

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

Draft
wants to merge 6 commits into
base: 18.0
Choose a base branch
from

Conversation

kuay-odoo
Copy link

This PR introduces enhanced filtering options for appointments, improving the user experience when searching for specific appointments. The following filters have been added:

Appointment Type Filter: Allows users to filter appointments based on whether they are online or offline.

Schedule Filter: Enables filtering based on scheduling criteria, allowing users to choose between appointments scheduled by users or resources.

Payment Step Filter: Adds a filter to distinguish between appointments that require a payment step and those that do not.

These filters enhance the appointment browsing experience, making it easier for users to find relevant appointments based on their preferences. The implementation follows the existing filtering structure used in similar features, such as event filtering.

@robodoo
Copy link

robodoo commented Apr 3, 2025

Pull request status dashboard

kuay-odoo added 2 commits April 3, 2025 11:15
… payment

Added new filters to improve appointment scheduling and management:
Type filter- Allows users to filter appointments based on whether they are
online or offline.
Schedule filter- Enables filtering appointments based on users or resources,
similar to the event module.
Payment step filter-Adds the ability to filter appointments based on whether
they include a payment step.
These enhancements improve usability and provide better appointment organization.
… payment

Added new filters to improve appointment scheduling and management:
Type filter- Allows users to filter appointments based on whether they are
online or offline.
Schedule filter- Enables filtering appointments based on users or resources,
similar to the event module.
Payment step filter-Adds the ability to filter appointments based on whether
they include a payment step.
These enhancements improve usability and provide better appointment organization.
@kuay-odoo kuay-odoo force-pushed the 18.0-practice-task-kuay branch from 4312c25 to 630e34e Compare April 3, 2025 05:46
kuay-odoo added 3 commits April 15, 2025 10:30
This commit introduces a complete feature for managing warranty products
within the Sales application:

- Added a Is Warranty Available boolean field on product templates to
  indicate warranty eligibility.
- Moved warranty configuration under the 'Configuration' menu in the Sales app
  for better accessibility and UX alignment.
- Introduced a wizard for adding warranty products to sale orders, dynamically
  computing prices and descriptions based on selected lines.
- Implemented automatic deletion of warranty wizard lines when the product
  is removed from the wizard to maintain data integrity.

This feature improves the workflow for managing extended warranties,
providing a seamless integration in Sales for both users and system
operations.
Introduce a supplier-facing portal feature to streamline invoice submission.

Features:
- Allow authenticated users in the `Supplier User` group to upload invoices
via website form.
- Security:
  - Access restricted to users in the `Supplier User` group.
  - CSRF token protection for form submissions.
- Company selection:
  - Lists companies linked to the user.
  - Allows user to select the target company for invoice submission.
- File handling:
  - Uploaded files are stored as attachments.
  - Vendor bill is associated with a purchase journal from the selected company.
- Confirmation message shown upon successful submission.
- Adds a new security group: `Supplier User` and website menu item
Upload Invoice, visible only to users in the `Supplier User` group.
Benefits:
- Enables suppliers to directly submit invoice files from the portal.
- Improves workflow efficiency and reduces manual data entry for internal teams.
…Manufacture

- Introduced 'modular.type' model to define modular categories.
- Linked modular types to product templates via many2many field.
- Added modular_type_id in BOM lines with dynamic filtering per product.
- Added security access rules for new models and wizards.
- Extended views for BOM, manufacturing orders, sale orders, and
product templates.
- Created 'sale.order.line.modular.type' model to hold modular values
for sale order lines.
- Displayed modular types via wizard in sale order lines.
- Updated stock moves to inherit modular type from BOM line.
- Adjusted MRP component quantity using modular value during order confirmation.
@kuay-odoo kuay-odoo force-pushed the 18.0-practice-task-kuay branch from 4bff046 to 03fea4d Compare April 15, 2025 05:18
- Added `is_approval` boolean field to `sale.order` model.
- Introduced computed field `is_approval_read` to control read-only access.
- Only Sales Managers (based on group) can edit the approval checkbox.
- Overrode `action_confirm` to block confirmation if not approved.
- XML view updated to display approval checkbox next to payment terms.
- Enforces a lightweight approval mechanism before confirming sales orders.
Copy link

@nihp-odoo nihp-odoo left a comment

Choose a reason for hiding this comment

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

Hello @kuay-odoo
Some changes and suggestion on your website_appointment_filter task.
Thanks!

"views/website_appointment_filter.xml",
],
"auto-install": True,
"application": False,

Choose a reason for hiding this comment

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

Its False by default, if we need it as an application then we should define it as True.

from odoo import http
from odoo.addons.website_appointment.controllers.appointment import WebsiteAppointment # type: ignore
from odoo.http import request

Choose a reason for hiding this comment

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

Suggested change

from odoo.http import request

class WebsiteAppointmentFilter(WebsiteAppointment):

Choose a reason for hiding this comment

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

Suggested change

available_appointments = request.env["appointment.type"].sudo().search(total_domain)
appointment_data = self._prepare_appointments_cards_data(page, available_appointments, **params)

return request.render("website_appointment.appointments_cards_layout", appointment_data)

Choose a reason for hiding this comment

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

Only using card design? What about when user opts for list design?
Instead of directly changing this function, check the code flow and edit related functions.

return request.render("website_appointment.appointments_cards_layout", appointment_data)

def _build_filter_domain(self, params):

Choose a reason for hiding this comment

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

Suggested change

Copy link

@adsh-odoo adsh-odoo left a comment

Choose a reason for hiding this comment

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

Hello @kuay-odoo
Some suggestions/questions on the add product warranty task.
Also not able to install module on runbot need to update some sequence of file in the manifest.
Cheers!!!

Choose a reason for hiding this comment

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

Need to update the file name.

Choose a reason for hiding this comment

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

Same here, need to update the file name, check other occurrences also.

Comment on lines +11 to +19
def unlink(self):
for line in self:
linked_warranty_lines = self.search(
[("linked_sale_order_line_id", "=", line.id)]
)

linked_warranty_lines.unlink()

return super(salesOrderLine, self).unlink()

Choose a reason for hiding this comment

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

Rather than overriding this unlink function, can't we use the ondelete cascade property?
Or for the instant effect, we can also use onchange.

Comment on lines +8 to +12
<xpath expr="//page[@name='sales']/group[@name='sale']" position="inside">
<group string="Product Warranty" name="product_warranty">
<field name="is_warranty_available" />
</group>
</xpath>

Choose a reason for hiding this comment

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

Can we target with a simpler XPath?

_name = "product.warranty"
_description = "Product Warranty"

name = fields.Char(string="Name", required=True)

Choose a reason for hiding this comment

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

In spec it is mentioned that we have to make a manyone with a product, so a warranty will also be a product.

_description = "Wizard to add Warranty for product"

sale_order_id = fields.Many2one("sale.order", string="Quotation", required=True)
line_ids = fields.One2many("warranty.wizard.line", "wizard_id", string=" ")

Choose a reason for hiding this comment

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

Why empty string attribute here?

_name = "warranty.wizard"
_description = "Wizard to add Warranty for product"

sale_order_id = fields.Many2one("sale.order", string="Quotation", required=True)

Choose a reason for hiding this comment

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

I don't think there is a need for this field.

if total_price > 0:
self.env["sale.order.line"].create(
{
"order_id": self.sale_order_id.id,

Choose a reason for hiding this comment

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

You can get the order ID from the context instead of making a separate field.

sale_order_line_id = fields.Many2one("sale.order.line", string="Sale order Line")
warranty_id = fields.Many2one("product.warranty", string="Warranty")

validity_year = fields.Integer(

Choose a reason for hiding this comment

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

Instead of creating the field we can use directly warranty_id.validity_year.

_description = "warranty Line to Select Warranty"

wizard_id = fields.Many2one("warranty.wizard", string="Wizard")
product_id = fields.Many2one("product.product", string="Product")

Choose a reason for hiding this comment

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

Why is this field required?

Copy link

@nihp-odoo nihp-odoo left a comment

Choose a reason for hiding this comment

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

Hello @kuay-odoo
Some changes on your zero_stock_blockage task.
Thanks!

"views/sale_order.xml",
],
"auto-install": True,
"application": False,

Choose a reason for hiding this comment

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

Its False by default, so no need to mention it.

@@ -0,0 +1 @@
from . import sale_order

Choose a reason for hiding this comment

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

Missing line here..

class SaleOrder(models.Model):
_inherit = "sale.order"

is_approval = fields.Boolean(string="Approval")

Choose a reason for hiding this comment

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

Give better to a field (Also, here field name is mentioned in specs)

_inherit = "sale.order"

is_approval = fields.Boolean(string="Approval")
is_approval_read = fields.Boolean(compute="_compute_to_set_approval")

Choose a reason for hiding this comment

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

Suggested change
is_approval_read = fields.Boolean(compute="_compute_to_set_approval")
is_approval_read = fields.Boolean(compute="_compute_is_approval_read")

@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<record id="sale_approval_checkbox" model="ir.ui.view">

Choose a reason for hiding this comment

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

Comment on lines +13 to +14
user = self.env.user
is_user_manager = user.has_group("sales_team.group_sale_manager")

Choose a reason for hiding this comment

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

Suggested change
user = self.env.user
is_user_manager = user.has_group("sales_team.group_sale_manager")
is_user_manager = self.env.user.has_group("sales_team.group_sale_manager")

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.

4 participants