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
Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
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)
Tạo tài khoản ngay hôm nay để tận hưởng các tính năng độc đáo và tham gia cộng đồng tuyệt vời của chúng tôi!
Đăng kýBài viết liên quan | Trả lời | Lượt xem | Hoạt động | |
---|---|---|---|---|
|
3
thg 9 25
|
1312 | ||
|
1
thg 9 25
|
221 | ||
|
2
thg 9 25
|
628 | ||
|
0
thg 9 25
|
11 | ||
|
1
thg 9 25
|
288 |