How to add table heading and table data in Existing PDF Report in Odoo 13? - report

I want to know how to add table heading and table data in Existing PDF Report using xpath or other method in odoo 13?
Does anyone know the syntax or other method in odoo 13?

It similar to making qweb template for report with slight change.Here i am inheriting stock picking report template and adding another after name of pick operation:
<odoo>
<template id="report_po_inherit" inherit_id="stock.report_picking">
<xpath expr="//h1[#t-field='o.name']" position="before">
<div t-if="o.picking_type_id.code=='incoming'">
<h1>Heading 1 </h1>
</div>
</xpath>
</template>
</odoo>
For more and detailed explanation you can refer to this link

Related

Using tags in DocFX markdown frontmatter / YAML header

I have a DocFX site with a number of pages. I would like to include tags at the top of each page via custom template, and I'd like for authors to be able to add tags in the YAML frontmatter, e.g.:
---
title: My Page Title
tags: tag1;tag2;tag3
---
I would then like to be able to access those tags as some sort of array and process them when generating the HTML output.
I've read the docs here which suggests that I can add a schema.json file somewhere and this will automatically detect items in the schema. What I can't work out is how to access the YAML frontmatter in my template when generating the output.
If I need to write a custom .NET plugin to do this then that isn't an issue, but I believe I should be able to access these properties in the template somehow.
Any guidance at all would be very gratefully-received!
I managed to eventually work this out.
In my custom template I have a conceptual.html.primary.tmpl file which provides access to the frontmatter:
<div id="tags">
{{#tags}}{{tags}}{{/tags}}
</div>
Obviously I now need to process the tags, but I now get HTML produced as expected from my .md files:
<div id="tags">
tag1;tag2;tag3
</div>

inject context and markup into another template

My meteor application has the following basic layout:
<template name="layout">
{{> header}}
{{> yield}}
{{> footer}}
</template>
My header template contains a full-width header:
<template name="header">
<div>
<!--implementation of full-width header-->
<h1>{{pageTitle}}</h1>
<!--insert custom html here, e.g. search input or options (see screenshot)-->
</div>
</template>
Then, I have multiple yield templates, that's where the main content goes.
For each of my yield templates, I want to be able to load custom content "into" my header template:
set the pageTitle attribute, so I have a custom title on every routed page
insert some html content, e.g. to do show some extended options (in this example it's about filtering the result of the query, but basically it's html content)
What's the best way to do this?
For a better understanding I include a screenshot of how the page looks like:
EDIT
I came up with the following. I add another base template to the layout, let's call it headerYield:
<template name="layout">
{{> header}}
{{> headerYield}}
{{> yield}}
{{> footer}}
</template>
All the custom markup would go there, with the disadvantage, that I need 2 custom templates for each view.
This question isn't clear. Is the question how can I include a header template? If so then this would be the answer...
<template name="header">
<div> <!-- abosolute position full div --> </div>
<!-- markup here brah -->
</template>
Now if the question is how can I include a page title? If so then this would be the answer...
Router.route('/user', {
onAfterAction: function() {
document.title = 'page title';
}
});
This assumes you have the iron router package installed. Iron router just controls what template gets rendered when looking at particular pages. For example the route "/user" could be sent to any template that you choose. If you want information on how to install iron Router or what it can do you can see their documentation. It's necessary for meteor applications:
iron router
Update:
After looking at your profile your other questions include iron router so you have used it before. So now I am really confused as to what your question is.

Unable to configure Twitter feed in Drupal site

I have a website in Drupal and I wants same look of twitter widget as in https://www.stanford.edu/ .
There is a module also available in Drupal for Twitter i.e "Drupal feed".
https://www.stanford.edu/ site is mentioned in this module also.
So please help me out so that i can get same look..
Thanks in Advance..
Note : The code i am using is given below.
<a class="twitter-timeline" href="https://twitter.com/tweettestwidget" data-widget-id="603417854055034880" data-chrome="noheader nofooter noborders transparent" data-tweet-limit="1" data-conversation="none">Tweets by #tweettestwidget</a><script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0],p=/^http:/.test(d.location)?'http':'https';if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src=p+"://platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");</script>
I used the Twitter module to create a similar twitter feed.
https://www.drupal.org/project/twitter
You can see the feed I created here http://gekkos.com
You can then display the Twitter feed using a View. Then use Views templates to style the output.
E.g. My Views template file was views-view-fields-tweets--block.tpl.php
<div class="tweet">
<p><a target="_blank" href="https://twitter.com/<?php print $fields['screen_name']->content;?>"><?php print $fields['screen_name']->content;?></a> <?php print $fields['text']->content;?> - <em><?php print $fields['created_time']->content;?></em></p>
Then just style the output using CSS.

Looping component links in an Embedded field

We have a "component A" , which has a multivalue field of type 'embedded field'.
The embedded field in turn has a multivalue field of type 'Component Link'.
This looks like:
Component A -> Embedded Shcema Fields -> Component Links
How to iterate and access the fields of 'Component Links'in dreamweaver?
Also the component field supports three different schemas and We want to check on these schema names in dreamweaver.
I found this post useful. But more details would be indeed great.
Have a look at these questions:
How to handle nested repeating regions in Dreamweaver TBBs in SDL Tridion 2011 SP1
Retrieving values of a linked component in Dreamweaver TBB - and making it SiteEditable
And this page from the Tridion practice cookbook:
http://code.google.com/p/tridion-practice/wiki/IteratingOverMultivalueEmbeddedFields
They cover the most common problems you may have with accessing fields in a DWT.
If these don't answer your question, update your question with:
the relevant XML fragment of your Component
the DWT fragment showing what you already tried
You can easily iterate through component link of multi value embedded field but there is no direct way to get component link values, you have to use either dwt extension, or .net tbb. There are some available on sdltridionworld.com.
I did this earlier with nested template. You may also try nested/sub template from your main dwt tbb based on schema of component link field component in the loop.
Also I would suggest to use razor templates.
You can iterate through the multi-value field paragraph in the embedded schema field paragraphs as follows:
<!-- TemplateBeginRepeat name="Component.Fields.paragraphs" -->
<h2>##Field.header## (##TemplateRepeatIndex##)</h2>
<!-- TemplateBeginRepeat name="Field.paragraph" -->
<p>##Field##</p>
<!-- TemplateEndRepeat -->
<!-- TemplateEndRepeat -->
As Vikas previously mentioned, repeating over the multivalued component link field of a multivalued embedded schema field is relatively simple. Your DWT code should follow this form:
<!-- TemplateBeginRepeat name="XML Name of Embedded Schema Fields" -->
<!-- TemplateBeginRepeat name="XML Name of multivalued Component Link field" -->
##Field## - Should write out the TCM ID of your linked component
<!-- TemplateEndRepeat -->
<!-- TemplateEndRepeat -->
You can not, however, access the fields or schema details of these components with "out of the box" Dreamweaver Templates.
You can:
install the Dreamweaver Get eXtension on your Content Manager server, which will allow you to retrieve fields of linked components (amongst other things) using the ##Get(...)## syntax
Use the "Get Linked Components" .Net TBB from the Generic SDL Tridion 2011 Template Building Blocks before your Dreamweaver Template, which will place the linked components into the templating package so that you can iterate over them directly
Write your own .Net TBB to handle your specific business logic related to these links and output html (not recommended) or a named package item, items or array of items that you can handle from your DWT.
Call another (nested) component template from your DWT with ##RenderComponentPresentation(Field, "tcm:x-xx-32")##
Any combination of the above
Please try using below code:
<!-- TemplateBeginRepeat name="paragraphs" -->
<!-- TemplateBeginRepeat name="Internal_Link" -->
<!-- TemplateBeginIf cond = "Internal_Link != ''" -->
<p> ##Component.ID## </p>
<!-- TemplateEndIf -->
<!-- TemplateEndRepeat -->
<!-- TemplateEndRepeat -->
To check for zeroth component you can use below code:
<!-- TemplateBeginRepeat name="paragraphs0.Internal_Link" -->

Views is stripping tags from the output

I have a Drupal view which should output a video player using flash. I am trying to output a script that will call the flash film. The problem is that Views applies some sort of filter that strips my <script> tags, the opening and the closing one. I am searching a solution (some setting in views that will disable that filter), but cannot seem to find an answer. Other HTML tags work, but it seems the script tag is being stripped, probably for some security reason.
I have selected the option to rewrite the output of the field and I am using the tags correctly
Views also strips style attributes from my tags. For example:
<h3 style="border-bottom: solid 1px #ffcc99;">Some text here</h3>
appears like this:
<h3>Some text here</h3>
Is there a solution for this? Thank you.
Begin edited
I am pasting below the code I am using in my view.
<div class="bloco-filme">
[title]
<div class="field-imagem">
[field_imagem_fid]
<script type='text/javascript' src='sites/default/files/js/swfobject.js'></script>
<div id='mediaspace[nid]'>Se você estiver visualizando esta mensagem, significa o Flash Player não está instalado em sua máquina. Para assistir ao vídeo é preciso instalar o Flash player</div>
<script type='text/javascript'>
var so = new SWFObject('sites/default/files/plugins/jqplayer/player.swf','mpl','205','undefined','9');
so.addParam('allowfullscreen','true');
so.addParam('allowscriptaccess','always');
so.addParam('wmode','transparent');
so.addVariable('file','[field_video_fid]');
so.addVariable('quality','false');
so.write('mediaspace[nid]');
</script>
[field_video_fid]
</div>
<div class="field-resumo">
<p>[body]</p>
</div>
</div>
Edited again
The code above is beinng posted in my view. I have created a view to handle this. This is the FIELDS area of my view:
Fields
Node: Nid
Node: Título (title, it is in pt-br)
Node: Link "editar" (edit)
Node: Link "apagar" (delete)
Conteúdo: Imagem thumbnail image
Conteúdo: Video URL do arquivo (video file URL)
Node: Corpo (Body)
I have disabled the display of all the fields above and have packed all the code in the Body field. There I selected the option that I want to rewrite the output of the field.
kiamlaluno identified the basic problem, but to solve it, you're going to have to use a field template which will avoid using the filtering system Views uses. Group 42 has a great guide to walk you through the basics of Views theming, so I'll just gloss over those details and talk about your specific case.
First, you need to identify which field you want to rewrite: I believe you're doing that using the Field configuration, but it's not clear which field you are rewriting. I'm going to assume it's the body field. Go through Group 42's guide to create a new template file for the body field in your theme.
In the new template file, use the following code:
<div class="bloco-filme">
<?php print $view->field['title']->render($row) ?>
<div class="field-imagem">
<?php print $view->field['field_imagem_fid']->render($row) ?>
<script type='text/javascript' src='sites/default/files/js/swfobject.js'></script>
<div id="mediaspace<?php print $view->field['nid']->render($row) ?>">Se você estiver visualizando esta mensagem, significa o Flash Player não está instalado em sua máquina. Para assistir ao vídeo é preciso instalar o Flash player</div>
<script type='text/javascript'>
var so = new SWFObject('sites/default/files/plugins/jqplayer/player.swf','mpl','205','undefined','9');
so.addParam('allowfullscreen','true');
so.addParam('allowscriptaccess','always');
so.addParam('wmode','transparent');
so.addVariable('file','<?php print $view->field["field_video_fid"]->render($row) ?>');
so.addVariable('quality','false');
so.write('mediaspace<?php print $view->field["nid"]->render($row) ?>');
</script>
<?php print $view->field['field_video_fid']->render($row) ?>
</div>
<div class="field-resumo">
<p><?php print $output ?></p>
</div>
</div>
Save your new template file, and now the body field will be replaced with the correct output. Just make sure all the fields you've referenced in the template are before the body field within the Fields list when you edit the View.
You can see that this is mostly HTML with a few PHP bits. Code like this:
<?php print $view->field['title']->render($row) ?>
outputs the contents of a field other than current one (i.e. you use this code when you want to reference fields other than Body). It references the same row and finds the value of the field.
And code like this:
<?php print $output ?>
Outputs the value of the current field, in this case, Body.
I don't think the view is causing the issue. kiamlaluno is quite correct that the input format will strip a lot out of your code, unless you alter the input format, however I'm not sure you'll actually be able to achieve what you are trying to do using the body field in any sort of graceful way.
Use views to output the content you need from each node type, but I never use views to determine how this will be displayed (apart from ordering fields etc). I tend to do this either using the display fields option (/admin/content/node-type/[your-node-type]/display) or in the theme. In other words I theme the node (content type) or the field itself.
I would consider looking here - http://drupal.org/node/206980 - to see how to theme individual fields. use the field_ (field name prefix) at the start of a copy of the content-field.tpl.php in your theme folder (you'll find it in the theme folder of your cck folder), and use this to theme the field the way you want it to be presented (using your code above). So, when the view picks it up to display it, it will theme it using your code above.
This, of course, has the added advantage that you don't need to add in any code to the body element of the page, which is not a scalable way to do this at all.
Alternatively, you could write a small module which uses hook_field() (link 1, link 2) to rewrite the field display, but unless you want to be able to customize any of this in the admin area of the site, your best option is probably to theme the field itself as above.
I had nearly exactly this issue (thanks for posting it!), but a few things have changed (obviously) in the three years since this post.
In my case, using Views 3 and D7, I was able to paste all of the relevant swfobject code into a Header or Footer of my view, making sure to use the Text Area type with Full HTML as the text input filter.
No editing of the template.php was necessary. I even used token replacement to provide contextual filter arguments to my movie's flashvars.

Resources