Pagenumber format in rml reports in Openerp6.0 - report

In rml reports how can i change the current page number format from page:1 ,page:2 etc to something different. For eg:
page:1/2 in the first page and
page:2/2 in the second page...
how can i do this ? i am using openerp6.0
currently i use the following code in the company page in the openerp interface to get the page number.
<drawCentredString x="18.5cm" y="1.5cm"> Page: <pageNumber/></drawCentredString>

This works for my OpenERP version 6.1.1
Changes was done in my Ubuntu server at:
/opt/openerp/server/openerp/report/render/rml2pdf/trml2pdf.py
Then restart openerp-server with following command:
sudo service openerp-server restart

my problem got solved just applied the below patch.
# HG changeset patch
# Parent 3fda5d5bbae001d42c56b5281e56fb2be0c8aa58
[FIX] use real page count for <pageCount/> flowable
diff --git a/bin/report/render/rml2pdf/trml2pdf.py b/bin/report/render/rml2pdf/trml2pdf.py
--- a/bin/report/render/rml2pdf/trml2pdf.py
+++ b/bin/report/render/rml2pdf/trml2pdf.py
## -118,7 +118,7 ##
def draw(self):
self.canv.beginForm("pageCount")
self.canv.setFont("Helvetica", utils.unit_get(str(8)))
- self.canv.drawString(0, 0, str(self.canv.getPageNumber()))
+ self.canv.drawString(0, 0, str(self.canv._pageCount))
self.canv.endForm()
class PageReset(platypus.Flowable):

Related

iTerm2 now starts up listing profile configuration

Recently, when I load iTerm2 on my mac, it lists out the configuration of my profile (or possibly its something different).
This is what I see:
Last login: Tue Jun 21 19:54:38 on ttys000COLORFGBG='15;0'
COLORTERM=truecolor
COMMAND_MODE=unix2003
HOME=/Users/me
ITERM_PROFILE=Default
ITERM_SESSION_ID=w0t0p0:FD9764B1-4535-4FE2-932A-97AFD9D6C804
LANG=en_GB.UTF-8
LC_TERMINAL=iTerm2
LC_TERMINAL_VERSION=3.4.15
LOGNAME=me
OLDPWD=/Users/me
PATH=/usr/bin:/bin:/usr/sbin:/sbin
PWD=/Users/me
SHELL=/bin/zsh
SHLVL=1
SSH_AUTH_SOCK=/private/tmp/com.apple.launchd.u21pRFo1wk/Listeners
TERM=xterm
TERM_PROGRAM=iTerm.app
TERM_PROGRAM_VERSION=3.4.15
TERM_SESSION_ID=w0t0p0:FD9764B1-4535-4FE2-932A-97AFD9D6C804
TMPDIR=/var/folders/dz/wvb1lxq56wg_wk3ppwqw4mdc0000gn/T/
USER=me
XPC_FLAGS=0x0
XPC_SERVICE_NAME=0
__CFBundleIdentifier=com.googlecode.iterm2
__CF_USER_TEXT_ENCODING=0x0:0:0
me#my-iMac ~ %
I don't really like this behaviour. I can't find where that has been set to happen. I can't see anything in .zshenv, .zshrc, .bashrc and can't see where in iTerm such a thing might be triggered. I've tried creating a new profile, but that also results in the same output.
Any other suggestions to how I can get back to the way it was a few weeks back where it just told me the last time I logged in?
If you add set -x to ~/.zshenv, the shell will print every line it runs with file names and line numbers. You can then find the offending command and remove or fix it. My best guess would be a call to export without any arguments: something like export $foo, where $foo is empty?

How to change the footer in DocFX?

Just hope to change the footer copyright info, generated by DocFX.
Here is what I have done:
Export template:
Run docfx template export default, get a folder _exported_templates\default
Change the footer partials:
The files I have changed are .\partials_footer.liquid and .\partials\footer.tmpl.partial
Use the updated template:
Run docfx -t _exported_templates\default.
Serve the site again
Run docfx docfx.json --serve.
But the update is not shown when I refresh the documentation page. Is there anything else I have missed?
Try merge step 3, 4 into: docfx -t _exported_templates\default --serve.
Explanation: If you open the build output in _site after step 3, you should find the footer is actually updated. In step 4, DocFX builds the site again before serving, so finally you find the original footer because this build doesn't use your customized template.
Another quick solution is to add _appFooter to global metadata in docfx.json like:
"globalMetadata": {
"_appFooter": "<span>Customized Footer</span>"
},
Full reserved metadata list can be found here: http://dotnet.github.io/docfx/tutorial/docfx.exe_user_manual.html#322-reserved-metadata
The easiest way to do this is to change the model directly. In your template, create a file called conceptual.extension.js and use the following code:
exports.postTransform = function (model) {
model._appFooter = "<span>Copyright © 2015-2017 MY COPYRIGHT<br>Generated by <strong>DocFX</strong></span>";
return model;
}

