Restore sale/purchase/account line 'name' field without product_code via ir.config_parameter

This commit is contained in:
Alexis de Lattre
2022-12-14 09:51:51 +00:00
parent aad5fa4ff0
commit 16c4b1cebe
2 changed files with 5 additions and 6 deletions

View File

@@ -251,8 +251,7 @@ class AccountMoveLine(models.Model):
# for pr in record.matched_debit_ids + record.matched_credit_ids # for pr in record.matched_debit_ids + record.matched_credit_ids
# ]) # ])
# TODO def _compute_name(self):
def _get_computed_name(self):
# This is useful when you want to have the product code in a dedicated # This is useful when you want to have the product code in a dedicated
# column in your customer invoice report # column in your customer invoice report
# The same ir.config_parameter is used in sale_usability, # The same ir.config_parameter is used in sale_usability,
@@ -261,7 +260,7 @@ class AccountMoveLine(models.Model):
'usability.line_name_no_product_code') 'usability.line_name_no_product_code')
if no_product_code_param and no_product_code_param == 'True': if no_product_code_param and no_product_code_param == 'True':
self = self.with_context(display_default_code=False) self = self.with_context(display_default_code=False)
return super()._get_computed_name() return super()._compute_name()
def reconcile(self): def reconcile(self):
"""Explicit error message if unposted lines""" """Explicit error message if unposted lines"""

View File

@@ -123,7 +123,7 @@ class SaleOrderLine(models.Model):
# } # }
# return res # return res
def get_sale_order_line_multiline_description_sale(self, product): def _get_sale_order_line_multiline_description_sale(self):
# This is useful when you want to have the product code in a dedicated # This is useful when you want to have the product code in a dedicated
# column in your sale order report # column in your sale order report
# The same ir.config_parameter is used in sale_usability, # The same ir.config_parameter is used in sale_usability,
@@ -131,5 +131,5 @@ class SaleOrderLine(models.Model):
no_product_code_param = self.env['ir.config_parameter'].sudo().get_param( no_product_code_param = self.env['ir.config_parameter'].sudo().get_param(
'usability.line_name_no_product_code') 'usability.line_name_no_product_code')
if no_product_code_param and no_product_code_param == 'True': if no_product_code_param and no_product_code_param == 'True':
product = product.with_context(display_default_code=False) self = self.with_context(display_default_code=False)
return super().get_sale_order_line_multiline_description_sale(product) return super()._get_sale_order_line_multiline_description_sale()