Remove cell from table - reporting

I have created my own Sales / Quotation report caleed sale_order.sxw using OpenOffice Write. From there I generate the sale_order.rml file.
I have two installation of OpenERP, one on Windows and one on Ubuntu.
In OOWriter, I have a 4 columns table that prints out each single order line along with Quantity, "Print this" text and Subtotal.
The third column is printed out only if a specific condition is met, based on the price list name containing "final":
So I expect:
If "final" is not located within the price list
Product A|2|Print this |20
If "final" is located within the price list:
Product A|2|20
To solve this, I have the following code:
(so.partner_id.property_product_pricelist.name.find('final') > 0) and "Print this" or removeParentNode('td')
It works fine from the windows installation.
But when I run the same file from the Ubuntu installation I get an AssertionError message and I can't print out my Sales / Quotation pdf report.
I did some testing specifically with the removeParentNode('td') and the error seems to come from there, but I can't work out why as it works under windows!
Here is the log from the Ubuntu server:
2013-04-15 13:09:07,822 1621 ERROR ? openerp.service.web_services: Exception:
Traceback (most recent call last):
File "/home/download/openerp-6.1-20121008-233119/openerp/service/web_services.py", line 727, in go
(result, format) = obj.create(cr, uid, ids, datas, context)
File "/home/download/openerp-6.1-20121008-233119/openerp/report/report_sxw.py", line 442, in create
fnct_ret = fnct(cr, uid, ids, data, report_xml, context)
File "/home/download/openerp-6.1-20121008-233119/openerp/report/report_sxw.py", line 511, in create_source_pdf
return self.create_single_pdf(cr, uid, ids, data, report_xml, context)
File "/home/download/openerp-6.1-20121008-233119/openerp/report/report_sxw.py", line 533, in create_single_pdf
pdf = create_doc(etree.tostring(processed_rml),rml_parser.localcontext,logo,title.encode('utf8'))
File "/home/download/openerp-6.1-20121008-233119/openerp/report/interface.py", line 207, in create_pdf
obj.render()
File "/home/download/openerp-6.1-20121008-233119/openerp/report/render/render.py", line 59, in render
self._result = self._render()
File "/home/download/openerp-6.1-20121008-233119/openerp/report/render/rml.py", line 41, in _render
return rml2pdf.parseNode(self.rml, self.localcontext, images=self.bin_datas, path=self.path,title=self.title)
File "/home/download/openerp-6.1-20121008-233119/openerp/report/render/rml2pdf/trml2pdf.py", line 1007, in parseNode
r.render(fp)
File "/home/download/openerp-6.1-20121008-233119/openerp/report/render/rml2pdf/trml2pdf.py", line 314, in render
pt_obj.render(el)
File "/home/download/openerp-6.1-20121008-233119/openerp/report/render/rml2pdf/trml2pdf.py", line 983, in render
fis += r.render(node_story)
File "/home/download/openerp-6.1-20121008-233119/openerp/report/render/rml2pdf/trml2pdf.py", line 877, in render
return process_story(node_story)
File "/home/download/openerp-6.1-20121008-233119/openerp/report/render/rml2pdf/trml2pdf.py", line 870, in process_story
flow = self._flowable(node)
File "/home/download/openerp-6.1-20121008-233119/openerp/report/render/rml2pdf/trml2pdf.py", line 834, in _flowable
return self.render(node)
File "/home/download/openerp-6.1-20121008-233119/openerp/report/render/rml2pdf/trml2pdf.py", line 877, in render
return process_story(node_story)
File "/home/download/openerp-6.1-20121008-233119/openerp/report/render/rml2pdf/trml2pdf.py", line 870, in process_story
flow = self._flowable(node)
File "/home/download/openerp-6.1-20121008-233119/openerp/report/render/rml2pdf/trml2pdf.py", line 793, in _flowable
return self._table(node)
File "/home/download/openerp-6.1-20121008-233119/openerp/report/render/rml2pdf/trml2pdf.py", line 697, in _table
assert length == len(node.get('colWidths').split(','))
AssertionError
2013-04-15 13:09:07,951 1621 ERROR ? openerp.netsvc:
(<type 'exceptions.AssertionError'>, AssertionError(), <traceback object at 0x7ff558e54b00>)
2013-04-15 13:09:07,953 1621 INFO ? werkzeug: 192.168.2.4 - - [15/Apr/2013 13:09:07] "POST /web/report HTTP/1.1" 500 -
I did a comparison between the trml2pdf.py files used on the server and the one used by windows and they are identical.