Avoid creation of Plone's default content

I'm working in a project that creates a Plone 4.3 site that installs plone.app.contenttypes as it's default content types. After site creation I see all default content (the front page and some folders and collections) that are still Archetypes-based content.
I want to avoid the creation of that content and I want to know if there's a better way of getting rid of it that manually erasing it in a post install step.
I need an empty site by default.
You need to setup the Plone Site the following way:
from Products.CMFPlone.factory import addPloneSite
from Products.CMFPlone.factory import _DEFAULT_PROFILE
default_profiles =('plonetheme.classic:default', 'plonetheme.sunburst:default')
return addPloneSite(
app,
site_id,
title=title,
profile_id=_DEFAULT_PROFILE,
extension_ids=default_profiles,
setup_content=False,
default_language='en')
The important part is setup_content=False.
There's no initial content, no portlet... nothing.
You may check this full working example in ftw.inflator -> https://github.com/4teamwork/ftw.inflator/blob/00b8b984e7dc1052a7fb94d2e82455a66b271da7/ftw/inflator/bundle.py#L23
There are a couple of ways of patching Plone to achieve this behavior by default.
One is by using z3c.jbot to override the following template:
Products/CMFPlone/browser/templates/plone-addsite.pt
The other is by using collective.recipe.patch in your Buildout configuration like this:
parts += patches
...
[patches]
recipe = collective.recipe.patch
egg = Products.CMFPlone==4.3.10
patches = ${buildout:directory}/patches/setup-content-false.patch
the content of the patch file is this (I would love to know how to get this without having to edit the output of the git diff command):
diff --git Products/CMFPlone/browser/templates/plone-addsite.pt Products/CMFPlone/browser/templates/plone-addsite.pt
index bc83eb0..3aebbfe 100644
--- Products/CMFPlone/browser/templates/plone-addsite.pt
+++ Products/CMFPlone/browser/templates/plone-addsite.pt
## -99,7 +99,7 ##
</span>
</div>
<tal:content tal:condition="not:advanced">
- <input type="hidden" name="setup_content:boolean" value="true" />
+ <input type="hidden" name="setup_content:boolean" />
</tal:content>
<tal:baseprofile condition="python: len(base_profiles) > 1">

how to run arc diff in a script, without prompting for a message

Phabricator's arcanist command line tool allows you to add a "diff" for revision. This is useful because you can quickly generate a diff which your colleagues can review.
Normally, running arc diff master, for example, will prompt your for a diff message, a test plan, and some other information, and then create a diff on Phabricator.
However, I would like to run arc diff from a continuous integration server, therefore assuming yes to all questions and passing the message and test plan as an argument to the command. What I have now is:
arc diff master --allow-untracked
Still, it is assuming that it is being called from a human user, and asking for a message, which fails when called from a continuous integration server. How can skip the prompts?
I think what you are looking for is the --verbatim option.
Considering the changes are committed so that it has a commit message you can run a command like:
arc diff --verbatim --reviewers xxxx --uncommitted --allow-untracked
This implies you set the Test plan to optional, else you have to specify it as well.
Finally you can also read revision info from a file using --message-file.
Another approach would be:
Create a Diff (but not a rev) with arc diff --raw-command "git diff origin/master"
Read the result to get the diff Id
Use the createrevision conduit call as described here to create the revision:
https://secure.phabricator.com/conduit/method/differential.createrevision/
the best practice is:
You can prepare a template file like this. This file can be named msg.conf
${title}
Summary:
${summary_content}
修订人:
${reviewers}
订阅者:
RBA-DEV
Test Plan:
${test_plan}
and then you can generate some content you need to fill this template and then.
you can rum this command:
arc diff --create --allow-untracked --skip-binaries --message-file msg.conf origin/master

In Notepad++, how can I insert the current date and time?

