product description into sales

Hello and sorry, I’m new here and have a question right away. I’m sure there will be a few more :slight_smile:

The product description or variant description isn’t automatically copied into the sale. Is there a way to do this, or am I just missing it?

1 Like

In general in Tryton, we avoid any copy. Especially translated text that may or may not be in the right language.
If you need the product description for example to display on the sale report, you can just access it though the product.

Hello, thank you for the quick reply. I’ve found the solution of printing the product description on the report. However, if the item is changed, the report also changes, even if it’s already completed. Ideally, the sales item should be pre-populated with the description from the master item so that changes or additions can be made there. This would also be revision-proof. As I said, I’m just starting out with Tryton; perhaps I’ll think of something else. But what’s the point of creating the description in the item if it’s not carried over to the sales order?

The workaround using a longer product name also works in multiple languages. However, it’s not really ideal.

Yep this is the feature.

This does not work for a multi-language setup.

To have a description of the product that can be displayed whenever it is needed.

1 Like

Hello,

I found neither the function nor the response very satisfactory. Therefore, I created a module. This retrieves the description of the product or variant in the customer’s respective language and inserts it into the sale description. The sale description can then be changed or left as is.

Create on new module : sale_product_description

_init_.py

from trytond.pool import Pool
from . import sale

def register():
Pool.register(
sale.SaleLine,
module=‘sale_product_description’,
type_=‘model’
)

Create

sale.py

from trytond.model import fields
from trytond.pool import Pool, PoolMeta
from trytond.transaction import Transaction

class SaleLine(metaclass=PoolMeta):
_name_ = ‘sale.line’

@fields.dependsfields.depends(‘product’, ‘_parent_sale.party’)
def on_change_product(self):
super().on_change_product()
if self.product:
party = self.sale.party if self.sale else None
lang = (
party.lang.code
if party and party.lang
else Transaction().language
)
Product = Pool().get(‘product.product’)
with Transaction().set_context(language=lang):
product = Product(self.product.id)
self.description = (
product.description
or product.template.description
or ‘’
)

Create:

setup.py

from setuptools import setup, find_packages

setup(
name=‘sale_product_description’,
version=‘7.8.0’,
packages=find_packages(),
entry_points={
‘trytond.modules’: [
‘sale_product_description = sale_product_description’,
],
},
)

Create

tryton.cfg

[tryton]
version=7.8.0
depends:
sale

[translation]

I hope someone can still use it.

Indeed I will not be against adding a button on the sale line form to copy the description from the product to the sale line (in the customer language). But it is important that it is not done by default for the above reasons.

1 Like