This is because of un matching original column.

Related

Dask DataFrame not starting the task with scheduler='processes'

I'm trying to apply a custom function with groupby apply and map_partitions.
If I run the script, in a Spyder project, with compute(scheduler='processes') the task doesn't start (progress bar frozen at 0%)
ddf = dd.from_pandas(df, npartitions=64)
d_df = ddf.map_partitions(lambda part: part.groupby().apply(module.custom_func))\
.compute(scheduler='processes')
Here's what I get with KeyboardInterrupt
File "C:\ProgramData\Anaconda3\lib\site-packages\dask\base.py", line 166, in compute
(result,) = compute(self, traverse=False, **kwargs)
File "C:\ProgramData\Anaconda3\lib\site-packages\dask\base.py", line 444, in compute
results = schedule(dsk, keys, **kwargs)
File "C:\ProgramData\Anaconda3\lib\site-packages\dask\multiprocessing.py", line 218, in get
**kwargs
File "C:\ProgramData\Anaconda3\lib\site-packages\dask\local.py", line 475, in get_async
key, res_info, failed = queue_get(queue)
File "C:\ProgramData\Anaconda3\lib\site-packages\dask\local.py", line 125, in queue_get
return q.get(block=True, timeout=0.1)
File "C:\ProgramData\Anaconda3\lib\queue.py", line 179, in get
self.not_empty.wait(remaining)
File "C:\ProgramData\Anaconda3\lib\threading.py", line 300, in wait
gotit = waiter.acquire(True, timeout)
Strangely enough, If I run it by line or line selection it works.
Many thanks.

Hue server error "checkJobBrowserStatus" cloudera hadoop

