19 changed files with 259 additions and 226 deletions
			
			
		| @ -1,44 +0,0 @@ | |||||
| <?xml version="1.0"?> |  | ||||
| <odoo> |  | ||||
| 
 |  | ||||
|     <template id="report_mrp_order"> |  | ||||
|     <t t-call="web.html_container"> |  | ||||
|         <t t-call="web.external_layout"> |  | ||||
|             <div class="page"> |  | ||||
|                 <h1><strong>MRP Order Report</strong></h1> |  | ||||
|                 <t t-if="date_from"><p><strong>Date From : </strong> |  | ||||
|                         <t t-esc="date_from"/></p></t> |  | ||||
|                 <t t-if="stage"><p><strong>State : </strong> |  | ||||
|                         <t t-esc="stage"/></p></t> |  | ||||
|                 <table class="table table-sm table-striped mt-4"> |  | ||||
|                     <thead> |  | ||||
|                         <tr> |  | ||||
|                             <th>Reference</th> |  | ||||
|                             <th>Image</th> |  | ||||
|                             <th>Product</th> |  | ||||
|                             <th>Quantity</th> |  | ||||
|                             <th>Unit</th> |  | ||||
|                             <th>Responsible</th> |  | ||||
|                             <th>Start Date</th> |  | ||||
|                             <th>State</th> |  | ||||
|                         </tr> |  | ||||
|                     </thead> |  | ||||
|                     <tbody> |  | ||||
|                         <tr t-foreach="mrp" t-as="rec"> |  | ||||
|                             <td><t t-esc="rec['name']"/></td> |  | ||||
|                             <td> <img t-attf-src="data:image/png;base64,{{rec['image']}}" style="width:70%;" margin="right"/></td> |  | ||||
|                             <td><t t-esc="rec['product']"/></td> |  | ||||
|                             <td><t t-esc="rec['quantity']"/></td> |  | ||||
|                             <td><t t-esc="rec['unit']"/></td> |  | ||||
|                             <td><t t-esc="rec['responsible']"/></td> |  | ||||
|                             <td><t t-esc="rec['start_date']"/></td> |  | ||||
|                             <td><t t-esc="rec['state']"/></td> |  | ||||
|                         </tr> |  | ||||
|                     </tbody> |  | ||||
|                 </table> |  | ||||
|             </div> |  | ||||
|         </t> |  | ||||
|     </t> |  | ||||
|     </template> |  | ||||
| 
 |  | ||||
| </odoo> |  | ||||
| @ -0,0 +1,70 @@ | |||||
|  | <?xml version="1.0"?> | ||||
|  | <odoo> | ||||
|  | <!--    Template for the manufacturing report.--> | ||||
|  |     <template id="report_mrp_order"> | ||||
|  |         <t t-call="web.html_container"> | ||||
|  |             <t t-call="web.external_layout"> | ||||
|  |                 <div class="page"> | ||||
|  |                     <h1> | ||||
|  |                         <strong>MRP Order Report</strong> | ||||
|  |                     </h1> | ||||
|  |                     <t t-if="date_from"> | ||||
|  |                         <p> | ||||
|  |                             <strong>Date From :</strong> | ||||
|  |                             <t t-esc="date_from"/> | ||||
|  |                         </p> | ||||
|  |                     </t> | ||||
|  |                     <t t-if="stage"> | ||||
|  |                         <p> | ||||
|  |                             <strong>State :</strong> | ||||
|  |                             <t t-esc="stage"/> | ||||
|  |                         </p> | ||||
|  |                     </t> | ||||
|  |                     <table class="table table-sm table-striped mt-4"> | ||||
|  |                         <thead> | ||||
|  |                             <tr> | ||||
|  |                                 <th>Reference</th> | ||||
|  |                                 <th>Image</th> | ||||
|  |                                 <th>Product</th> | ||||
|  |                                 <th>Quantity</th> | ||||
|  |                                 <th>Unit</th> | ||||
|  |                                 <th>Responsible</th> | ||||
|  |                                 <th>Start Date</th> | ||||
|  |                                 <th>State</th> | ||||
|  |                             </tr> | ||||
|  |                         </thead> | ||||
|  |                         <tbody> | ||||
|  |                             <tr t-foreach="mrp" t-as="rec"> | ||||
|  |                                 <td> | ||||
|  |                                     <t t-esc="rec['name']"/> | ||||
|  |                                 </td> | ||||
|  |                                 <td> | ||||
|  |                                     <img t-attf-src="data:image/png;base64,{{rec['image']}}" | ||||
|  |                                          style="width:70%;" margin="right"/> | ||||
|  |                                 </td> | ||||
|  |                                 <td> | ||||
|  |                                     <t t-esc="rec['product']"/> | ||||
|  |                                 </td> | ||||
|  |                                 <td> | ||||
|  |                                     <t t-esc="rec['quantity']"/> | ||||
|  |                                 </td> | ||||
|  |                                 <td> | ||||
|  |                                     <t t-esc="rec['unit']"/> | ||||
|  |                                 </td> | ||||
|  |                                 <td> | ||||
|  |                                     <t t-esc="rec['responsible']"/> | ||||
|  |                                 </td> | ||||
|  |                                 <td> | ||||
|  |                                     <t t-esc="rec['start_date']"/> | ||||
|  |                                 </td> | ||||
|  |                                 <td> | ||||
|  |                                     <t t-esc="rec['state']"/> | ||||
|  |                                 </td> | ||||
|  |                             </tr> | ||||
|  |                         </tbody> | ||||
|  |                     </table> | ||||
|  |                 </div> | ||||
|  |             </t> | ||||
|  |         </t> | ||||
|  |     </template> | ||||
|  | </odoo> | ||||
| 
 | 
