Ir al contenido
Menú
Se marcó esta pregunta
3 Respuestas
3495 Vistas

Hi

I have a difficulty for product translation .As i understood when you translate the product in the sales order will not show it unless customer language is set to that language up to here everything if fine but some time our customer will ask for Arabic SO and some time English so before creatie any SO if you change the language it is fine but after creation there isn't any way to update it to any other language. i want to create an automated action to update the sales order line when its triggered i was wondering if someone can help me to solve this problem.

Avatar
Descartar
Mejor respuesta

Hello Kamran Lalehparvar

I have reproduced your issue and found solution as below.

Actually when you select product on sale order line, description field is filled with product's description as per customer's langauge. then after if you change langauge that field's value will not update unless you trigger onchange of product on sale order line.

i have created server action to update order line's description as per customer langauge. please have a look below server action.



for rec in records.mapped('order_line'):
rec.product_id_change()

Thanks & Regards,



CandidRoot Solutions Pvt. Ltd.

Mobile: (+91) 8849036209
Email: info@candidroot.com
Skype: live:candidroot
Web: https://www.candidroot.com
Address: 1229-1230, Iconic Shyamal, Near Shyamal Cross Road, Ahmedabad, Gujarat


Avatar
Descartar
Autor

Hi
Its working i really appreciate it.

Autor

Hello Again
By the way i have tried to make it for invoice as well with following code:

for rec in records.mapped('invoice_line_ids'):
rec.product_id_change()
but it seems there is a problem i was wondering if you can help me . thanks in advance

please try following python code as account.move object has o2m field "invoice_line_ids" of accout.move.line and that module has _onchange_product_id() onchange method.

for rec in records.mapped('invoice_line_ids'):
rec._onchange_product_id()

Autor

Hi
Good Morning
Thank you for your time. i have tried the code but there is problem. when i trying to change the language there is an error
You cannot add/modify entries prior to and inclusive of the lock date 31/12/2021.
but the current date is not before 31/12/2021
i was wondering if might be able to check.

Hello CandidRoot,

I tried adding this server action in odoo 16.0 from february 2024 but it's giving me this error:

AttributeError: 'sale.order.line' object has no attribute 'product_id_change'

I've checked the SaleOrderLine class (model) and indeed there's no such method anywhere.

What could be wrong? Is this in an old version of odoo?

Mejor respuesta

Hey Kamran, 

If you are looking for a quick way to translate all your products (which we did as well), so we developed an app that integrates DEEPL translations for all products and website pages.  You may want to check https://www.spinomana.com/deepl-translator which will greatly reduce time and effort for doing translations with the default export/import.  You can even use it with glossary so you can finetune translations per vertical or business

Kind regards,

Seppe

Avatar
Descartar
Autor Mejor respuesta

Hi Peter

For V16 you can use this code
for order in records:

    partner_lang = order.partner_id.lang

    for line in order.order_line:

        display_name = line.product_id.with_context(lang=partner_lang).display_name

        sales_description = line.product_id.with_context(lang=partner_lang).description_sale


        line.update({'name': display_name + '\n' + sales_description})

Avatar
Descartar
Publicaciones relacionadas Respuestas Vistas Actividad
0
feb 24
1929
1
nov 23
2155
0
sept 23
1707
1
jun 23
3375
0
jun 22
3509