[IMP] : black, isort, prettier
parent
7521e19465
commit
0cb075863b
|
@ -1,28 +1,29 @@
|
||||||
# Copyright 2019 Ecosoft Co., Ltd (http://ecosoft.co.th/)
|
# Copyright 2019 Ecosoft Co., Ltd (http://ecosoft.co.th/)
|
||||||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html)
|
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html)
|
||||||
|
|
||||||
{'name': 'Excel Import/Export/Report Demo',
|
{
|
||||||
'version': '12.0.1.0.0',
|
"name": "Excel Import/Export/Report Demo",
|
||||||
'author': 'Ecosoft,Odoo Community Association (OCA)',
|
"version": "12.0.1.0.0",
|
||||||
'license': 'AGPL-3',
|
"author": "Ecosoft,Odoo Community Association (OCA)",
|
||||||
'website': 'https://github.com/OCA/server-tools/',
|
"license": "AGPL-3",
|
||||||
'category': 'Tools',
|
"website": "https://github.com/OCA/server-tools/",
|
||||||
'depends': ['excel_import_export',
|
"category": "Tools",
|
||||||
'sale_management'],
|
"depends": ["excel_import_export", "sale_management"],
|
||||||
'data': ['import_export_sale_order/actions.xml',
|
"data": [
|
||||||
'import_export_sale_order/templates.xml',
|
"import_export_sale_order/actions.xml",
|
||||||
'report_sale_order/report_sale_order.xml',
|
"import_export_sale_order/templates.xml",
|
||||||
'report_sale_order/templates.xml',
|
"report_sale_order/report_sale_order.xml",
|
||||||
'import_sale_orders/menu_action.xml',
|
"report_sale_order/templates.xml",
|
||||||
'import_sale_orders/templates.xml',
|
"import_sale_orders/menu_action.xml",
|
||||||
|
"import_sale_orders/templates.xml",
|
||||||
# Use report action
|
# Use report action
|
||||||
'report_action/sale_order/report.xml',
|
"report_action/sale_order/report.xml",
|
||||||
'report_action/sale_order/templates.xml',
|
"report_action/sale_order/templates.xml",
|
||||||
'report_action/partner_list/report.xml',
|
"report_action/partner_list/report.xml",
|
||||||
'report_action/partner_list/templates.xml',
|
"report_action/partner_list/templates.xml",
|
||||||
'report_action/partner_list/report_partner_list.xml',
|
"report_action/partner_list/report_partner_list.xml",
|
||||||
],
|
],
|
||||||
'installable': True,
|
"installable": True,
|
||||||
'development_status': 'alpha',
|
"development_status": "alpha",
|
||||||
'maintainers': ['kittiu'],
|
"maintainers": ["kittiu"],
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8" ?>
|
||||||
<!--
|
<!--
|
||||||
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>
|
||||||
|
<act_window
|
||||||
<act_window id="action_sale_oder_export_xlsx"
|
id="action_sale_oder_export_xlsx"
|
||||||
name="Export Excel"
|
name="Export Excel"
|
||||||
res_model="export.xlsx.wizard"
|
res_model="export.xlsx.wizard"
|
||||||
src_model="sale.order"
|
src_model="sale.order"
|
||||||
|
@ -14,8 +14,10 @@
|
||||||
'template_domain': [('res_model', '=', 'sale.order'),
|
'template_domain': [('res_model', '=', 'sale.order'),
|
||||||
('fname', '=', 'sale_order.xlsx'),
|
('fname', '=', 'sale_order.xlsx'),
|
||||||
('gname', '=', False)],
|
('gname', '=', False)],
|
||||||
}"/>
|
}"
|
||||||
<act_window id="action_sale_oder_import_xlsx"
|
/>
|
||||||
|
<act_window
|
||||||
|
id="action_sale_oder_import_xlsx"
|
||||||
name="Import Excel"
|
name="Import Excel"
|
||||||
res_model="import.xlsx.wizard"
|
res_model="import.xlsx.wizard"
|
||||||
src_model="sale.order"
|
src_model="sale.order"
|
||||||
|
@ -27,6 +29,6 @@
|
||||||
('gname', '=', False)],
|
('gname', '=', False)],
|
||||||
'template_context': {},
|
'template_context': {},
|
||||||
'template_import_states': [],
|
'template_import_states': [],
|
||||||
}"/>
|
}"
|
||||||
|
/>
|
||||||
</odoo>
|
</odoo>
|
||||||
|
|
|
@ -1,9 +1,8 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8" ?>
|
||||||
<!--
|
<!--
|
||||||
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="sale_order_xlsx_template" model="xlsx.template">
|
<record id="sale_order_xlsx_template" model="xlsx.template">
|
||||||
<field name="res_model">sale.order</field>
|
<field name="res_model">sale.order</field>
|
||||||
<field name="fname">sale_order.xlsx</field>
|
<field name="fname">sale_order.xlsx</field>
|
||||||
|
@ -44,9 +43,7 @@
|
||||||
}
|
}
|
||||||
</field>
|
</field>
|
||||||
</record>
|
</record>
|
||||||
|
|
||||||
<function model="xlsx.template" name="load_xlsx_template">
|
<function model="xlsx.template" name="load_xlsx_template">
|
||||||
<value eval="[ref('sale_order_xlsx_template')]"/>
|
<value eval="[ref('sale_order_xlsx_template')]" />
|
||||||
</function>
|
</function>
|
||||||
|
|
||||||
</odoo>
|
</odoo>
|
||||||
|
|
|
@ -1,9 +1,8 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8" ?>
|
||||||
<!--
|
<!--
|
||||||
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_import_sale_order" model="ir.actions.act_window">
|
<record id="action_import_sale_order" model="ir.actions.act_window">
|
||||||
<field name="name">Sample Import Sale Order</field>
|
<field name="name">Sample Import Sale Order</field>
|
||||||
<field name="res_model">import.xlsx.wizard</field>
|
<field name="res_model">import.xlsx.wizard</field>
|
||||||
|
@ -16,10 +15,10 @@
|
||||||
('gname', '=', False)], }
|
('gname', '=', False)], }
|
||||||
</field>
|
</field>
|
||||||
</record>
|
</record>
|
||||||
|
<menuitem
|
||||||
<menuitem id="menu_import_sale_order"
|
id="menu_import_sale_order"
|
||||||
parent="excel_import_export.menu_excel_import_export"
|
parent="excel_import_export.menu_excel_import_export"
|
||||||
action="action_import_sale_order"
|
action="action_import_sale_order"
|
||||||
sequence="30"/>
|
sequence="30"
|
||||||
|
/>
|
||||||
</odoo>
|
</odoo>
|
||||||
|
|
|
@ -1,15 +1,14 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8" ?>
|
||||||
<!--
|
<!--
|
||||||
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="import_sale_order_xlsx_template" model="xlsx.template">
|
<record id="import_sale_order_xlsx_template" model="xlsx.template">
|
||||||
<field name="res_model">sale.order</field>
|
<field name="res_model">sale.order</field>
|
||||||
<field name="fname">import_sale_order.xlsx</field>
|
<field name="fname">import_sale_order.xlsx</field>
|
||||||
<field name="name">Import Sale Order Template</field>
|
<field name="name">Import Sale Order Template</field>
|
||||||
<field name="description">Sample Import Sales Order Tempalte for testing</field>
|
<field name="description">Sample Import Sales Order Tempalte for testing</field>
|
||||||
<field name="redirect_action" ref="sale.action_orders"/>
|
<field name="redirect_action" ref="sale.action_orders" />
|
||||||
<field name="input_instruction">
|
<field name="input_instruction">
|
||||||
{
|
{
|
||||||
'__IMPORT__': {
|
'__IMPORT__': {
|
||||||
|
@ -30,9 +29,7 @@
|
||||||
}
|
}
|
||||||
</field>
|
</field>
|
||||||
</record>
|
</record>
|
||||||
|
|
||||||
<function model="xlsx.template" name="load_xlsx_template">
|
<function model="xlsx.template" name="load_xlsx_template">
|
||||||
<value eval="[ref('import_sale_order_xlsx_template')]"/>
|
<value eval="[ref('import_sale_order_xlsx_template')]" />
|
||||||
</function>
|
</function>
|
||||||
|
|
||||||
</odoo>
|
</odoo>
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
<?xml version="1.0" encoding="UTF-8" ?>
|
<?xml version="1.0" encoding="UTF-8" ?>
|
||||||
<odoo>
|
<odoo>
|
||||||
<report id='action_report_partner_excel'
|
<report
|
||||||
|
id='action_report_partner_excel'
|
||||||
string='Partner List (.xlsx)'
|
string='Partner List (.xlsx)'
|
||||||
model='report.partner.list'
|
model='report.partner.list'
|
||||||
name='partner_list.xlsx'
|
name='partner_list.xlsx'
|
||||||
|
|
|
@ -1,27 +1,21 @@
|
||||||
# Copyright 2019 Ecosoft Co., Ltd (http://ecosoft.co.th/)
|
# Copyright 2019 Ecosoft Co., Ltd (http://ecosoft.co.th/)
|
||||||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html)
|
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html)
|
||||||
|
|
||||||
from odoo import models, fields, api
|
from odoo import api, fields, models
|
||||||
|
|
||||||
|
|
||||||
class ReportPartnerList(models.TransientModel):
|
class ReportPartnerList(models.TransientModel):
|
||||||
_name = 'report.partner.list'
|
_name = "report.partner.list"
|
||||||
_description = 'Wizard for report.partner.list'
|
_description = "Wizard for report.partner.list"
|
||||||
|
|
||||||
partner_ids = fields.Many2many(
|
partner_ids = fields.Many2many(comodel_name="res.partner",)
|
||||||
comodel_name='res.partner',
|
supplier = fields.Boolean(default=True,)
|
||||||
)
|
customer = fields.Boolean(default=True,)
|
||||||
supplier = fields.Boolean(
|
|
||||||
default=True,
|
|
||||||
)
|
|
||||||
customer = fields.Boolean(
|
|
||||||
default=True,
|
|
||||||
)
|
|
||||||
results = fields.Many2many(
|
results = fields.Many2many(
|
||||||
'res.partner',
|
"res.partner",
|
||||||
string='Results',
|
string="Results",
|
||||||
compute='_compute_results',
|
compute="_compute_results",
|
||||||
help='Use compute fields, so there is nothing store in database',
|
help="Use compute fields, so there is nothing store in database",
|
||||||
)
|
)
|
||||||
|
|
||||||
@api.multi
|
@api.multi
|
||||||
|
@ -30,8 +24,11 @@ class ReportPartnerList(models.TransientModel):
|
||||||
before export to excel by report_excel action
|
before export to excel by report_excel action
|
||||||
"""
|
"""
|
||||||
self.ensure_one()
|
self.ensure_one()
|
||||||
domain = ['|', ('supplier', '=', self.supplier),
|
domain = [
|
||||||
('customer', '=', self.customer)]
|
"|",
|
||||||
|
("supplier", "=", self.supplier),
|
||||||
|
("customer", "=", self.customer),
|
||||||
|
]
|
||||||
if self.partner_ids:
|
if self.partner_ids:
|
||||||
domain.append(('id', 'in', self.partner_ids.ids))
|
domain.append(("id", "in", self.partner_ids.ids))
|
||||||
self.results = self.env['res.partner'].search(domain, order='id')
|
self.results = self.env["res.partner"].search(domain, order="id")
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
<?xml version="1.0" encoding="UTF-8" ?>
|
<?xml version="1.0" encoding="UTF-8" ?>
|
||||||
<odoo>
|
<odoo>
|
||||||
|
|
||||||
<record id="partner_list_wizard" model="ir.ui.view">
|
<record id="partner_list_wizard" model="ir.ui.view">
|
||||||
<field name="name">partner.list.wizard</field>
|
<field name="name">partner.list.wizard</field>
|
||||||
<field name="model">report.partner.list</field>
|
<field name="model">report.partner.list</field>
|
||||||
|
@ -8,24 +7,25 @@
|
||||||
<form>
|
<form>
|
||||||
<group>
|
<group>
|
||||||
<group>
|
<group>
|
||||||
<field name="partner_ids" widget="many2many_tags"/>
|
<field name="partner_ids" widget="many2many_tags" />
|
||||||
</group>
|
</group>
|
||||||
<group>
|
<group>
|
||||||
<field name="customer"/>
|
<field name="customer" />
|
||||||
<field name="supplier"/>
|
<field name="supplier" />
|
||||||
</group>
|
</group>
|
||||||
</group>
|
</group>
|
||||||
<footer>
|
<footer>
|
||||||
<button name='%(excel_import_export_demo.action_report_partner_excel)d'
|
<button
|
||||||
type='action' string='Execute'
|
name='%(excel_import_export_demo.action_report_partner_excel)d'
|
||||||
class='oe_highlight'/>
|
type='action'
|
||||||
<button special='cancel'
|
string='Execute'
|
||||||
string='Cancel'/>
|
class='oe_highlight'
|
||||||
|
/>
|
||||||
|
<button special='cancel' string='Cancel' />
|
||||||
</footer>
|
</footer>
|
||||||
</form>
|
</form>
|
||||||
</field>
|
</field>
|
||||||
</record>
|
</record>
|
||||||
|
|
||||||
<record id='action_report_partner_list' model='ir.actions.act_window'>
|
<record id='action_report_partner_list' model='ir.actions.act_window'>
|
||||||
<field name='name'>Partner List Report</field>
|
<field name='name'>Partner List Report</field>
|
||||||
<field name='res_model'>report.partner.list</field>
|
<field name='res_model'>report.partner.list</field>
|
||||||
|
@ -33,11 +33,10 @@
|
||||||
<field name='view_mode'>form</field>
|
<field name='view_mode'>form</field>
|
||||||
<field name='target'>new</field>
|
<field name='target'>new</field>
|
||||||
</record>
|
</record>
|
||||||
|
<menuitem
|
||||||
<menuitem id="menu_report_partner_list"
|
id="menu_report_partner_list"
|
||||||
parent="sale.menu_sale_report"
|
parent="sale.menu_sale_report"
|
||||||
action="action_report_partner_list"
|
action="action_report_partner_list"
|
||||||
name="Partner List Report"
|
name="Partner List Report"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
</odoo>
|
</odoo>
|
||||||
|
|
|
@ -1,11 +1,12 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8" ?>
|
||||||
<odoo>
|
<odoo>
|
||||||
|
|
||||||
<record id="partner_list_xlsx_template" model="xlsx.template">
|
<record id="partner_list_xlsx_template" model="xlsx.template">
|
||||||
<field name="res_model">report.partner.list</field>
|
<field name="res_model">report.partner.list</field>
|
||||||
<field name="fname">partner_list.xlsx</field>
|
<field name="fname">partner_list.xlsx</field>
|
||||||
<field name="name">Partner List Report Template</field>
|
<field name="name">Partner List Report Template</field>
|
||||||
<field name="description">Sample Partner List Report Template for testing</field>
|
<field
|
||||||
|
name="description"
|
||||||
|
>Sample Partner List Report Template for testing</field>
|
||||||
<field name="input_instruction">
|
<field name="input_instruction">
|
||||||
{
|
{
|
||||||
'__EXPORT__': {
|
'__EXPORT__': {
|
||||||
|
@ -21,9 +22,7 @@
|
||||||
}
|
}
|
||||||
</field>
|
</field>
|
||||||
</record>
|
</record>
|
||||||
|
|
||||||
<function model="xlsx.template" name="load_xlsx_template">
|
<function model="xlsx.template" name="load_xlsx_template">
|
||||||
<value eval="[ref('partner_list_xlsx_template')]"/>
|
<value eval="[ref('partner_list_xlsx_template')]" />
|
||||||
</function>
|
</function>
|
||||||
|
|
||||||
</odoo>
|
</odoo>
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
<?xml version="1.0" encoding="UTF-8" ?>
|
<?xml version="1.0" encoding="UTF-8" ?>
|
||||||
<odoo>
|
<odoo>
|
||||||
|
<report
|
||||||
<report id='action_report_saleorder_excel'
|
id='action_report_saleorder_excel'
|
||||||
string='Quotation / Order (.xlsx)'
|
string='Quotation / Order (.xlsx)'
|
||||||
model='sale.order'
|
model='sale.order'
|
||||||
name='sale_order_form.xlsx'
|
name='sale_order_form.xlsx'
|
||||||
|
@ -9,5 +9,4 @@
|
||||||
print_report_name="(object.state in ('draft', 'sent') and 'Quotation - %s' % (object.name)) or 'Order - %s' % (object.name)"
|
print_report_name="(object.state in ('draft', 'sent') and 'Quotation - %s' % (object.name)) or 'Order - %s' % (object.name)"
|
||||||
report_type='excel'
|
report_type='excel'
|
||||||
/>
|
/>
|
||||||
|
|
||||||
</odoo>
|
</odoo>
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8" ?>
|
||||||
<odoo>
|
<odoo>
|
||||||
|
|
||||||
<record id="sale_order_excel_template" model="xlsx.template">
|
<record id="sale_order_excel_template" model="xlsx.template">
|
||||||
<field name="res_model">sale.order</field>
|
<field name="res_model">sale.order</field>
|
||||||
<field name="fname">sale_order_form.xlsx</field>
|
<field name="fname">sale_order_form.xlsx</field>
|
||||||
|
@ -28,9 +27,7 @@
|
||||||
}
|
}
|
||||||
</field>
|
</field>
|
||||||
</record>
|
</record>
|
||||||
|
|
||||||
<function model="xlsx.template" name="load_xlsx_template">
|
<function model="xlsx.template" name="load_xlsx_template">
|
||||||
<value eval="[ref('sale_order_excel_template')]"/>
|
<value eval="[ref('sale_order_excel_template')]" />
|
||||||
</function>
|
</function>
|
||||||
|
|
||||||
</odoo>
|
</odoo>
|
||||||
|
|
|
@ -1,25 +1,22 @@
|
||||||
# Copyright 2019 Ecosoft Co., Ltd (http://ecosoft.co.th/)
|
# Copyright 2019 Ecosoft Co., Ltd (http://ecosoft.co.th/)
|
||||||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html)
|
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html)
|
||||||
|
|
||||||
from openerp import models, fields, api
|
from openerp import api, fields, models
|
||||||
|
|
||||||
|
|
||||||
class ReportSaleOrder(models.TransientModel):
|
class ReportSaleOrder(models.TransientModel):
|
||||||
_name = 'report.sale.order'
|
_name = "report.sale.order"
|
||||||
_description = 'Wizard for report.sale.order'
|
_description = "Wizard for report.sale.order"
|
||||||
_inherit = 'xlsx.report'
|
_inherit = "xlsx.report"
|
||||||
|
|
||||||
# Search Criteria
|
# Search Criteria
|
||||||
partner_id = fields.Many2one(
|
partner_id = fields.Many2one("res.partner", string="Partner",)
|
||||||
'res.partner',
|
|
||||||
string='Partner',
|
|
||||||
)
|
|
||||||
# Report Result, sale.order
|
# Report Result, sale.order
|
||||||
results = fields.Many2many(
|
results = fields.Many2many(
|
||||||
'sale.order',
|
"sale.order",
|
||||||
string='Results',
|
string="Results",
|
||||||
compute='_compute_results',
|
compute="_compute_results",
|
||||||
help='Use compute fields, so there is nothing stored in database',
|
help="Use compute fields, so there is nothing stored in database",
|
||||||
)
|
)
|
||||||
|
|
||||||
@api.multi
|
@api.multi
|
||||||
|
@ -28,8 +25,8 @@ class ReportSaleOrder(models.TransientModel):
|
||||||
before export to excel, by using xlsx.export
|
before export to excel, by using xlsx.export
|
||||||
"""
|
"""
|
||||||
self.ensure_one()
|
self.ensure_one()
|
||||||
Result = self.env['sale.order']
|
Result = self.env["sale.order"]
|
||||||
domain = []
|
domain = []
|
||||||
if self.partner_id:
|
if self.partner_id:
|
||||||
domain += [('partner_id', '=', self.partner_id.id)]
|
domain += [("partner_id", "=", self.partner_id.id)]
|
||||||
self.results = Result.search(domain)
|
self.results = Result.search(domain)
|
||||||
|
|
|
@ -1,25 +1,23 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8" ?>
|
||||||
<!--
|
<!--
|
||||||
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="report_sale_order" model="ir.ui.view">
|
<record id="report_sale_order" model="ir.ui.view">
|
||||||
<field name="name">report.sale.order</field>
|
<field name="name">report.sale.order</field>
|
||||||
<field name="model">report.sale.order</field>
|
<field name="model">report.sale.order</field>
|
||||||
<field name="inherit_id" ref="excel_import_export.xlsx_report_view"/>
|
<field name="inherit_id" ref="excel_import_export.xlsx_report_view" />
|
||||||
<field name="mode">primary</field>
|
<field name="mode">primary</field>
|
||||||
<field name="arch" type="xml">
|
<field name="arch" type="xml">
|
||||||
<xpath expr="//group[@name='criteria']" position="inside">
|
<xpath expr="//group[@name='criteria']" position="inside">
|
||||||
<group>
|
<group>
|
||||||
<field name="partner_id"/>
|
<field name="partner_id" />
|
||||||
</group>
|
</group>
|
||||||
<group>
|
<group>
|
||||||
</group>
|
</group>
|
||||||
</xpath>
|
</xpath>
|
||||||
</field>
|
</field>
|
||||||
</record>
|
</record>
|
||||||
|
|
||||||
<record id="action_report_sale_order" model="ir.actions.act_window">
|
<record id="action_report_sale_order" model="ir.actions.act_window">
|
||||||
<field name="name">Sample Sales Report</field>
|
<field name="name">Sample Sales Report</field>
|
||||||
<field name="res_model">report.sale.order</field>
|
<field name="res_model">report.sale.order</field>
|
||||||
|
@ -32,10 +30,10 @@
|
||||||
('gname', '=', False)]}
|
('gname', '=', False)]}
|
||||||
</field>
|
</field>
|
||||||
</record>
|
</record>
|
||||||
|
<menuitem
|
||||||
<menuitem id="menu_report_sale_order"
|
id="menu_report_sale_order"
|
||||||
parent="excel_import_export.menu_excel_import_export"
|
parent="excel_import_export.menu_excel_import_export"
|
||||||
action="action_report_sale_order"
|
action="action_report_sale_order"
|
||||||
sequence="20"/>
|
sequence="20"
|
||||||
|
/>
|
||||||
</odoo>
|
</odoo>
|
||||||
|
|
|
@ -1,9 +1,8 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8" ?>
|
||||||
<!--
|
<!--
|
||||||
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="report_sale_order_template" model="xlsx.template">
|
<record id="report_sale_order_template" model="xlsx.template">
|
||||||
<field name="res_model">report.sale.order</field>
|
<field name="res_model">report.sale.order</field>
|
||||||
<field name="fname">report_sale_order.xlsx</field>
|
<field name="fname">report_sale_order.xlsx</field>
|
||||||
|
@ -28,9 +27,7 @@
|
||||||
}
|
}
|
||||||
</field>
|
</field>
|
||||||
</record>
|
</record>
|
||||||
|
|
||||||
<function model="xlsx.template" name="load_xlsx_template">
|
<function model="xlsx.template" name="load_xlsx_template">
|
||||||
<value eval="[ref('report_sale_order_template')]"/>
|
<value eval="[ref('report_sale_order_template')]" />
|
||||||
</function>
|
</function>
|
||||||
|
|
||||||
</odoo>
|
</odoo>
|
||||||
|
|
|
@ -4,56 +4,54 @@ from odoo.tests.common import SingleTransactionCase
|
||||||
|
|
||||||
|
|
||||||
class TestExcelImportExport(SingleTransactionCase):
|
class TestExcelImportExport(SingleTransactionCase):
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def setUpClass(cls):
|
def setUpClass(cls):
|
||||||
super(TestExcelImportExport, cls).setUpClass()
|
super(TestExcelImportExport, cls).setUpClass()
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def setUpXLSXTemplate(cls):
|
def setUpXLSXTemplate(cls):
|
||||||
cls.template_obj = cls.env['xlsx.template']
|
cls.template_obj = cls.env["xlsx.template"]
|
||||||
# Create xlsx.template using input_instruction
|
# Create xlsx.template using input_instruction
|
||||||
input_instruction = {
|
input_instruction = {
|
||||||
'__EXPORT__': {
|
"__EXPORT__": {
|
||||||
'sale_order': {
|
"sale_order": {
|
||||||
'_HEAD_': {
|
"_HEAD_": {
|
||||||
'B2': 'partner_id.display_name${value or ""}'
|
"B2": 'partner_id.display_name${value or ""}'
|
||||||
'#{align=left;style=text}',
|
"#{align=left;style=text}",
|
||||||
'B3': 'name${value or ""}#{align=left;style=text}',
|
"B3": 'name${value or ""}#{align=left;style=text}',
|
||||||
},
|
},
|
||||||
'order_line': {
|
"order_line": {
|
||||||
'A6': 'product_id.display_name${value or ""}'
|
"A6": 'product_id.display_name${value or ""}' "#{style=text}",
|
||||||
'#{style=text}',
|
"B6": 'name${value or ""}#{style=text}',
|
||||||
'B6': 'name${value or ""}#{style=text}',
|
"C6": "product_uom_qty${value or 0}#{style=number}",
|
||||||
'C6': 'product_uom_qty${value or 0}#{style=number}',
|
"D6": 'product_uom.name${value or ""}#{style=text}',
|
||||||
'D6': 'product_uom.name${value or ""}#{style=text}',
|
"E6": "price_unit${value or 0}#{style=number}",
|
||||||
'E6': 'price_unit${value or 0}#{style=number}',
|
"F6": 'tax_id${value and ","'
|
||||||
'F6': 'tax_id${value and ","'
|
|
||||||
'.join([x.display_name for x in value]) or ""}',
|
'.join([x.display_name for x in value]) or ""}',
|
||||||
'G6': 'price_subtotal${value or 0}#{style=number}',
|
"G6": "price_subtotal${value or 0}#{style=number}",
|
||||||
}
|
},
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
'__IMPORT__': {
|
"__IMPORT__": {
|
||||||
'sale_order': {
|
"sale_order": {
|
||||||
'order_line': {
|
"order_line": {
|
||||||
'A6': 'product_id',
|
"A6": "product_id",
|
||||||
'B6': 'name',
|
"B6": "name",
|
||||||
'C6': 'product_uom_qty',
|
"C6": "product_uom_qty",
|
||||||
'D6': 'product_uom',
|
"D6": "product_uom",
|
||||||
'E6': 'price_unit',
|
"E6": "price_unit",
|
||||||
'F6': 'tax_id',
|
"F6": "tax_id",
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
# '__POST_IMPORT__': '${object.post_import_do_something()}',
|
# '__POST_IMPORT__': '${object.post_import_do_something()}',
|
||||||
}
|
}
|
||||||
vals = {
|
vals = {
|
||||||
'res_model': 'sale.order',
|
"res_model": "sale.order",
|
||||||
'fname': 'sale_order.xlsx',
|
"fname": "sale_order.xlsx",
|
||||||
'name': 'Sale Order Template',
|
"name": "Sale Order Template",
|
||||||
'description': 'Sample Sales Order Tempalte for testing',
|
"description": "Sample Sales Order Tempalte for testing",
|
||||||
'input_instruction': str(input_instruction),
|
"input_instruction": str(input_instruction),
|
||||||
}
|
}
|
||||||
cls.sample_template = cls.template_obj.create(vals)
|
cls.sample_template = cls.template_obj.create(vals)
|
||||||
|
|
||||||
|
@ -62,69 +60,77 @@ class TestExcelImportExport(SingleTransactionCase):
|
||||||
cls.setUpPrepSaleOrder()
|
cls.setUpPrepSaleOrder()
|
||||||
# Create a Sales Order
|
# Create a Sales Order
|
||||||
product_line = {
|
product_line = {
|
||||||
'name': cls.product_order.name,
|
"name": cls.product_order.name,
|
||||||
'product_id': cls.product_order.id,
|
"product_id": cls.product_order.id,
|
||||||
'product_uom_qty': 2,
|
"product_uom_qty": 2,
|
||||||
'product_uom': cls.product_order.uom_id.id,
|
"product_uom": cls.product_order.uom_id.id,
|
||||||
'price_unit': cls.product_order.list_price,
|
"price_unit": cls.product_order.list_price,
|
||||||
'tax_id': False,
|
"tax_id": False,
|
||||||
}
|
}
|
||||||
cls.sale_order = cls.env['sale.order'].create({
|
cls.sale_order = cls.env["sale.order"].create(
|
||||||
'partner_id': cls.partner.id,
|
{
|
||||||
'order_line': [(0, 0, product_line), (0, 0, product_line)],
|
"partner_id": cls.partner.id,
|
||||||
})
|
"order_line": [(0, 0, product_line), (0, 0, product_line)],
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def setUpManySaleOrder(cls):
|
def setUpManySaleOrder(cls):
|
||||||
cls.setUpPrepSaleOrder()
|
cls.setUpPrepSaleOrder()
|
||||||
# Create a Sales Order
|
# Create a Sales Order
|
||||||
product_line = {
|
product_line = {
|
||||||
'name': cls.product_order.name,
|
"name": cls.product_order.name,
|
||||||
'product_id': cls.product_order.id,
|
"product_id": cls.product_order.id,
|
||||||
'product_uom_qty': 2,
|
"product_uom_qty": 2,
|
||||||
'product_uom': cls.product_order.uom_id.id,
|
"product_uom": cls.product_order.uom_id.id,
|
||||||
'price_unit': cls.product_order.list_price,
|
"price_unit": cls.product_order.list_price,
|
||||||
'tax_id': False,
|
"tax_id": False,
|
||||||
}
|
}
|
||||||
for i in range(10):
|
for i in range(10):
|
||||||
cls.env['sale.order'].create({
|
cls.env["sale.order"].create(
|
||||||
'partner_id': cls.partner.id,
|
{
|
||||||
'order_line': [(0, 0, product_line), (0, 0, product_line)],
|
"partner_id": cls.partner.id,
|
||||||
})
|
"order_line": [(0, 0, product_line), (0, 0, product_line)],
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def setUpPrepSaleOrder(cls):
|
def setUpPrepSaleOrder(cls):
|
||||||
categ_ids = cls.env['res.partner.category'].search([]).ids
|
categ_ids = cls.env["res.partner.category"].search([]).ids
|
||||||
cls.partner = cls.env['res.partner'].create({
|
cls.partner = cls.env["res.partner"].create(
|
||||||
'name': 'Test Partner',
|
{"name": "Test Partner", "category_id": [(6, 0, categ_ids)],}
|
||||||
'category_id': [(6, 0, categ_ids)],
|
)
|
||||||
})
|
|
||||||
# Create a Product
|
# Create a Product
|
||||||
user_type_income = \
|
user_type_income = cls.env.ref("account.data_account_type_direct_costs")
|
||||||
cls.env.ref('account.data_account_type_direct_costs')
|
cls.account_income_product = cls.env["account.account"].create(
|
||||||
cls.account_income_product = cls.env['account.account'].create({
|
{
|
||||||
'code': 'INCOME_PROD111',
|
"code": "INCOME_PROD111",
|
||||||
'name': 'Icome - Test Account',
|
"name": "Icome - Test Account",
|
||||||
'user_type_id': user_type_income.id,
|
"user_type_id": user_type_income.id,
|
||||||
})
|
}
|
||||||
|
)
|
||||||
# Create category
|
# Create category
|
||||||
cls.product_category = cls.env['product.category'].create({
|
cls.product_category = cls.env["product.category"].create(
|
||||||
'name': 'Product Category with Income account',
|
{
|
||||||
'property_account_income_categ_id': cls.account_income_product.id
|
"name": "Product Category with Income account",
|
||||||
})
|
"property_account_income_categ_id": cls.account_income_product.id,
|
||||||
|
}
|
||||||
|
)
|
||||||
# Products
|
# Products
|
||||||
uom_unit = cls.env.ref('uom.product_uom_unit')
|
uom_unit = cls.env.ref("uom.product_uom_unit")
|
||||||
cls.product_order = cls.env['product.product'].create({
|
cls.product_order = cls.env["product.product"].create(
|
||||||
'name': "Test Product",
|
{
|
||||||
'standard_price': 235.0,
|
"name": "Test Product",
|
||||||
'list_price': 280.0,
|
"standard_price": 235.0,
|
||||||
'type': 'consu',
|
"list_price": 280.0,
|
||||||
'uom_id': uom_unit.id,
|
"type": "consu",
|
||||||
'uom_po_id': uom_unit.id,
|
"uom_id": uom_unit.id,
|
||||||
'invoice_policy': 'order',
|
"uom_po_id": uom_unit.id,
|
||||||
'expense_policy': 'no',
|
"invoice_policy": "order",
|
||||||
'default_code': 'PROD_ORDER',
|
"expense_policy": "no",
|
||||||
'service_type': 'manual',
|
"default_code": "PROD_ORDER",
|
||||||
'taxes_id': False,
|
"service_type": "manual",
|
||||||
'categ_id': cls.product_category.id,
|
"taxes_id": False,
|
||||||
})
|
"categ_id": cls.product_category.id,
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
# Copyright 2019 Ecosoft Co., Ltd (http://ecosoft.co.th/)
|
# Copyright 2019 Ecosoft Co., Ltd (http://ecosoft.co.th/)
|
||||||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html)
|
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html)
|
||||||
from .test_common import TestExcelImportExport
|
|
||||||
from odoo.tests.common import Form
|
from odoo.tests.common import Form
|
||||||
|
|
||||||
|
from .test_common import TestExcelImportExport
|
||||||
|
|
||||||
|
|
||||||
class TestXLSXImportExport(TestExcelImportExport):
|
class TestXLSXImportExport(TestExcelImportExport):
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def setUpClass(cls):
|
def setUpClass(cls):
|
||||||
super(TestExcelImportExport, cls).setUpClass()
|
super(TestExcelImportExport, cls).setUpClass()
|
||||||
|
@ -15,38 +15,48 @@ class TestXLSXImportExport(TestExcelImportExport):
|
||||||
# Create Sales Order
|
# Create Sales Order
|
||||||
self.setUpSaleOrder()
|
self.setUpSaleOrder()
|
||||||
# ----------- EXPORT ---------------
|
# ----------- EXPORT ---------------
|
||||||
ctx = {'active_model': 'sale.order',
|
ctx = {
|
||||||
'active_id': self.sale_order.id,
|
"active_model": "sale.order",
|
||||||
'template_domain': [('res_model', '=', 'sale.order'),
|
"active_id": self.sale_order.id,
|
||||||
('fname', '=', 'sale_order.xlsx'),
|
"template_domain": [
|
||||||
('gname', '=', False)], }
|
("res_model", "=", "sale.order"),
|
||||||
f = Form(self.env['export.xlsx.wizard'].with_context(ctx))
|
("fname", "=", "sale_order.xlsx"),
|
||||||
|
("gname", "=", False),
|
||||||
|
],
|
||||||
|
}
|
||||||
|
f = Form(self.env["export.xlsx.wizard"].with_context(ctx))
|
||||||
export_wizard = f.save()
|
export_wizard = f.save()
|
||||||
# Test whether it loads correct template
|
# Test whether it loads correct template
|
||||||
self.assertEqual(export_wizard.template_id,
|
self.assertEqual(
|
||||||
self.env.ref('excel_import_export_demo.'
|
export_wizard.template_id,
|
||||||
'sale_order_xlsx_template'))
|
self.env.ref("excel_import_export_demo." "sale_order_xlsx_template"),
|
||||||
|
)
|
||||||
# Export excel
|
# Export excel
|
||||||
export_wizard.action_export()
|
export_wizard.action_export()
|
||||||
self.assertTrue(export_wizard.data)
|
self.assertTrue(export_wizard.data)
|
||||||
self.export_file = export_wizard.data
|
self.export_file = export_wizard.data
|
||||||
|
|
||||||
# ----------- IMPORT ---------------
|
# ----------- IMPORT ---------------
|
||||||
ctx = {'active_model': 'sale.order',
|
ctx = {
|
||||||
'active_id': self.sale_order.id,
|
"active_model": "sale.order",
|
||||||
'template_domain': [('res_model', '=', 'sale.order'),
|
"active_id": self.sale_order.id,
|
||||||
('fname', '=', 'sale_order.xlsx'),
|
"template_domain": [
|
||||||
('gname', '=', False)],
|
("res_model", "=", "sale.order"),
|
||||||
'template_context': {'state': 'draft'}, }
|
("fname", "=", "sale_order.xlsx"),
|
||||||
with Form(self.env['import.xlsx.wizard'].with_context(ctx)) as f:
|
("gname", "=", False),
|
||||||
|
],
|
||||||
|
"template_context": {"state": "draft"},
|
||||||
|
}
|
||||||
|
with Form(self.env["import.xlsx.wizard"].with_context(ctx)) as f:
|
||||||
f.import_file = self.export_file
|
f.import_file = self.export_file
|
||||||
import_wizard = f.save()
|
import_wizard = f.save()
|
||||||
# Test sample template
|
# Test sample template
|
||||||
import_wizard.get_import_sample()
|
import_wizard.get_import_sample()
|
||||||
self.assertTrue(import_wizard.datas)
|
self.assertTrue(import_wizard.datas)
|
||||||
# Test whether it loads correct template
|
# Test whether it loads correct template
|
||||||
self.assertEqual(import_wizard.template_id,
|
self.assertEqual(
|
||||||
self.env.ref('excel_import_export_demo.'
|
import_wizard.template_id,
|
||||||
'sale_order_xlsx_template'))
|
self.env.ref("excel_import_export_demo." "sale_order_xlsx_template"),
|
||||||
|
)
|
||||||
# Import Excel
|
# Import Excel
|
||||||
import_wizard.action_import()
|
import_wizard.action_import()
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
# Copyright 2019 Ecosoft Co., Ltd (http://ecosoft.co.th/)
|
# Copyright 2019 Ecosoft Co., Ltd (http://ecosoft.co.th/)
|
||||||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html)
|
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html)
|
||||||
from .test_common import TestExcelImportExport
|
|
||||||
from odoo.tests.common import Form
|
from odoo.tests.common import Form
|
||||||
|
|
||||||
|
from .test_common import TestExcelImportExport
|
||||||
|
|
||||||
|
|
||||||
class TestXLSXReport(TestExcelImportExport):
|
class TestXLSXReport(TestExcelImportExport):
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def setUpClass(cls):
|
def setUpClass(cls):
|
||||||
super(TestXLSXReport, cls).setUpClass()
|
super(TestXLSXReport, cls).setUpClass()
|
||||||
|
@ -14,16 +14,21 @@ class TestXLSXReport(TestExcelImportExport):
|
||||||
""" Test Report from Sales Order """
|
""" Test Report from Sales Order """
|
||||||
# Create Many Sales Orders
|
# Create Many Sales Orders
|
||||||
self.setUpManySaleOrder()
|
self.setUpManySaleOrder()
|
||||||
ctx = {'template_domain': [('res_model', '=', 'report.sale.order'),
|
ctx = {
|
||||||
('fname', '=', 'report_sale_order.xlsx'),
|
"template_domain": [
|
||||||
('gname', '=', False)], }
|
("res_model", "=", "report.sale.order"),
|
||||||
with Form(self.env['report.sale.order'].with_context(ctx)) as f:
|
("fname", "=", "report_sale_order.xlsx"),
|
||||||
|
("gname", "=", False),
|
||||||
|
],
|
||||||
|
}
|
||||||
|
with Form(self.env["report.sale.order"].with_context(ctx)) as f:
|
||||||
f.partner_id = self.partner
|
f.partner_id = self.partner
|
||||||
report_wizard = f.save()
|
report_wizard = f.save()
|
||||||
# Test whether it loads correct template
|
# Test whether it loads correct template
|
||||||
self.assertEqual(report_wizard.template_id,
|
self.assertEqual(
|
||||||
self.env.ref('excel_import_export_demo.'
|
report_wizard.template_id,
|
||||||
'report_sale_order_template'))
|
self.env.ref("excel_import_export_demo." "report_sale_order_template"),
|
||||||
|
)
|
||||||
# Report excel
|
# Report excel
|
||||||
report_wizard.report_xlsx()
|
report_wizard.report_xlsx()
|
||||||
self.assertTrue(report_wizard.data)
|
self.assertTrue(report_wizard.data)
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
# Copyright 2019 Ecosoft Co., Ltd (http://ecosoft.co.th/)
|
# Copyright 2019 Ecosoft Co., Ltd (http://ecosoft.co.th/)
|
||||||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html)
|
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html)
|
||||||
from ast import literal_eval
|
from ast import literal_eval
|
||||||
|
|
||||||
from .test_common import TestExcelImportExport
|
from .test_common import TestExcelImportExport
|
||||||
|
|
||||||
|
|
||||||
class TestXLSXTemplate(TestExcelImportExport):
|
class TestXLSXTemplate(TestExcelImportExport):
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def setUpClass(cls):
|
def setUpClass(cls):
|
||||||
super(TestExcelImportExport, cls).setUpClass()
|
super(TestExcelImportExport, cls).setUpClass()
|
||||||
|
@ -17,46 +17,44 @@ class TestXLSXTemplate(TestExcelImportExport):
|
||||||
self.assertDictEqual(
|
self.assertDictEqual(
|
||||||
instruction_dict,
|
instruction_dict,
|
||||||
{
|
{
|
||||||
'__EXPORT__': {
|
"__EXPORT__": {
|
||||||
'sale_order': {
|
"sale_order": {
|
||||||
'_HEAD_': {
|
"_HEAD_": {
|
||||||
'B2': 'partner_id.display_name${value or ""}'
|
"B2": 'partner_id.display_name${value or ""}'
|
||||||
'#{align=left;style=text}#??',
|
"#{align=left;style=text}#??",
|
||||||
'B3': 'name${value or ""}'
|
"B3": 'name${value or ""}' "#{align=left;style=text}#??",
|
||||||
'#{align=left;style=text}#??'},
|
},
|
||||||
'order_line': {
|
"order_line": {
|
||||||
'A6': 'product_id.display_name${value or ""}'
|
"A6": 'product_id.display_name${value or ""}'
|
||||||
'#{style=text}#??',
|
"#{style=text}#??",
|
||||||
'B6': 'name${value or ""}#{style=text}#??',
|
"B6": 'name${value or ""}#{style=text}#??',
|
||||||
'C6': 'product_uom_qty${value or 0}'
|
"C6": "product_uom_qty${value or 0}" "#{style=number}#??",
|
||||||
'#{style=number}#??',
|
"D6": 'product_uom.name${value or ""}' "#{style=text}#??",
|
||||||
'D6': 'product_uom.name${value or ""}'
|
"E6": "price_unit${value or 0}#{style=number}#??",
|
||||||
'#{style=text}#??',
|
"F6": 'tax_id${value and ",".join([x.display_name '
|
||||||
'E6': 'price_unit${value or 0}#{style=number}#??',
|
|
||||||
'F6': 'tax_id${value and ",".join([x.display_name '
|
|
||||||
'for x in value]) or ""}#{}#??',
|
'for x in value]) or ""}#{}#??',
|
||||||
'G6': 'price_subtotal${value or 0}'
|
"G6": "price_subtotal${value or 0}" "#{style=number}#??",
|
||||||
'#{style=number}#??'
|
},
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"__IMPORT__": {
|
||||||
|
"sale_order": {
|
||||||
|
"order_line": {
|
||||||
|
"A6": "product_id",
|
||||||
|
"B6": "name",
|
||||||
|
"C6": "product_uom_qty",
|
||||||
|
"D6": "product_uom",
|
||||||
|
"E6": "price_unit",
|
||||||
|
"F6": "tax_id",
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
'__IMPORT__': {
|
"__POST_IMPORT__": False,
|
||||||
'sale_order': {
|
|
||||||
'order_line': {
|
|
||||||
'A6': 'product_id',
|
|
||||||
'B6': 'name',
|
|
||||||
'C6': 'product_uom_qty',
|
|
||||||
'D6': 'product_uom',
|
|
||||||
'E6': 'price_unit',
|
|
||||||
'F6': 'tax_id',
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
'__POST_IMPORT__': False
|
|
||||||
}
|
|
||||||
)
|
)
|
||||||
# Finally load excel file into this new template
|
# Finally load excel file into this new template
|
||||||
self.assertFalse(self.sample_template.datas) # Not yet loaded
|
self.assertFalse(self.sample_template.datas) # Not yet loaded
|
||||||
self.template_obj.load_xlsx_template([self.sample_template.id],
|
self.template_obj.load_xlsx_template(
|
||||||
addon='excel_import_export_demo')
|
[self.sample_template.id], addon="excel_import_export_demo"
|
||||||
|
)
|
||||||
self.assertTrue(self.sample_template.datas) # Loaded successfully
|
self.assertTrue(self.sample_template.datas) # Loaded successfully
|
||||||
|
|
Loading…
Reference in New Issue