[ADD] last_purchased_products: sort selection by recent customer history #1083
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.

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:
last_ordertime next to the product name in thedropdown.
last_invoice_datespecific to the selectedcustomer (partner).
final_qtyandlast_invoice_timein the productcatalog kanban view.
If no customer is selected in the context, the standard selection
behavior and sorting apply.
Technical Details:
Model
product.product: Addedlast_orderDatetime field,last_invoice_dateDate Field,last_invoice_timefield.Model
product.template: Addedlast_orderDatetime field,last_invoice_dateDate Field.Method
name_search: Overridden to order products aslast_invoice_date.Method
_compute_display_name: Overridden to showlast_orderas to stringtime at right side of product name in selection dropdown.
Method
_compute_last_order: to computelast_orderof shown products inselection dropdown in context of selected customer(
partner_id).Method
_compute_last_invoice_date: to computelast_invoice_dateto orderrecently 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: Updatedproduct_template_idand catalog buttonto pass the selected
partner_idin the context ascustomer.View
account_move_views: Updatedproduct_idand catalog buttonto pass the selected
partner_idin the context ascustomer.View
purchase_order_views: Updatedproduct_idto pass the selectedpartner_idin the context asvendor.View
product_views: Updatedproduct_view_kanban_catalogto displayfinal_qty(virtual_available-qty_available) next toOn Handandlast_invoice_timeafterqty_availableinproduct_view_kanban_catalog.Template
order_line: Updated to showuomDisplayNamenext toprice.