[IMP] excel_import_export_demo: add hooks
parent
6e7e03d85c
commit
6d75255e07
|
@ -5,3 +5,4 @@ from . import import_export_sale_order
|
||||||
from . import report_sale_order
|
from . import report_sale_order
|
||||||
from . import report_crm_lead
|
from . import report_crm_lead
|
||||||
from . import report_action
|
from . import report_action
|
||||||
|
from .hooks import post_init_hook
|
||||||
|
|
|
@ -30,6 +30,7 @@
|
||||||
"report_action/partner_list/report_partner_list.xml",
|
"report_action/partner_list/report_partner_list.xml",
|
||||||
"report_action/partner_list/security/ir.model.access.csv",
|
"report_action/partner_list/security/ir.model.access.csv",
|
||||||
],
|
],
|
||||||
|
"post_init_hook": "post_init_hook",
|
||||||
"installable": True,
|
"installable": True,
|
||||||
"development_status": "Beta",
|
"development_status": "Beta",
|
||||||
"maintainers": ["kittiu"],
|
"maintainers": ["kittiu"],
|
||||||
|
|
|
@ -0,0 +1,11 @@
|
||||||
|
# Copyright 2024 Quartile (https://www.quartile.co)
|
||||||
|
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
|
||||||
|
|
||||||
|
from odoo import SUPERUSER_ID, api
|
||||||
|
|
||||||
|
|
||||||
|
def post_init_hook(cr, registry):
|
||||||
|
env = api.Environment(cr, SUPERUSER_ID, {})
|
||||||
|
templates = env["xlsx.template"].search([("export_ids", "!=", False)])
|
||||||
|
for template in templates:
|
||||||
|
template.add_export_action()
|
|
@ -4,21 +4,6 @@
|
||||||
License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html).-->
|
License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html).-->
|
||||||
<odoo>
|
<odoo>
|
||||||
|
|
||||||
<record id="action_purchase_order_export_xlsx" model="ir.actions.act_window">
|
|
||||||
<field name="name">Export Excel</field>
|
|
||||||
<field name="res_model">export.xlsx.wizard</field>
|
|
||||||
<field name="binding_view_types">form</field>
|
|
||||||
<field name="view_mode">form</field>
|
|
||||||
<field name="target">new</field>
|
|
||||||
<field name="context">
|
|
||||||
{
|
|
||||||
'template_domain': [('res_model', '=', 'purchase.order'),
|
|
||||||
('fname', '=', 'purchase_order.xlsx'),
|
|
||||||
('gname', '=', False)],
|
|
||||||
}
|
|
||||||
</field>
|
|
||||||
</record>
|
|
||||||
|
|
||||||
<record id="action_purchase_order_import_xlsx" model="ir.actions.act_window">
|
<record id="action_purchase_order_import_xlsx" model="ir.actions.act_window">
|
||||||
<field name="name">Import Excel</field>
|
<field name="name">Import Excel</field>
|
||||||
<field name="res_model">import.xlsx.wizard</field>
|
<field name="res_model">import.xlsx.wizard</field>
|
||||||
|
|
|
@ -12,10 +12,6 @@
|
||||||
name="import_action_id"
|
name="import_action_id"
|
||||||
eval="ref('action_purchase_order_import_xlsx')"
|
eval="ref('action_purchase_order_import_xlsx')"
|
||||||
/>
|
/>
|
||||||
<field
|
|
||||||
name="export_action_id"
|
|
||||||
eval="ref('action_purchase_order_export_xlsx')"
|
|
||||||
/>
|
|
||||||
<field name="input_instruction">
|
<field name="input_instruction">
|
||||||
{
|
{
|
||||||
'__EXPORT__': {
|
'__EXPORT__': {
|
||||||
|
|
|
@ -3,23 +3,6 @@
|
||||||
Copyright 2019 Ecosoft Co., Ltd.
|
Copyright 2019 Ecosoft Co., Ltd.
|
||||||
License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html).-->
|
License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html).-->
|
||||||
<odoo>
|
<odoo>
|
||||||
|
|
||||||
<record id="action_sale_oder_export_xlsx" model="ir.actions.act_window">
|
|
||||||
<field name="name">Export Excel</field>
|
|
||||||
<field name="res_model">export.xlsx.wizard</field>
|
|
||||||
<field name="binding_view_types">list,form</field>
|
|
||||||
<field name="binding_model_id" ref="sale.model_sale_order" />
|
|
||||||
<field name="view_mode">form</field>
|
|
||||||
<field name="target">new</field>
|
|
||||||
<field name="context">
|
|
||||||
{
|
|
||||||
'template_domain': [('res_model', '=', 'sale.order'),
|
|
||||||
('fname', '=', 'sale_order.xlsx'),
|
|
||||||
('gname', '=', False)],
|
|
||||||
}
|
|
||||||
</field>
|
|
||||||
</record>
|
|
||||||
|
|
||||||
<record id="action_sale_oder_import_xlsx" model="ir.actions.act_window">
|
<record id="action_sale_oder_import_xlsx" model="ir.actions.act_window">
|
||||||
<field name="name">Import Excel</field>
|
<field name="name">Import Excel</field>
|
||||||
<field name="res_model">import.xlsx.wizard</field>
|
<field name="res_model">import.xlsx.wizard</field>
|
||||||
|
@ -37,5 +20,4 @@
|
||||||
}
|
}
|
||||||
</field>
|
</field>
|
||||||
</record>
|
</record>
|
||||||
|
|
||||||
</odoo>
|
</odoo>
|
||||||
|
|
|
@ -8,8 +8,7 @@
|
||||||
<field name="fname">sale_order.xlsx</field>
|
<field name="fname">sale_order.xlsx</field>
|
||||||
<field name="name">Sale Order Template (import/export)</field>
|
<field name="name">Sale Order Template (import/export)</field>
|
||||||
<field name="description">Sample Sales Order Template for testing</field>
|
<field name="description">Sample Sales Order Template for testing</field>
|
||||||
<field name="import_action_id" eval="ref('action_sale_oder_export_xlsx')" />
|
<field name="import_action_id" eval="ref('action_sale_oder_import_xlsx')" />
|
||||||
<field name="export_action_id" eval="ref('action_sale_oder_import_xlsx')" />
|
|
||||||
<field name="input_instruction">
|
<field name="input_instruction">
|
||||||
{
|
{
|
||||||
'__EXPORT__': {
|
'__EXPORT__': {
|
||||||
|
|
Loading…
Reference in New Issue