I have some problem with accessing to Hue webUI. I just get
"500 server error"
to every acces to any web page on the Hue. The sample of the error:
From log file i got some information about type of this error
[12/Dec/2017 01:00:53 -0800] views ERROR JS ERROR: {"msg":"ReferenceError: checkJobBrowserStatus is not defined","url":"http://10.40.2.89:8888/hue/","line":1584,"column":12,"stack":"#http://10.40.2.89:8888/hue/:1584:13\nn.Callbacks/j#http://10.40.2.89:8888/static/desktop/ext/js/jquery/jquery-2.1.1.min.e40ec2161fe7.js:2:26852\nn.Callbacks/k.fireWith#http://10.40.2.89:8888/static/desktop/ext/js/jquery/jquery-2.1.1.min.e40ec2161fe7.js:2:27661\n.ready#http://10.40.2.89:8888/static/desktop/ext/js/jquery/jquery-2.1.1.min.e40ec2161fe7.js:2:29482\nI#http://10.40.2.89:8888/static/desktop/ext/js/jquery/jquery-2.1.1.min.e40ec2161fe7.js:2:29656\n"}
when i try to open other web pages i get the same error
[12/Dec/2017 01:04:56 -0800] views ERROR JS ERROR: {"msg":"ReferenceError: checkJobBrowserStatus is not defined","url":"http://10.40.2.89:8888/metastore/tables/","line":1584,"column":12,"stack":"#http://10.40.2.89:8888/metastore/tables/:1584:13\nn.Callbacks/j#http://10.40.2.89:8888/static/desktop/ext/js/jquery/jquery-2.1.1.min.e40ec2161fe7.js:2:26852\nn.Callbacks/k.fireWith#http://10.40.2.89:8888/static/desktop/ext/js/jquery/jquery-2.1.1.min.e40ec2161fe7.js:2:27661\n.ready#http://10.40.2.89:8888/static/desktop/ext/js/jquery/jquery-2.1.1.min.e40ec2161fe7.js:2:29482\nI#http://10.40.2.89:8888/static/desktop/ext/js/jquery/jquery-2.1.1.min.e40ec2161fe7.js:2:29656\n"}
and so on , similar errors on the any web page.
I've attached the full log file on Google Drive
I'm trying to open a web interface HUE with Iceweasel on Debian.
Cloudera version is CDH5 (CDH 5.13.0).
It seems like [indexer] app was blacklisted ([desktop] section in /hue/desktop/dump_config), so Hue won't work properly.
Also, looks like you are on the old UI, it is recommended to switch back to
Hue 4.
[12/Dec/2017 01:04:53 -0800] middleware INFO Processing exception: u'indexer' is not a registered namespace: Traceback (most recent call last):
File "/usr/lib/hue/build/env/lib/python2.7/site-packages/Django-1.6.10-py2.7.egg/django/core/handlers/base.py", line 112, in get_response
response = wrapped_callback(request, *callback_args, **callback_kwargs)
File "/usr/lib/hue/build/env/lib/python2.7/site-packages/Django-1.6.10-py2.7.egg/django/db/transaction.py", line 371, in inner
return func(*args, **kwargs)
File "/usr/lib/hue/apps/metastore/src/metastore/views.py", line 240, in show_tables
'source_type': _get_servername(db),
File "/usr/lib/hue/desktop/core/src/desktop/lib/django_util.py", line 230, in render
**kwargs)
File "/usr/lib/hue/desktop/core/src/desktop/lib/django_util.py", line 148, in _render_to_response
return django_mako.render_to_response(template, *args, **kwargs)
File "/usr/lib/hue/desktop/core/src/desktop/lib/django_mako.py", line 125, in render_to_response
return HttpResponse(render_to_string(template_name, data_dictionary), **kwargs)
File "/usr/lib/hue/desktop/core/src/desktop/lib/django_mako.py", line 114, in render_to_string_normal
result = template.render(**data_dict)
File "/usr/lib/hue/build/env/lib/python2.7/site-packages/Mako-0.8.1-py2.7.egg/mako/template.py", line 443, in render
return runtime._render(self, self.callable_, args, data)
File "/usr/lib/hue/build/env/lib/python2.7/site-packages/Mako-0.8.1-py2.7.egg/mako/runtime.py", line 786, in _render
**_kwargs_for_callable(callable_, data))
File "/usr/lib/hue/build/env/lib/python2.7/site-packages/Mako-0.8.1-py2.7.egg/mako/runtime.py", line 818, in _render_context
_exec_template(inherit, lclcontext, args=args, kwargs=kwargs)
File "/usr/lib/hue/build/env/lib/python2.7/site-packages/Mako-0.8.1-py2.7.egg/mako/runtime.py", line 844, in _exec_template
callable_(context, *args, **kwargs)
File "/tmp/tmpMMurVL/metastore/metastore.mako.py", line 142, in render_body
__M_writer(escape(unicode( assist.assistPanel() )))
File "/tmp/tmpMMurVL/metastore/assist.mako.py", line 497, in render_assistPanel
__M_writer(escape(unicode( url('indexer:importer_prefill', source_type='all', target_type='table') )))
File "/usr/lib/hue/desktop/core/src/desktop/lib/django_mako.py", line 131, in url
return reverse(view_name, args=args, kwargs=view_args)
File "/usr/lib/hue/build/env/lib/python2.7/site-packages/Django-1.6.10-py2.7.egg/django/core/urlresolvers.py", line 532, in reverse
key)
NoReverseMatch: u'indexer' is not a registered namespace
This might be a bit late, but thought of posting the solution to help others.
I was able to get this page working by setting "share_jobs" to "true" in "/etc/hue/conf.empty/hue.ini"
So the following worked for me:
[jobbrowser]
# Share submitted jobs information with all users. If set to false,
# submitted jobs are visible only to the owner and administrators.
share_jobs=true

Openerp_ Magento Integration/sync Error

