error while launching qweb report from python - python-3.5

I'm upgrading a module from odoo v10 to odoo v11. It is founded that the get_action is replaced with report_action.
so I used the code as follows
self.env.ref('report_action_name').report_action(self, data=data, config=False)
but it gives me error
AttributeError: 'ir.ui.view' object has no attribute 'report_action'
Thanks in advance

Make sure that report_action_name is the record_id of the report .
Eg:
Python
self.env.ref('module_name.record_id').report_action(self, data=data, config=False)
xml
<record id="record_id" model="ir.actions.report">
<field name="name">Name</field>
<field name="model">Model</field>
<field name="report_type">qweb-pdf</field>
<field name="report_name">module_name.report_template_id</field>
</record>
Report XML
<template id="report_template_id">
<Your code>
</template>

Related

python 3 aiml error WARNING No match found for input

I am facing issues while using amil. i have downloded it from https://github.com/paulovn/python-aiml . when i use the below code it is throwing me match not found error.
import aiml
k = aiml.Kernel()
k.learn("std-startup.xml")
k.respond("load aiml b")
while True: print (k.respond(input("> "))
i have placed all .aiml files and .xml files in my working directory. my folder structure is below
AIML
main
standard
*.amil files
ai.py
std-startup.xml
in std-startup.xml, i have changed the path as well, don't know where i am going wrong
<aiml version="1.0">
<!-- This category works with the Standard AIML Set -->
<category>
<pattern>LOAD AIML B</pattern>
<template>
<!-- Load standard AIML set -->
<learn>main/standard/std-*.aiml</learn>
</template>
</category>
</aiml>
You have a typo in: *.amil files
It should be *.aiml files

Visibility parameters support And (&&) operator in fremarker android studio

I am creating a template using freemarker. I want to check And (&&) operator with two checkbox. I check it with &&, it not working. The following is a sample template code:
<?xml version="1.0"?>
<template
minApi="7"
minBuildApi="8">
.......
<parameter
id="hasTabLayout"
name="Have Tab Layout"
type="boolean"
default="false"/>
<parameter
id="hasRecycleViewTabOne"
name="Tab one have recycleView"
type="boolean"
default="false"/>
<parameter
id="adapterTabOneName"
name="Adapter Tab One Name"
type="string"
constraints="class|unique|nonempty"
default="BlankTabOneItem"
**visibility="hasTabLayout && hasRecycleViewTabOne"** />
.......
Note sure what error message you are getting, but && is not well-formed XML. It should be && instead.

Twig: Unknown "localizednumber" filter

When applying the Twig filter "localizednumber", the following error is thrown:
Unknown "localizednumber" filter in MyBundle:Home:home.html.twig at line 558.
I have installed Twig Extensions as well as PHP Intl.
What could be the issue here?
Did you declare the Intl Extension in your services?
If not, add this:
<service id="twig.extension.intl"
class="Twig_Extensions_Extension_Intl">
<tag name="twig.extension" />
</service>
in your app/config/services.xml.

Configure apache solr3.6 with tika1.2

I am using solr3.6 with tika1.2 but I can't upload pdf files.
First I install solr and upload some *.xml files from the exampledocs.
This files I could search with this URL http://localhost:8983/solr/select/?q=solr.
And in the next step I install tika to upload pdf and doc files but it doesn't function.
The following content is in the "example/solr/conf/solrconf.xml" file.
<requestHandler name="/update/extract" startup="lazy" class="solr.extraction.ExtractingRequestHandler" >
<lst name="defaults"><str name="fmap.content">text</str><str name="lowernames">true</str>
<str name="uprefix">ignored_</str>
<str name="tika.config">tika-data-config.xml</str>
<str name="captureAttr">true</str>
<str name="fmap.a">links</str>
<str name="fmap.div">ignored_</str>
</lst>
</requestHandler>`
And in the file "example/solr/conf/tika-data-config.xml" I have this content:
<dataConfig>
<dataSource name="bin" type="BinFileDataSource" />
<document>
<entity name="f" dataSource="null" rootEntity="false" processor="FileListEntityProcessor" transformer="TemplateTransformer" baseDir="/home/ubuntu-user/Documents" fileName=".*\.(DOC)|(PDF)|(pdf)|(doc)|(docx)|(ppt)" onError="skip" recursive="true">
<field column="fileAbsolutePath" name="path" />
<field column="fileSize" name="size" />
<field column="fileLastModified" name="lastmodified" /><entity name="tika-test" dataSource="bin" processor="TikaEntityProcessor" url="${f.fileAbsolutePath}" format="text" onError="skip">
<field column="Author" name="author" meta="true"/>
<field column="title" name="title" meta="true"/>
</entity>
If I put this lines in the console
curl http://localhost:8983/solr/update/extract?literal.id=doc2&uprefix=attr_&fmap.content=attr_content&commit=true" -F "myfile=#test.pdf"
I get this output
<?xml version="1.0" encoding="UTF-8"?>
<response>
<lst name="responseHeader">
<int name="status">0</int>
<int name="QTime">183</int>
</lst>
</response>
But I can't search the content with solr. If I browse to this url: http://localhost:8983/solr/browse, I see a new entry but no content.
Also I started the solr and tika server:
java -jar start.jar
java -jar tika-server-1.2.jar
Can anyone help me ?
You need add the jars (or paths) for apache-solr-dataimporthandler-3.6, apache-solr-dataimporthandler- extras-3.6 and apache-solr-cell-3.6 in the dist folder as well as corresponding files in the contrib folder.
Then you can extract pdf's from Solr without starting a Tika server.
Check the ExtractingRequestHandler which would help you to index the Rich documents.
You don't need to start a separate Tika Server as Solr can use the libraries added within to extract the content from the rich documents.
The jar (Solr Cell and Tika Jars needed with dependencies) required are probably within the configuration :-
<lib dir="../../dist/" regex="apache-solr-cell-\d.*\.jar" />
<lib dir="../../contrib/extraction/lib" regex=".*\.jar" />
Now I have install solr new and I can search pdf's by this url
http://localhost:8983/solr/select/?q=attr_content:st*
Some PDFs are ok but by any PDF I get this Output
<arr name="attr_content"><str> ((stdin)) � ���������
The are attr_creation_date and attr_meta are ok.The producer was Ghostscript.
GPL Ghostscript 8.63

Magento Getting Fatal error with custom module

I am getting following error :
Class 'Lucky_Test_Helper_Data' not found in E:\wamp\www\raj\magento_new\app\Mage.php on line 521
I created this module using module creator.
I checked it with one of my magento installation, it worked fine. Then I copied the module to the actually installation where I wanted to use it.
I did a some debugging, and found that if I comment certain part of config.xml I get no error.
I figured that out after having a look at stack trace of error, which included following line.
include( 'E:\wamp\www\raj\magento_new\app\design\adminhtml\default\default\template\page\menu.phtml' );
here is my config.xml
now if I comment :
<!--<test module="test">
<title>Test</title>
<sort_order>71</sort_order>
<children>
<items module="test">
<title>Manage Test </title>
<sort_order>0</sort_order>
<action>test/adminhtml_test</action>
</items>
</children>
</test>-->
I get no error. Module seems to be loading fine till this point.
Do you see anything wrong?
Help me out.
You have to explicitly define that you are using helpers, like this:
<global>
<helpers>
<test>
<class>Lucky_Test_Helper</class>
</test>
</helpers>
</global>
In the menu you define with module="test" that your module handles the translation for it

Resources