Hi, I have a button inside an XML view that dispatch a wizard view of another addon, in this way:
```
<record id="view_contact_form" model="ir.ui.view">
<field name="name">res.partner.form</field>
<field name="model">res.partner</field>
<field name="inherit_id" ref="base.view_partner_form"/>
<field name="arch" type="xml">
<xpath expr="//form//sheet" position="before">
<header>
. . . .
<button name="%(report_generator.action_generate_report)d" string="Privacy Report" type="action" class="oe_highlight"/>
</header>
</xpath>
. . . .
```
And this is the action inside the other addon:
```
<record id="action_generate_report" model="ir.actions.act_window">
<field name="name">Generate Privacy Report</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">cliens.report_generator.privacy_report_model_wizard</field>
<field name="view_type">form</field>
<field name="view_mode">form</field>
<field name="target">new</field>
</record>
````
Now I need to pass default data to the wizard, and I need to have a function inside the TransientModel of the addons where the action is.
So I need to call the python method from the first addon passing the res partner record.
Anyone can help me?
Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
- CRM
- e-Commerce
- Kế toán
- Tồn kho
- PoS
- Project
- MRP
Câu hỏi này đã bị gắn cờ
pass values through the context as default_values: value
eg:
return {
'name': _('Shipment Line Items'),
'view_mode': 'form',
'res_model': 'cargo.details',
'view_id': self.env.ref('orderrace_export.cargo_details').id,
'type': 'ir.actions.act_window',
'context': {'default_partner_id': self.partner_id.id, 'default_company_id': self.company_id.id,
'default_name': self.name},
'target': 'new',
}
<field name="context">{'search_default_group_crossevered_budgdet_id': True, 'search_default_filter_not_cancelled':True}</field>
Bạn có hứng thú với cuộc thảo luận không? Đừng chỉ đọc, hãy tham gia nhé!
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 10 23
|
5819 | ||
|
2
thg 8 22
|
3654 | ||
|
6
thg 10 20
|
3651 | ||
|
0
thg 7 19
|
5453 | ||
report in quality
Đã xử lý
|
|
3
thg 5 19
|
3121 |
Hope these tips will help you in future: https://github.com/sehrishnaz/learnopenerp/wiki