On Windows Notepad.exe, I simply press F5 and it inserts the date and time like this:
11:05 AM 1/14/2015
Can I add similarly simple functionality to Notepad++?
If your Notepad++ shipped with TextFX, you can find this in TextFX > TextFX Insert > Date & Time - short format, which will insert a string in the exact same format. If you don't see a TextFX menu, install it via the plugin manager and it will appear.
You can then bind it to a keyboard shortcut in Settings > Shortcut Mapper... > Plugin Commands. Look for I:Date & Time - short format in the mappings.
Step 1 : Install plugin TextFX
Step 2 : Insert Date & time
Try "Python Script" plugin
I prefer to use the Python Script plugin as documented here: https://ardamis.com/2014/03/09/adding-an-insert-datestamp-or-timestamp-macro-to-notepad-plus-plus/
because it gives me total control over how I want to the datetime stamp formatting to look, and it also allows me to create macro scripts for inserting other types of values that I want to compute.
Install "Python Script" MANUALLY
Please note that you must download the Python Script plugin from http://npppythonscript.sourceforge.net/download.shtml because downloading it from the Plugin Manager in Notepad++ doesn't always work. (See this thread for details.)
Write "Time.py" script
Then you can write a simple script like this:
import time
# import sys
timeStr = time.strftime( '%Y-%m-%d' + ' # ' + '%I:%M %p' )
# sys.stdout.write(timeStr)
editor.addText( timeStr )
You can change the format string as you wish. This allows you to have total control over the text output. (See Python 2's time.strftime documentation for details.)
Then save the script to this filename:
"%AppData%\Notepad++\plugins\Config\PythonScript\scripts\Time.py"
Create "menu item" inside "Python Script"
Navigate here: Menu bar -> Plugins -> Python Script -> Configuration like this:
Then you can add the script like this:
Assign hotkey
Then, when you restart Notepad++, you can assign the script to a shortcut like this by going to Menu bar -> Settings -> Shortcut Mapper -> Plugin Commands -> Time:
Further reading
More documentation on the Python Script plugin is available here: PythonScript plugin documentation for Notepad++
This features has been added in Notepad++ v8.1.4.
Menu > Edit > Insert >
Date Time (short)
Date Time (long)
That answers this question without the need for a plugin.
Can you find a way to map it to a shortcut? Currently, the shortcut mapper does not have an entry to map it to. When I try to record and playback a macro for it, I get gibberish on the screen (looks like a bug).
It looks like the TextFX plugin proposed here is not available for 64bit any more.
The alternative as of today is to install the Notepad++ Plugin Demo plugin, which provides Date Time - short format and Date Time - long format. Map to shortcuts as desired. In my German locale, the results are, respectively:
12:10 01.07.2020
12:10 Mittwoch, 1. Juli 2020
With the TextFx add on there's an option to insert date and time. I guess you can assign a keyboard shortcut to it.
A simple method through LuaScript (https://github.com/notepad-plus-plus/notepad-plus-plus/issues/497 and https://www.lua.org/pil/22.1.html): install LuaScript plugin first, then in LuaScript Edit Startup Script past the following:
npp.AddShortcut("Insert Current Date/Time", "Ctrl+Shift+D", function()
editor:ReplaceSel(os.date("%I:%M %p %m/%d/%Y"))
end)
After restart npp, the Ctrl-Shift-D will do as F5 in notepad.
Starting with Notepad++ 8.1.5, you can insert a custom date/time format using Edit/Insert/Date Time (customized). You can customize it in Settings/Preferences/Multi-Instance & Date.
In one of the recent N++ updates, my previous shortcut of CTRL + SHIFT + D, stopped working. I then rechecked and had to remap the custom date shortcut to ALT+ SHIFT + D. This is how it looks:
Make sure your customized date match your expectations:
A more generic answer using "Autohotkey":
https://autohotkey.com/board/topic/21387-how-to-insert-current-date-into-a-hotkey/
Examples:
;//will replace ddd keystroke with yyyy-MM-dd formatted date
:R*?:ddd:
FormatTime, CurrentDateTime,, yyyy-MM-dd
SendInput %CurrentDateTime%
return
;//will replace ttt keystroke with yyyy-MM-dd HH:mm formatted date/time
:R*?:ttt::
FormatTime, CurrentDateTime,, yyyy-MM-dd HH:mm
SendInput %CurrentDateTime%
return
Here's an easy and flexible way to insert a date/time stamp in any format you like.
Like many other developers, I used the FingerText plugin which allows you to insert customizable snippets of code or text by typing a "trigger" word and pressing the tab key.
One of my snippets is to insert a date/time stamp that I use in code comments:
I just type stamptab and it inserts a date like this: 2020-07-31 # 11:45
Here is the FingerText code I use to generate the stamp, which you can modify for any datetime format you choose:
$[![(key)DATE:yyyy-MM-dd]!] # $[![(key)TIME:HH:mm]!] $[0[]0][>END<]
You can download FingerText through the Plugins Admin dialog.
The quickest way that comes to my mind is to open Windows Notepad, press F5, copy/paste. No need to install anything...

Resources