| Before Width: | Height: | Size: 114 KiB After Width: | Height: | Size: 78 KiB | 
| Before Width: | Height: | Size: 97 KiB After Width: | Height: | Size: 65 KiB | 
| @ -1,31 +1,23 @@ | |||||
| odoo.define('manufacturing_reports  .action_manager', function (require) { | /** @odoo-module */ | ||||
| "use strict"; | import { registry } from "@web/core/registry"; | ||||
|  | import { download } from "@web/core/network/download"; | ||||
|  | import framework from 'web.framework'; | ||||
|  | import session from 'web.session'; | ||||
| /** | /** | ||||
|  * The purpose of this file is to add the actions of type |  * @override | ||||
|  * 'ir_actions_xlsx_download' to the ActionManager. |  * Add 'xlsx' report type to the report handler | ||||
|  */ |  */ | ||||
| var ActionManager = require('web.ActionManager'); | registry.category("ir.actions.report handlers").add("xlsx", async (action) => { | ||||
| var framework = require('web.framework'); |    if (action.report_type === 'xlsx') { | ||||
| var session = require('web.session'); |        framework.blockUI(); | ||||
| ActionManager.include({ |        var def = $.Deferred(); | ||||
|     _executexlsxReportDownloadAction: function (action) { |        session.get_file({ | ||||
|         framework.blockUI(); |            url: '/xlsx_reports', | ||||
|         var def = $.Deferred(); |            data: action.data, | ||||
|         session.get_file({ |            success: def.resolve.bind(def), | ||||
|             url: '/xlsx_reports', |            error: (error) => this.call('crash_manager', 'rpc_error', error), | ||||
|             data: action.data, |            complete: framework.unblockUI, | ||||
|             success: def.resolve.bind(def), |        }); | ||||
|             error: (error) => this.call('crash_manager', 'rpc_error', error), |        return def; | ||||
|             complete: framework.unblockUI, |    } | ||||
|         }); | }); | ||||
|         return def; |  | ||||
|     }, |  | ||||
|     _handleAction: function (action, options) { |  | ||||
|         if (action.report_type === 'xlsx') { |  | ||||
|             return this._executexlsxReportDownloadAction(action, options); |  | ||||
|         } |  | ||||
|         return this._super.apply(this, arguments); |  | ||||
| 
 |  | ||||
| }, |  | ||||
|     }); |  | ||||
|   }); |  | ||||
| @ -0,0 +1,10 @@ | |||||
|  | <?xml version="1.0" encoding="utf-8" ?> | ||||
|  | <odoo> | ||||
|  | <!--    Menu for manufacturing report--> | ||||
|  |     <menuitem id="menu_mrp_reports" | ||||
|  |               parent="mrp.menu_mrp_reporting" | ||||
|  |               name="Manufacturing Reports" | ||||
|  |               action="manufacturing_reports.mrp_report_action" | ||||
|  |               sequence="5"/> | ||||
|  | 
 | ||||
|  | </odoo> | ||||
| @ -1,9 +0,0 @@ | |||||
| <?xml version="1.0" encoding="utf-8" ?> |  | ||||
| <odoo> |  | ||||
|     <data> |  | ||||
| 
 |  | ||||
|         <menuitem id="menu_mrp_reports" parent="mrp.menu_mrp_reporting" name="Manufacturing Reports" |  | ||||
|                   action="mrp_wizard_action" sequence="5"/> |  | ||||
| 
 |  | ||||
|     </data> |  | ||||
| </odoo> |  | ||||
					Loading…
					
					
				
		Reference in new issue