Add support for config param usability.line_name_no_product_code
The same ir.config_parameter is used in: - purchase_usability for purchase.order.line - sale_usability for sale.order.line - account_usability for account.move.line
This commit is contained in:
@@ -251,3 +251,14 @@ class AccountMoveLine(models.Model):
|
|||||||
rec_str = ', '.join([
|
rec_str = ', '.join([
|
||||||
'a%d' % pr.id for pr in line.matched_debit_ids + line.matched_credit_ids])
|
'a%d' % pr.id for pr in line.matched_debit_ids + line.matched_credit_ids])
|
||||||
line.reconcile_string = rec_str
|
line.reconcile_string = rec_str
|
||||||
|
|
||||||
|
def _get_computed_name(self):
|
||||||
|
# This is useful when you want to have the product code in a dedicated
|
||||||
|
# column in your customer invoice report
|
||||||
|
# The same ir.config_parameter is used in sale_usability,
|
||||||
|
# purchase_usability and account_usability
|
||||||
|
no_product_code_param = self.env['ir.config_parameter'].sudo().get_param(
|
||||||
|
'usability.line_name_no_product_code')
|
||||||
|
if no_product_code_param and no_product_code_param == 'True':
|
||||||
|
self = self.with_context(display_default_code=False)
|
||||||
|
return super()._get_computed_name()
|
||||||
|
|||||||
@@ -87,3 +87,14 @@ class PurchaseOrderLine(models.Model):
|
|||||||
code = supplier_info.product_code
|
code = supplier_info.product_code
|
||||||
break
|
break
|
||||||
line.product_supplier_code = code
|
line.product_supplier_code = code
|
||||||
|
|
||||||
|
def _get_product_purchase_description(self, product_lang):
|
||||||
|
# This is useful when you want to have the product code in a dedicated
|
||||||
|
# column in your purchase order report
|
||||||
|
# The same ir.config_parameter is used in sale_usability,
|
||||||
|
# purchase_usability and account_usability
|
||||||
|
no_product_code_param = self.env['ir.config_parameter'].sudo().get_param(
|
||||||
|
'usability.line_name_no_product_code')
|
||||||
|
if no_product_code_param and no_product_code_param == 'True':
|
||||||
|
product_lang = product_lang.with_context(display_default_code=False)
|
||||||
|
return super()._get_product_purchase_description(product_lang)
|
||||||
|
|||||||
@@ -124,3 +124,14 @@ class SaleOrderLine(models.Model):
|
|||||||
self.env, new_price, currency_obj=pricelist.currency_id))
|
self.env, new_price, currency_obj=pricelist.currency_id))
|
||||||
}
|
}
|
||||||
return res
|
return res
|
||||||
|
|
||||||
|
def get_sale_order_line_multiline_description_sale(self, product):
|
||||||
|
# This is useful when you want to have the product code in a dedicated
|
||||||
|
# column in your sale order report
|
||||||
|
# The same ir.config_parameter is used in sale_usability,
|
||||||
|
# purchase_usability and account_usability
|
||||||
|
no_product_code_param = self.env['ir.config_parameter'].sudo().get_param(
|
||||||
|
'usability.line_name_no_product_code')
|
||||||
|
if no_product_code_param and no_product_code_param == 'True':
|
||||||
|
product = product.with_context(display_default_code=False)
|
||||||
|
return super().get_sale_order_line_multiline_description_sale(product)
|
||||||
|
|||||||
Reference in New Issue
Block a user