Skip to Content
Menu
This question has been flagged
3 Replies
3718 Views

I have this code that prints a summary of an inputted list. but currently it just lists all the items but in a simplified manner. See below table and code.


Store Type
Region
Branch
Job Position
Head count
Work Days
Work hours
Supermarket
Bicol Region
1
Merchandiser
1
26

SupermarketBicol Region
1
Merchandiser
1
26

Supermarket
Eastern Visayas
1
Merchandiser
1
26

Supermarket
Eastern Visayas
1
Merchandiser
1
26


Total
4
0
4
104

<?xml version="1.0"?>
<t 
t-name="manpower_sales_customization.deployment_schedule_summary_report">
			<t t-call="report.html_container">
				<div class="page">
					<style>
						.border {
						border:1px solid black;
						border-collapse:collapse;
						}

						.padding {
						padding-top:5px;
						padding-bottom:5px;
						padding-left:5px;
						padding-right:5px;
						font-size: 13;
						}
                    </style>
					<div class="text-center">
						<h4>Deployment Summary</h4>
					</div>
					<table width="100%" class="border padding">
						<tr class="text-center">
							<th class="border padding text-center" width="20%">
								<span>Store Type</span>
							</th>
							<th class="border padding text-center" width="30">
								<span>Region</span>
							</th>
							<th class="border padding text-center" width="5%">
								<span>Branch</span>
							</th>
							<th class="border padding text-center" width="20%">
								<span>Job Position</span>
							</th>
							<th class="border padding text-center" width="5%">
								<span>Head count</span>
							</th>
							<th class="border padding text-center" width="5%">
								<span>Work days</span>
							</th>
							<th class="border padding text-center" width="15%">
								<span>Work Hours</span>
							</th>
						</tr>
						<t t-set="work_hrs" t-value="0"/>
						<t t-foreach="get_data(docs)" t-as="line">
                            <t t-if="position != 
line.get('position_id')">
                                <tr>
                                    <th colspan="7" 
style="text-align: left;font-size: 12px;font-family: 'Ubuntu'" 
class="border padding">
                                        <span 
t-esc="line.get('position_id')"/>
                                    </th>
                                </tr>
                            </t>
                            <t t-set="position" 
t-value="line.get('position_id')"/>
							<tr>
								<td class="border padding text-left">
									<span t-esc="line.get('store_type_ids')"/>
								</td>
								<td class="border padding text-left">
									<span t-esc="line.get('region_id')"/>
								</td>
								<td class="border padding text-right">
									<span t-esc="formatLang(line.get('branch_total'), digits=2) 
or '0.0'"/>
								</td>
								<td class="border padding text-left">
									<span t-esc="line.get('position_id')"/>
								</td>
								<td class="border padding text-right">
									<span t-esc="formatLang(line.get('no_count'), digits=2) or 
'0.0'"/>
								</td>
								<td class="border padding text-right">
									<span t-esc="formatLang(line.get('no_days'), digits=2) or 
'0.0'"/>
								</td>
								<td class="border padding text-right">
									<span t-esc="line.get('work_hrs')"/>
									<span t-set="work_hrs" t-value="work_hrs + 
line.get('work_hrs')"/>
								</td>
							</tr>
						</t>
						<tr class="border">
							<td class="border padding text-right" width="20" 
colspan="2">
								<b>Total :</b>
							</td>
							<td class="border padding text-right" width="10%">
								<b>
									<span t-esc="formatLang(count_branch())"/>
								</b>
							</td>
							<td class="border padding text-right" width="20%">
								<span/>
							</td>
							<td class="border padding text-right" width="10%">
								<b>
									<span t-esc="formatLang(count_no())"/>
								</b>
							</td>
							<td class="border padding text-right" width="10%">
								<b>
									<span t-esc="formatLang(count_no_days())"/>
								</b>
							</td>
							<td class="border padding text-right" width="10%">
								<b><span t-esc="formatLang(work_hrs, digits=2) or 
'0.00'"/></b>
							</td>
						</tr>
					</table>
				</div>
			</t>
		
What I wanted is a real summary and not a totaled list. Such as below. Appreciate the help.

 

Store type
Region
Branch
job Position
Head count
Work days
Work hours
Supermarket
Bicol
2
Merchandiser
2
52

Supermarket
Eastern Visayas
2
Merchandiser
2
52


