odoo/tutorials#1083
Created by Darshil Naliyapara (danal)
Blocked
- Merge method
- Review
-
CI
- ci/style: (runtime 27s)
- ci/tutorial: (runtime 99s)
- label
- odoo-dev:19.0-last_purchased_products-danal
- head
- c91f7fba1279484ddc02bf9dd72081eeba99963e
| odoo/tutorials | |
|---|---|
| 19.0 | #1083 missing r+ |
| master |
[ADD] last_purchased_products: sort selection by recent customer history
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.
- Displaying invoice_partner_name next to last_invoice_time,
which is clickable and open last invoice of that property.
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 Datetime Field, last_invoice_time Char field,
invoice_partner_name Char field.
- Model product.template: Added last_order Datetime field,
last_invoice_date Datetime Field.
- Method action_open_last_invoice: To open last invoice of product.
- 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 to string format.
- View
sale_order_views: Updatedproduct_template_idand catalog button
to pass the selectedpartner_idin the context ascustomer. - View
account_move_views: Updatedproduct_idand catalog button
to pass the selectedpartner_idin the context ascustomer. - View
purchase_order_views: Updatedproduct_idto pass the selected
partner_idin the context asvendor. -
View
product_views: Updatedproduct_view_kanban_catalogto display
final_qty(virtual_available-qty_available) next toOn Handand
last_invoice_timeafterqty_availableinproduct_view_kanban_catalog. -
Template
order_line: Updated to showuomDisplayNamenext toprice.