Traceback (most recent call last):
File "/opt/openerp/server/openerp/addons/connector/queue/worker.py", line 123, in run_job
job.perform(session)
File "/opt/openerp/server/openerp/addons/connector/queue/job.py", line 492, in perform
self.result = self.func(session, *self.args, **self.kwargs)
File "/opt/openerp/server/openerp/addons/magentoerpconnect/unit/import_synchronizer.py", line 378, in import_record
importer.run(magento_id, force=force)
File "/opt/openerp/server/openerp/addons/magentoerpconnect/unit/import_synchroni zer.py", line 221, in run
self._import_dependencies()
File "/opt/openerp/server/openerp/addons/magentoerpconnect/sale.py", line 849, in _import_dependencies
'magento.product.product')
File "/opt/openerp/server/openerp/addons/magentoerpconnect/unit/import_synchronizer.py", line 124, in _import_dependency
importer.run(magento_id)
File "/opt/openerp/server/openerp/addons/magentoerpconnect/unit/import_synchronizer.py", line 206, in run
self.magento_record = self._get_magento_data()
File "/opt/openerp/server/openerp/addons/magentoerpconnect/unit/import_synchronizer.py", line 63, in _get_magento_data
return self.backend_adapter.read(self.magento_id)
File "/opt/openerp/server/openerp/addons/magentoerpconnect/product.py", line 278, in read
[int(id), storeview_id, attributes, 'id'])
File "/opt/openerp/server/openerp/addons/magentoerpconnect/product.py", line 243, in _call
return super(ProductProductAdapter, self)._call(method, arguments)
File "/opt/openerp/server/openerp/addons/magentoerpconnect/unit/backend_adapter.py", line 168, in _call
result = api.call(method, arguments)
File "/usr/local/lib/python2.7/dist-packages/magento-0.4-py2.7.egg/magento/api.py", line 161, in call
return self.client.call(self.session, resource_path, arguments)
File "/usr/lib/python2.7/xmlrpclib.py", line 1224, in __call__
return self.__send(self.__name, args)
File "/usr/lib/python2.7/xmlrpclib.py", line 1578, in __request
verbose=self.__verbose
File "/usr/lib/python2.7/xmlrpclib.py", line 1264, in request
return self.single_request(host, handler, request_body, verbose)
File "/usr/lib/python2.7/xmlrpclib.py", line 1297, in single_request
return self.parse_response(response)
File "/usr/lib/python2.7/xmlrpclib.py", line 1473, in parse_response
return u.close()
File "/usr/lib/python2.7/xmlrpclib.py", line 793, in close
raise Fault(**self._stack[0])
Fault: <Fault 3: 'Invalid api path.'>
I Am Unable To Integrated & Sync My Products From Magento To Openerp,I Have Used The CampToCamp's Add-on In The Openerp & Have Added The Module On Magento. I Have Used My Magento Server Link & Have Added Enough Test Products Yet The Products Aren't Syncing Due To The Above error As In The Jobs Tab In Openerp. Please Help Me Get Through Or Understand What Am I Doing Wrongly.
Thank You In Advance.
The problem was the integration module which was installed on my magento site didn't match the integration module on Openerp so all i needed to do was install both from the same vender and it worked like a charm.
Just remove both the integration modules from openerp & magento,& follow a single vender for me i used the following guide to get the Integration working.
https://openerp-magento-connector.readthedocs.org/en/develop/index.html

Boto's get_all_images function

