Перейти к содержимому
Меню
Чтобы взаимодействовать с сообществом, необходимо зарегистрироваться.
Этот вопрос был отмечен
1 Ответить
1060 Представления

How do I get the whole url via python in odoo 16. I want to send an email to the employees with the link. The link should refer to a specific invoice, for example. How do I get the parameters:


cids=1

menu_id=1

action=2

active_id=3


thanks all

Аватар
Отменить
Лучший ответ

 you  can try this 

t-attf-href="/web?#id={{ object.id }}&model=account.move&view_type=form"


 other way 

   useing this ir.config_parameter  module  you need  must set web.base.url  you domail for example   https://localhost:8069 or odoo.com  like 

def send_invoice_link(self, invoice_id):
        # Get the base URL from system parameters
        base_url = self.env['ir.config_parameter'].sudo().get_param('web.base.url')

        # Build the URL with the correct parameters
        invoice = self.env['account.move'].browse(invoice_id)
        menu_id = self.env.ref('account.menu_action_move_out_invoice_type').id
        action_id = self.env.ref('account.action_move_out_invoice_type').id

        url = f"{base_url}/web?#id={invoice.id}&cids=1&menu_id={menu_id}&action={action_id}&model=account.move&view_type=form"

        # Send the email with the generated URL
        template = self.env.ref('your_module_name.invoice_email_template')
        template.with_context(invoice_url=url).send_mail(invoice.id, force_send=True)
Аватар
Отменить
Related Posts Ответы Просмотры Активность
1
сент. 25
262
2
сент. 25
379
0
сент. 25
154
4
сент. 25
1300
3
сент. 25
412