Skip to Content
Menu
Musisz się zarejestrować, aby móc wchodzić w interakcje z tą społecznością.
To pytanie dostało ostrzeżenie
1 Odpowiedz
446 Widoki

Hello,

i want to edit the names / breadcrumbs of the checkout steps of the e-commerce modul.

So far i found that the actual name for the display-name is from website_sale in the website.py file in line 606 with _lt('Delivery') but when i overwrite the Delivery translation with the .po file, it only changes the text displayed in the summary box on the checkout page.

Best regards


Awatar
Odrzuć
Autor Najlepsza odpowiedź

So the workaround was the following:

#imports

from odoo import models

from odoo.tools.translate import LazyTranslate

#make LazyTranslate callable as _lt

_lt = LazyTranslate(__name__)


#add functions

class Website(models.Model):

    _inherit = 'website'

    #overload functions

    def _get_checkout_step_list(self):

        #get the original data witih super

        steps = super()._get_checkout_step_list()


        for _, data in steps:

            #Check Booking - Buchung Überprüfen

            if 'name' in data and str(data['current_href']) == '/shop/cart':

                data['name'] = _lt('Check Booking')

            #Address - Adresse

            if 'name' in data and str(data['current_href']) == '/shop/checkout':

                data['name'] = _lt('Address')

            # if 'name' in data and str(data['current_href']) == '/shop/payment':

            #     data['name'] = _lt('Check Booking')

        return steps

with this and your own translations in the i18n folder you can rename the labels at the top

Awatar
Odrzuć