I tried to load list of AWS images using Python boto library. So my code is like
con = boto.connect_ec2(user, pasw)
con.get_all_instances()
con.get_all_images()
Problem is that, get_all_instances() works fine, but get_all_images() is not responding. When stop application from kbd, I see
File "eagle/main.py", line 102, in <module>
main(sys.argv[1:])
File "eagle/main.py", line 97, in main
return request, process_request(request)
File "eagle/main.py", line 45, in process_request
request = each().process_request(request)
File "/home/rustem/projects/eagle.2.0/eagle/../eagle/middlewares/standard.py", line 64, in process_request
request.images = con.get_all_images()
File "/home/rustem/envs/eagle.2.0/lib/python2.7/site-packages/boto/ec2/connection.py", line 171, in get_all_images
[('item', Image)], verb='POST')
File "/home/rustem/envs/eagle.2.0/lib/python2.7/site-packages/boto/connection.py", line 1063, in get_list
body = response.read()
File "/home/rustem/envs/eagle.2.0/lib/python2.7/site-packages/boto/connection.py", line 411, in read
self._cached_response = httplib.HTTPResponse.read(self)
File "/usr/lib64/python2.7/httplib.py", line 541, in read
return self._read_chunked(amt)
File "/usr/lib64/python2.7/httplib.py", line 590, in _read_chunked
value.append(self._safe_read(chunk_left))
File "/usr/lib64/python2.7/httplib.py", line 647, in _safe_read
chunk = self.fp.read(min(amt, MAXAMOUNT))
File "/usr/lib64/python2.7/socket.py", line 380, in read
data = self._sock.recv(left)
File "/usr/lib64/python2.7/ssl.py", line 241, in recv
return self.read(buflen)
File "/usr/lib64/python2.7/ssl.py", line 160, in read
return self._sslobj.read(len)
KeyboardInterrupt
It seems like Boto's function is not working, AWS API is not responding. Have anyone similar problem? Thanks.
Reason was that the get_all_images function returns all images from AWS, so it works about few minutes. I started to user filters and now it takes reasonably time.

gdata.docs.client.DocsClient

I have the following code, reads oauth2 token form file, then try's to perform a doc's list query to find a specific spreadsheet that I want to copy, however no matter what I try the code either errors out or returns with an object containing no document data.
I am using gdata.docs.client.DocsClient which as far as I can tell is version 3 of the API
def CreateClient():
"""Create a Documents List Client."""
client = gdata.docs.client.DocsClient(source=config.APP_NAME)
client.http_client.debug = config.DEBUG
# Authenticate the user with CLientLogin, OAuth, or AuthSub.
if os.path.exists(config.CONFIG_FILE):
f = open(config.CONFIG_FILE)
tok = pickle.load(f)
f.close()
client.auth_token = tok.auth_token
return client
1st query attempt
def get_doc():
new_api_query = gdata.docs.client.DocsQuery(title='RichSheet', title_exact=True, show_collections=True)
d = client.GetResources(q = new_api_query)
this fails with the following stack trace
Traceback (most recent call last):
File "/Users/richard/PycharmProjects/reportone/make_my_report.py", line 83, in <module>
get_doc()
File "/Users/richard/PycharmProjects/reportone/make_my_report.py", line 57, in get_doc
d = client.GetResources(q = new_api_query)
File "/Users/richard/PycharmProjects/reportone/gdata/docs/client.py", line 151, in get_resources
**kwargs)
File "/Users/richard/PycharmProjects/reportone/gdata/client.py", line 640, in get_feed
**kwargs)
File "/Users/richard/PycharmProjects/reportone/gdata/docs/client.py", line 66, in request
return super(DocsClient, self).request(method=method, uri=uri, **kwargs)
File "/Users/richard/PycharmProjects/reportone/gdata/client.py", line 267, in request
uri=uri, auth_token=auth_token, http_request=http_request, **kwargs)
File "/Users/richard/PycharmProjects/reportone/atom/client.py", line 115, in request
self.auth_token.modify_request(http_request)
File "/Users/richard/PycharmProjects/reportone/gdata/gauth.py", line 1047, in modify_request
token_secret=self.token_secret, verifier=self.verifier)
File "/Users/richard/PycharmProjects/reportone/gdata/gauth.py", line 668, in generate_hmac_signature
next, token, verifier=verifier)
File "/Users/richard/PycharmProjects/reportone/gdata/gauth.py", line 629, in build_oauth_base_string
urllib.quote(params[key], safe='~')))
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib.py", line 1266, in quote
if not s.rstrip(safe):
AttributeError: 'bool' object has no attribute 'rstrip'
Process finished with exit code 1
then my second attempt
def get_doc():
other = gdata.docs.service.DocumentQuery(text_query='RichSheet')
d = client.GetResources(q = other)
this returns an ResourceFeed object, but has no content. I have been through the source code for these function but thing are not any obvious.
Have i missed something ? or should i go back to version 2 of the api ?

Resources