Skip to content

Conversation

@danal-odoo
Copy link

@danal-odoo danal-odoo commented Dec 19, 2025

Before, the product selection dropdown did not display the
time of the previous order and products were not sorted based on how
recently they were invoiced for the selected customer. Additionally,
the last invoice time and specific quantity calculations were missing
from the catalog view.

This module enhances the product selection mechanism to assist users in
identifying frequently purchased items. Specific improvements include:

  • Displaying the last_order time next to the product name in the
    dropdown.
  • Sorting products by last_invoice_date specific to the selected
    customer (partner).
  • Showing final_qty and last_invoice_time in the product
    catalog kanban view.

If no customer is selected in the context, the standard selection
behavior and sorting apply.

Technical Details:

  • Model product.product: Added last_order Datetime field,
    last_invoice_date Date Field, last_invoice_time field.

  • Model product.template: Added last_order Datetime field,
    last_invoice_date Date Field.

  • Method name_search: Overridden to order products as last_invoice_date.

  • Method _compute_display_name: Overridden to show last_order as to string
    time at right side of product name in selection dropdown.

  • Method _compute_last_order: to compute last_order of shown products in
    selection dropdown in context of selected customer(partner_id).

  • Method _compute_last_invoice_date: to compute last_invoice_date to order
    recently invoiced first shown products in selection dropdown in context of
    selected customer(partner_id).

  • Method compute_agotime: to compute given Datetime or Date to string format.

  • View sale_order_views: Updated product_template_id and catalog button
    to pass the selected partner_id in the context as customer.

  • View account_move_views: Updated product_id and catalog button
    to pass the selected partner_id in the context as customer.

  • View purchase_order_views: Updated product_id to pass the selected
    partner_id in the context as vendor.

  • View product_views: Updated product_view_kanban_catalog to display
    final_qty (virtual_available - qty_available) next to On Hand and
    last_invoice_time after qty_available in product_view_kanban_catalog.

  • Template order_line: Updated to show uomDisplayName next to price.

@robodoo
Copy link

robodoo commented Dec 19, 2025

Pull request status dashboard

@danal-odoo danal-odoo force-pushed the 19.0-last_purchased_products-danal branch from 67e219c to 3a32fc9 Compare December 19, 2025 06:28
@danal-odoo danal-odoo changed the title [ADD] last_purchased_products: last order time in product dropdown [ADD] last_purchased_products: sort selection by recent customer history Dec 19, 2025
@danal-odoo danal-odoo force-pushed the 19.0-last_purchased_products-danal branch from 3a32fc9 to 2f5c2d2 Compare December 19, 2025 07:37
Before, the product selection dropdown did not display the
time of the previous order and products were not sorted based on how
recently they were invoiced for the selected customer. Additionally,
the last invoice time and specific quantity calculations were missing
from the catalog view.

This module enhances the product selection mechanism to assist users in
identifying frequently purchased items. Specific improvements include:
- Displaying the `last_order` time next to the product name in the
  dropdown.
- Sorting products by `last_invoice_date` specific to the selected
  customer (partner).
- Showing `final_qty` and `last_invoice_time` in the product
  catalog kanban view.

If no customer is selected in the context, the standard selection
behavior and sorting apply.

Technical Details:
- Model `product.product`: Added `last_order` Datetime field,
   `last_invoice_date` Date Field, `last_invoice_time` field.
- Model `product.template`: Added `last_order` Datetime field,
   `last_invoice_date` Date Field.
- Method `name_search`: Overridden to order products as `last_invoice_date`.
- Method `_compute_display_name`: Overridden to show `last_order` as to string
   time at right side of product name in selection dropdown.
- Method `_compute_last_order`: to compute `last_order` of shown products in
   selection dropdown in context of selected customer(`partner_id`).
- Method `_compute_last_invoice_date`: to compute `last_invoice_date` to order
   recently invoiced first shown products in selection dropdown in context of
   selected customer(`partner_id`).
- Method `compute_agotime`: to compute given Datetime or Date to string format.

- View `sale_order_views`: Updated `product_template_id` and catalog button
   to pass the selected `partner_id` in the context as `customer`.
- View `account_move_views`: Updated `product_id` and catalog button
   to pass the selected `partner_id` in the context as `customer`.
- View `purchase_order_views`: Updated `product_id` to pass the selected
  `partner_id` in the context as `vendor`.
- View `product_views`: Updated `product_view_kanban_catalog` to display
  `final_qty` (`virtual_available` - `qty_available`) next to `On Hand` and
  `last_invoice_time` after `qty_available` in `product_view_kanban_catalog`.

- Template `order_line`: Updated to show `uomDisplayName` next to `price`.
@danal-odoo danal-odoo force-pushed the 19.0-last_purchased_products-danal branch from 2f5c2d2 to b81855c Compare December 19, 2025 12:18
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.

2 participants