Skip to Content
Menú
This question has been flagged
1 Respondre
1415 Vistes

Hello,

in Odoo v15, there is a view to print a delivery, named : stock_report_delivery_aggregated_move_lines


In this view, there is a variable in this line : 


Do you know where this variable is set and how to modify it to add other fields !?

Avatar
Descartar

"In this view, there is a variable in this line : " --- seems the added line is missing in the question

Autor

The line is here but was interpreted!!

Here is the line without the <> : tr t-foreach="aggregated_lines" t-as="line"

But i finally found where the aggregated-lines is setted.

It is in the view : stocK.report_delivery_document with the method _get_aggregated_product_quantities in the stock.move.line model.

Now i'm looking for overriding this method to add other fields in this variable.

If someone has an idea !?

Best Answer

_get_aggregated_product_quantities() will called by print "Delivery Slip" when product is set to "No Tracking" and the picking(Transfer) was validate.

In my case, I want use my fields to replace the name (product_id) in some situation, but _get_aggregated_product_quantities() let me hard to append my field in it, so...

I'm

1.  _inherit = "stock.move.line" 

2. full copy the  _get_aggregated_product_quantities() to my code

3. modify my version's  _get_aggregated_product_quantities()  (what I do is only add a line in it...) 

4. 'not' call super


for "By Lots" or "By Unique Serial Number" or not validate, I inherit  stock.report_delivery_document and  stock.stock_report_delivery_has_serial_move_line directly  

Avatar
Descartar