diff --git a/excel_import_export_demo/__init__.py b/excel_import_export_demo/__init__.py index 1334da2f4..c839a7771 100644 --- a/excel_import_export_demo/__init__.py +++ b/excel_import_export_demo/__init__.py @@ -3,3 +3,4 @@ from . import import_export_sale_order from . import report_sale_order +from . import report_action diff --git a/excel_import_export_demo/__manifest__.py b/excel_import_export_demo/__manifest__.py index 9463f279f..6f2c47433 100644 --- a/excel_import_export_demo/__manifest__.py +++ b/excel_import_export_demo/__manifest__.py @@ -1,7 +1,7 @@ # Copyright 2019 Ecosoft Co., Ltd (http://ecosoft.co.th/) # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html) -{'name': 'Excel Import/Export Demo', +{'name': 'Excel Import/Export/Report Demo', 'version': '12.0.1.0.0', 'author': 'Ecosoft,Odoo Community Association (OCA)', 'license': 'AGPL-3', @@ -15,6 +15,12 @@ 'report_sale_order/templates.xml', 'import_sale_orders/menu_action.xml', 'import_sale_orders/templates.xml', + # Use report action + 'report_action/sale_order/report.xml', + 'report_action/sale_order/templates.xml', + 'report_action/partner_list/report.xml', + 'report_action/partner_list/templates.xml', + 'report_action/partner_list/report_partner_list.xml', ], 'installable': True, 'development_status': 'alpha', diff --git a/excel_import_export_demo/readme/DESCRIPTION.rst b/excel_import_export_demo/readme/DESCRIPTION.rst index e1c00d558..4915cfd09 100644 --- a/excel_import_export_demo/readme/DESCRIPTION.rst +++ b/excel_import_export_demo/readme/DESCRIPTION.rst @@ -3,3 +3,5 @@ This module provide some example use case for excel_import_export 1. Import/Export Sales Order (import_export_sale_order) 2. Import New Sales Orders (import_sale_orders) 3. Sales Orders Report (report_sale_order) +4. Print Quoation / Order (.xlsx) (report_action/sale_order) +5. Run Partner List Report (report_action/partner_list) diff --git a/excel_import_export_demo/readme/HISTORY.rst b/excel_import_export_demo/readme/HISTORY.rst index b8d1b41b6..3b4b1bf79 100644 --- a/excel_import_export_demo/readme/HISTORY.rst +++ b/excel_import_export_demo/readme/HISTORY.rst @@ -1,3 +1,8 @@ +12.0.1.0.0 (2019-08-09) +~~~~~~~~~~~~~~~~~~~~~~~ + +* Add 2 new examples using report action, 1) sale_order 2) partner_list + 12.0.1.0.0 (2019-02-24) ~~~~~~~~~~~~~~~~~~~~~~~ diff --git a/excel_import_export_demo/readme/USAGE.rst b/excel_import_export_demo/readme/USAGE.rst index cdf6bdeff..c95b0bd79 100644 --- a/excel_import_export_demo/readme/USAGE.rst +++ b/excel_import_export_demo/readme/USAGE.rst @@ -1,11 +1,19 @@ -**Use Case 1:** Export/Import Excel on existing document +**Example 1:** Export/Import Excel on existing document To test this use case, go to any Sales Order and use Export Excel or Import Excel in action menu. -**Use Case 2:** Import Excel Files +**Example 2:** Import Excel Files To test this use case, go to Settings > Excel Import/Export > Sample Import Sales Order -**Use Case 3:** Create Excel Report +**Example 3:** Create Excel Report To test this use case, go to Settings > Excel Import/Export > Sample Sales Report + +**Example 4:** Printout Excel on existing document, using report action + +To test this use case, go to any Sales Order and click print "Quotation / Order (.xlsx)". + +**Example 5:** Run Partner List Report, using report action + +To test this use case, go to menu Sales > Reporting > Partner List Report diff --git a/excel_import_export_demo/report_action/__init__.py b/excel_import_export_demo/report_action/__init__.py new file mode 100644 index 000000000..d24f25e9e --- /dev/null +++ b/excel_import_export_demo/report_action/__init__.py @@ -0,0 +1,4 @@ +# Copyright 2019 Ecosoft Co., Ltd (http://ecosoft.co.th/) +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html) + +from . import partner_list diff --git a/excel_import_export_demo/report_action/partner_list/__init__.py b/excel_import_export_demo/report_action/partner_list/__init__.py new file mode 100644 index 000000000..3785abc03 --- /dev/null +++ b/excel_import_export_demo/report_action/partner_list/__init__.py @@ -0,0 +1,4 @@ +# Copyright 2019 Ecosoft Co., Ltd (http://ecosoft.co.th/) +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html) + +from . import report_partner_list diff --git a/excel_import_export_demo/report_action/partner_list/partner_list.xlsx b/excel_import_export_demo/report_action/partner_list/partner_list.xlsx new file mode 100644 index 000000000..3f6c11e25 Binary files /dev/null and b/excel_import_export_demo/report_action/partner_list/partner_list.xlsx differ diff --git a/excel_import_export_demo/report_action/partner_list/report.xml b/excel_import_export_demo/report_action/partner_list/report.xml new file mode 100644 index 000000000..71d2286c1 --- /dev/null +++ b/excel_import_export_demo/report_action/partner_list/report.xml @@ -0,0 +1,10 @@ + + + + diff --git a/excel_import_export_demo/report_action/partner_list/report_partner_list.py b/excel_import_export_demo/report_action/partner_list/report_partner_list.py new file mode 100644 index 000000000..ac248ac4d --- /dev/null +++ b/excel_import_export_demo/report_action/partner_list/report_partner_list.py @@ -0,0 +1,37 @@ +# Copyright 2019 Ecosoft Co., Ltd (http://ecosoft.co.th/) +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html) + +from odoo import models, fields, api + + +class ReportPartnerList(models.TransientModel): + _name = 'report.partner.list' + _description = 'Wizard for report.partner.list' + + partner_ids = fields.Many2many( + comodel_name='res.partner', + ) + supplier = fields.Boolean( + default=True, + ) + customer = fields.Boolean( + default=True, + ) + results = fields.Many2many( + 'res.partner', + string='Results', + compute='_compute_results', + help='Use compute fields, so there is nothing store in database', + ) + + @api.multi + def _compute_results(self): + """ On the wizard, result will be computed and added to results line + before export to excel by report_excel action + """ + self.ensure_one() + domain = ['|', ('supplier', '=', self.supplier), + ('customer', '=', self.customer)] + if self.partner_ids: + domain.append(('id', 'in', self.partner_ids.ids)) + self.results = self.env['res.partner'].search(domain, order='id') diff --git a/excel_import_export_demo/report_action/partner_list/report_partner_list.xml b/excel_import_export_demo/report_action/partner_list/report_partner_list.xml new file mode 100644 index 000000000..48720dd99 --- /dev/null +++ b/excel_import_export_demo/report_action/partner_list/report_partner_list.xml @@ -0,0 +1,43 @@ + + + + + partner.list.wizard + report.partner.list + +
+ + + + + + + + + +
+
+
+
+
+ + + Partner List Report + report.partner.list + form + form + new + + + + +
diff --git a/excel_import_export_demo/report_action/partner_list/templates.xml b/excel_import_export_demo/report_action/partner_list/templates.xml new file mode 100644 index 000000000..f716c8f32 --- /dev/null +++ b/excel_import_export_demo/report_action/partner_list/templates.xml @@ -0,0 +1,29 @@ + + + + + report.partner.list + partner_list.xlsx + Partner List Report Template + Sample Partner List Report Template for testing + + { + '__EXPORT__': { + 1: { + 'results': { + 'A4': 'id', + 'B4': 'name${value or ""}#{style=text}', + 'C4': 'phone${value or ""}#{style=text}', + 'D4': 'email${value or ""}#{style=text}', + } + } + }, + } + + + + + + + + diff --git a/excel_import_export_demo/report_action/sale_order/report.xml b/excel_import_export_demo/report_action/sale_order/report.xml new file mode 100644 index 000000000..38301b657 --- /dev/null +++ b/excel_import_export_demo/report_action/sale_order/report.xml @@ -0,0 +1,13 @@ + + + + + + diff --git a/excel_import_export_demo/report_action/sale_order/sale_order_form.xlsx b/excel_import_export_demo/report_action/sale_order/sale_order_form.xlsx new file mode 100644 index 000000000..db9d9431e Binary files /dev/null and b/excel_import_export_demo/report_action/sale_order/sale_order_form.xlsx differ diff --git a/excel_import_export_demo/report_action/sale_order/templates.xml b/excel_import_export_demo/report_action/sale_order/templates.xml new file mode 100644 index 000000000..c46a64a59 --- /dev/null +++ b/excel_import_export_demo/report_action/sale_order/templates.xml @@ -0,0 +1,36 @@ + + + + + sale.order + sale_order_form.xlsx + Sale Order Template + Sample Sales Order Template for testing + + { + '__EXPORT__': { + 'sale_order': { + '_HEAD_': { + 'B2': 'partner_id.display_name${value or ""}#{align=left;style=text}', + 'B3': 'name${value or ""}#{align=left;style=text}', + }, + 'order_line': { + 'A6': 'product_id.display_name${value or ""}#{style=text}', + 'B6': 'name${value or ""}#{style=text}', + 'C6': 'product_uom_qty${value or 0}#{style=number}', + 'D6': 'product_uom.name${value or ""}#{style=text}', + 'E6': 'price_unit${value or 0}#{style=number}', + 'F6': 'tax_id${value and ",".join([x.display_name for x in value]) or ""}', + 'G6': 'price_subtotal${value or 0}#{style=number}@{sum}', + } + } + }, + } + + + + + + + +