1616class StockMove (models .Model ):
1717 _inherit = "stock.move"
1818
19- # related field to manage closed lines
20- active = fields .Boolean ()
21-
2219 def _get_purchase_price_unit (self ):
2320 self .ensure_one ()
2421 invoice_lines = self .env ["stock.move.line" ]._get_right_invoice_lines (
@@ -61,8 +58,6 @@ def _get_purchase_price_unit(self):
6158class StockMoveLine (models .Model ):
6259 _inherit = "stock.move.line"
6360
64- # add field to manage closed lines
65- active = fields .Boolean (related = "move_id.active" , store = True )
6661 company_id = fields .Many2one (related = "move_id.company_id" , store = True )
6762
6863 def _get_last_closing (self , closing_id , product_id , company_id ):
@@ -116,7 +111,6 @@ def _get_cost_stock_move_purchase_average(self, last_close_date, closing_line_id
116111 ("product_id" , "=" , product_id .id ),
117112 ("date" , ">" , min_date ),
118113 ("date" , "<=" , max_date ),
119- ("active" , ">=" , 0 ),
120114 ("company_id" , "=" , company_id ),
121115 ("location_id.usage" , "!=" , "inventory" ),
122116 ("location_dest_id.usage" , "!=" , "inventory" ),
@@ -215,7 +209,6 @@ def _search_same_product_value(self, closing_line_id):
215209 )
216210 closing_line_id .cumulative_qty = other_closing_line_id .cumulative_qty
217211 closing_line_id .evaluation_method = other_closing_line_id .evaluation_method
218- self .env .cr .commit () # pylint: disable=E8102
219212
220213 def _get_cost_stock_move_lifo_fifo (self , closing_line_id , evaluation_method = False ):
221214 product_id = closing_line_id .product_id
@@ -306,7 +299,6 @@ def price_calculation(self, line, valuation_type, start_qty, start_price):
306299 ("quantity" , ">" , 0 ),
307300 ("date" , "<=" , line .close_id .close_date ),
308301 ("date" , ">" , line .close_id .last_close_date ),
309- ("active" , "!=" , False ),
310302 ("company_id" , "=" , line .close_id .company_id .id ),
311303 ]
312304 if valuation_type in ["fifo" , "purchase" ]:
@@ -421,7 +413,7 @@ def _get_tuples(self, line, move_line_ids, valuation_type, start_qty, start_pric
421413
422414 def _fix_zero_values (self , tuples ):
423415 fixed_tuples = []
424- _logger .info ("Current tuples are %s" % str ( tuples ) )
416+ _logger .info (f "Current tuples are { tuples } " )
425417 for i , raw_tuple in enumerate (tuples ):
426418 if not raw_tuple [2 ]:
427419 # n.b. the order of the tuples is from the newer to the oldest
@@ -448,7 +440,7 @@ def _fix_zero_values(self, tuples):
448440 )
449441 else :
450442 fixed_tuples .append (raw_tuple )
451- _logger .info ("Fixed tuples are %s" % str ( fixed_tuples ) )
443+ _logger .info (f "Fixed tuples are { fixed_tuples } " )
452444 return fixed_tuples
453445
454446 @staticmethod
@@ -603,7 +595,6 @@ def _recompute_cost_stock_move_purchase(self, closing_id):
603595 closing_id , closing_line_id , last_close_date , product_id
604596 )
605597
606- self .env .cr .commit () # pylint: disable=E8102
607598 _logger .info ("[1/2] Finish recompute average cost product" )
608599
609600 def _write_results (self , closing_id ):
0 commit comments