Total
4

4
104


Avatar
Discard

Hi Bautista,

This is not the way to add the code in the question , currently the code is not easily readable.

Niyas,

This is noted with thanks.

Regards,

Franz Bautista, CEH
NABI Computer Systems
Tel     : 632-515-2084
Fax    : 632-854-2643
skype/ym id: nabicom



On Wed, Jun 21, 2017 at 3:38 PM, Niyas Raphy <niyasraphyk@gmail.com> wrote:

Hi Bautista,

This is not the way to add the code in the question , currently the code is not easily readable.

--
Niyas Raphy


Sent by Odoo S.A. using Odoo.


just edited the post

Author Best Answer

Apologies. Here is the code again.


<?xml version="1.0"?>
<t t-name="manpower_sales_customization.deployment_schedule_summary_report">
			<t t-call="report.html_container">
				<div class="page">
					<style>
						.border {
						border:1px solid black;
						border-collapse:collapse;
						}

						.padding {
						padding-top:5px;
						padding-bottom:5px;
						padding-left:5px;
						padding-right:5px;
						font-size: 13;
						}
                    </style>
					<div class="text-center">
						<h4>Deployment Summary</h4>
					</div>
					<table width="100%" class="border padding">
						<tr class="text-center">
							<th class="border padding text-center" width="20%">
								<span>Store Type</span>
							</th>
							<th class="border padding text-center" width="30">
								<span>Region</span>
							</th>
							<th class="border padding text-center" width="5%">
								<span>Branch</span>
							</th>
							<th class="border padding text-center" width="20%">
								<span>Job Position</span>
							</th>
							<th class="border padding text-center" width="5%">
								<span>Head count</span>
							</th>
							<th class="border padding text-center" width="5%">
								<span>Work days</span>
							</th>
							<th class="border padding text-center" width="15%">
								<span>Work Hours</span>
							</th>
						</tr>
						<t t-set="work_hrs" t-value="0"/>
						<t t-foreach="get_data(docs)" t-as="line">
                            <t t-if="position != line.get('position_id')">
                                <tr>
                                    <th colspan="7" style="text-align: left;font-size: 12px;font-family: 'Ubuntu'" class="border padding">
                                        <span t-esc="line.get('position_id')"/>
                                    </th>
                                </tr>
                            </t>
                            <t t-set="position" t-value="line.get('position_id')"/>
							<tr>
								<td class="border padding text-left">
									<span t-esc="line.get('store_type_ids')"/>
								</td>
								<td class="border padding text-left">
									<span t-esc="line.get('region_id')"/>
								</td>
								<td class="border padding text-right">
									<span t-esc="formatLang(line.get('branch_total'), digits=2) or '0.0'"/>
								</td>
								<td class="border padding text-left">
									<span t-esc="line.get('position_id')"/>
								</td>
								<td class="border padding text-right">
									<span t-esc="formatLang(line.get('no_count'), digits=2) or '0.0'"/>
								</td>
								<td class="border padding text-right">
									<span t-esc="formatLang(line.get('no_days'), digits=2) or '0.0'"/>
								</td>
								<td class="border padding text-right">
									<span t-esc="line.get('work_hrs')"/>
									<span t-set="work_hrs" t-value="work_hrs + line.get('work_hrs')"/>
								</td>
							</tr>
						</t>
						<tr class="border">
							<td class="border padding text-right" width="20" colspan="2">
								<b>Total :</b>
							</td>
							<td class="border padding text-right" width="10%">
								<b>
									<span t-esc="formatLang(count_branch())"/>
								</b>
							</td>
							<td class="border padding text-right" width="20%">
								<span/>
							</td>
							<td class="border padding text-right" width="10%">
								<b>
									<span t-esc="formatLang(count_no())"/>
								</b>
							</td>
							<td class="border padding text-right" width="10%">
								<b>
									<span t-esc="formatLang(count_no_days())"/>
								</b>
							</td>
							<td class="border padding text-right" width="10%">
								<b><span t-esc="formatLang(work_hrs, digits=2) or '0.00'"/></b>
							</td>
						</tr>
					</table>
				</div>
			</t>
		
Avatar
Discard
Related Posts Replies Views Activity
1
Jun 16
2746
1
Mar 15
4951
2
Sep 24
255
0
Jun 24
411
4
May 23
8703