internal server error in customized receipt - pos

I am working on odoo version 15;
trying to customize receipt in POS module ;
but I have an internal server error (500) ..
My code as following :
manifest.py
...
"license": "OPL-1",
"depends": [
'base',
'point_of_sale',
],
'assets': {
'web.assets_qweb': [
'static/src/xml/OrderReceipt.xml',
# 'views/OrderReceipt.xml',
],
...
OrderReceipt.xml
<?xml version="1.0" encoding="UTF-8"?>
<templates id="template" xml:space="preserve">
<t t-extend="OrderReceipt">
<t t-jquery=".pos-receipt .pos-receipt-contact" t-operation='append'>
<t t-if='receipt.client'>
<div style="font-weight:bold;">Customer:<t t-esc='receipt.client'/></div>
</t>
<p>Success !</p>
</t>
</t>
</templates>
Error Log :
FileNotFoundError: File not found: static/src/xml/OrderReceipt.xml - - -
2022-07-28 05:41:09,068 342410 INFO newestDB07021 werkzeug: 192.168.0.61 - - [28/Jul/2022 05:41:09] "GET /favicon.ico HTTP/1.1" 404 - 127 0.074 0.189
2022-07-28 05:41:50,952 342410 INFO newestDB07021 werkzeug: 192.168.0.61 - - [28/Jul/2022 05:41:50] "POST /longpolling/poll HTTP/1.1" 200 - 13 0.025 50.159
2022-07-28 05:41:52,030 342410 INFO newestDB07021 werkzeug: 192.168.0.61 - - [28/Jul/2022 05:41:52] "POST /longpolling/poll HTTP/1.1" 200 - 9 0.017 50.024
2022-07-28 05:41:55,264 342410 INFO newestDB07021 odoo.addons.base.models.ir_cron: Starting job `payment: post-process transactions`.
2022-07-28 05:41:55,270 342410 INFO newestDB07021 odoo.addons.base.models.ir_cron: Job `payment: post-process transactions` done.

Solved by giving full path /model_name/static/src/xml/file_name.xml in the manifest.py file model_name was missing
In odoo 15, the path to the files is now relative to the root folder, not the module folder.
Try this,
<t t-inherit="point_of_sale.OrderReceipt" t-inherit-mode="extension" owl="1">
<xpath expr="//div[hasclass('pos-receipt-contact')]" position="after">
<t t-if='receipt.client'>
<div style="font-weight:bold;">Customer:<t t-esc='receipt.client'/></div>
</t>
<p>Success !</p>
</xpath> </t>

Related

got 301 and then 404 error response while calling end point in odoo15

here is my code:
from odoo import http
_logger = logging.getLogger(__name__)
class CrmController(http.Controller):
#http.route('/crm/lead', type='json', auth='none', website=True, methods=['POST'])
def post_data_end_point(self):
print("==== api called successfully ====")
return "api called successfully---"
after call this end point on postman i got this error
2022-09-14 09:44:09,925 167674 INFO odoo15 werkzeug: 127.0.0.1 - - [14/Sep/2022 09:44:09] "POST /crm/lead/ HTTP/1.1" 301 - 35 0.020 0.817
2022-09-14 09:44:10,421 167674 INFO odoo15 werkzeug: 127.0.0.1 - - [14/Sep/2022 09:44:10] "GET /crm/lead HTTP/1.1" 404 - 214 0.116 0.357
you have define type='json' it means it response only json(dictionary) object not string.

Element cannot located in parent view when replace div in custom receipt

I am using odoo 15 ; I am customizing receipt in point_of_sale module
I have a problem when trying to replace div( have a class related to other div inherits the same templates)
my code as following :
<xml version="1.0" encoding="UTF-8"?>
<templates id="pos_custom"xml:space="preserve">
<t t-inherit="point_of_sale.OrderReceipt"t-inherit-mode="extension"owl="1">
<xpathexpr="//div[hasclass('pos-receipt-contact')]"position="replace">
<p>Success !p>
</xpath>
</t>
</templates>
my log error :
ValueError: Element '<xpath expr="//div[hasclass('pos-receipt-contact')]">' cannot be located in parent view - - -
2022-07-28 08:05:21,977 351769 INFO ? werkzeug: 192.168.0.61 - - [28/Jul/2022 08:05:21] "GET /web/static/lib/stacktracejs/stacktrace.js HTTP/1.1" 200 - - - -
2022-07-28 08:05:21,993 351769 INFO newestDB07021 werkzeug: 192.168.0.61 - - [28/Jul/2022 08:05:21] "GET /web/webclient/locale/en_US HTTP/1.1" 200 - 1 0.001 0.004
2022-07-28 08:05:22,057 351769 INFO newestDB07021 werkzeug: 192.168.0.61 - - [28/Jul/2022 08:05:22] "GET /web/assets/debug/web.assets_backend_prod_only.js HTTP/1.1" 200 - 3 0.003 0.058
2022-07-28 08:05:22,057 351769 INFO newestDB07021 werkzeug: 192.168.0.61 - - [28/Jul/2022 08:05:22] "GET /web/assets/debug/web.assets_backend.js HTTP/1.1" 200 - 3 0.002 0.061

Flasgger execution is a success but not showing the XML body

While Deploying iris prediction model using flasgger API, i can enter the lengths and widths of the iris flower with http/200 ok , but i do not see an xml output with the prediction results.
From ipython notebook:
Running on http://127.0.0.1:5001/ (Press CTRL+C to quit)
127.0.0.1 - - [20/Jan/2020 17:16:23] "GET /predict?s_length=3.2&s_width=2.0&p_length=3.0&p_width=4.5 HTTP/1.1" 200 -
127.0.0.1 - - [20/Jan/2020 17:16:23] "GET /favicon.ico HTTP/1.1" 404 -
127.0.0.1 - - [20/Jan/2020 17:16:47] "GET /apidocs/ HTTP/1.1" 200 -
127.0.0.1 - - [20/Jan/2020 17:16:47] "GET /flasgger_static/swagger-ui.css HTTP/1.1" 200 -
127.0.0.1 - - [20/Jan/2020 17:16:47] "GET /flasgger_static/swagger-ui-bundle.js HTTP/1.1" 200 -
127.0.0.1 - - [20/Jan/2020 17:16:47] "GET /flasgger_static/swagger-ui-standalone-preset.js HTTP/1.1" 200 -
127.0.0.1 - - [20/Jan/2020 17:16:48] "GET /flasgger_static/lib/jquery.min.js HTTP/1.1" 200 -
127.0.0.1 - - [20/Jan/2020 17:16:48] "GET /apispec_1.json HTTP/1.1" 200 -
127.0.0.1 - - [20/Jan/2020 17:16:48] "GET /flasgger_static/favicon-32x32.png HTTP/1.1" 200 -
127.0.0.1 - - [20/Jan/2020 17:17:03] "GET /predict?s_length=4.2&s_width=5.6&p_length=2.6&p_width=6.3 HTTP/1.1" 200 -
Hope you all are keeping well.
So i found the problem after few days of struggling with it, looking for solution ,I guess i was too lazy to post it on GitHub or maybe got busy , the error indicated above was a result of incomplete XML missing 200 body for an HTTP Response , which did not output any XML Result when I entered the input parameters and run the prediction from the GUI , which is expected in my case.
So it is important that we provide a complete XML body with 200 response , we can also add the kind of results you would expect under the 200 XML Body for the prediction based on your Project.
Adding the 200 in the XML body as shown below, fixed the problem.
def predict_iris_file():
"""Example file endpoint returning a prediction of iris
---
parameters:
- name: input_file
in: formData
type: file
required: true
responses:
200:
description: "0: Iris-setosa, 1: Iris-versicolor, 2: Iris-virginica"
"""
Regards
akudnaver
Sorted the issue.
Responses should be in the same indent as parameters and 200 should be indented below responses

react native map issue

My app gives me error when I import MapView on react nativ
Here is my code:
`import MapView from 'react-native-maps'`
just importing it like that gives me an erorr
Here is my dpendency:
"dependencies": {
"react": "16.6.1",
"react-native": "0.57.7",
"react-native-maps": "^0.22.1",
"react-native-router-flux": "^4.0.6"
},
Opening /Users/Desktop/snl/reactNative/ChatApp/node_modules/react-native/Libraries/Renderer/oss/ReactNativeRenderer-dev.js with /Applications/Sublime Text.app/Contents/SharedSupport/bin/subl
BUNDLE [ios, dev] ../../index.js ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓ 100.0% (1/1), done.
BUNDLE [ios, dev] ../../index.js ░░░░░░░░░░░░░░░░ 0.0% (0/1)::1 - - [09/Dec/2018:08:42:21 +0000] "GET /index.bundle?platform=ios&dev=true&minify=false HTTP/1.1" 200 - "-" "ChatApp/1 CFNetwork/975.0.3 Darwin/17.7.0"
::1 - - [09/Dec/2018:08:42:24 +0000] "POST /symbolicate HTTP/1.1" 200 - "-" "ChatApp/1 CFNetwork/975.0.3 Darwin/17.7.0"
::1 - - [09/Dec/2018:08:42:25 +0000] "POST /symbolicate HTTP/1.1" 200 - "-" "ChatApp/1 CFNetwork/975.0.3 Darwin/17.7.0"
^[[1;2D

Log output too verbose - how to change log level?

I'm trying to debug my simple Rails app and find navigating and printing with puts works well but the log in Bash is way too verbose. I've looked through lots of questions/responses here and have tried some of them but without success. I tried importing the quiet_assets Gem with
gem 'quiet_assets', group: :development
and have tried changing log levels to :error in production.rb
config.log_level = Logger::error
But I still get all the GET requests of Assets when navigating making review of logs difficult.
Worth noting I've tried restarting the server and ran bundle just in case. I did hard refresh even though browser cache shouldn't have anything to do with this.
Here's example navigation:
20:08:55 web.1 | 127.0.0.1 - - [22/Oct/2014 20:08:55] "GET /application.js HTTP/1.1" 304 - 0.0185
20:08:55 web.1 | 127.0.0.1 - - [22/Oct/2014 20:08:55] "GET /application.css HTTP/1.1" 304 - 0.0790
20:08:56 web.1 | 127.0.0.1 - - [22/Oct/2014 20:08:56] "GET /brands/46 HTTP/1.1" 304 - 0.0111
20:08:56 web.1 | 127.0.0.1 - - [22/Oct/2014 20:08:56] "GET /application.js HTTP/1.1" 304 - 0.0062
20:08:56 web.1 | 127.0.0.1 - - [22/Oct/2014 20:08:56] "GET /application.css HTTP/1.1" 304 - 0.0066
20:08:57 web.1 | 127.0.0.1 - - [22/Oct/2014 20:08:57] "GET /brands/46 HTTP/1.1" 304 - 0.0105
20:08:57 web.1 | 127.0.0.1 - - [22/Oct/2014 20:08:57] "GET /application.js HTTP/1.1" 304 - 0.0056
20:08:57 web.1 | 127.0.0.1 - - [22/Oct/2014 20:08:57] "GET /application.css HTTP/1.1" 304 - 0.0063
20:09:13 web.1 | E, [2014-10-22T20:09:13.695412 #5880] ERROR -- : worker=0 PID:5916 timeout (16s > 15s), killing
20:09:13 web.1 | E, [2014-10-22T20:09:13.704183 #5880] ERROR -- : reaped #<Process::Status: pid 5916 SIGKILL (signal 9)> worker=0
20:09:13 web.1 | I, [2014-10-22T20:09:13.710805 #5923] INFO -- : worker=0 ready
It seems you are seeing production log, are you? if that is the case quiet_assets should be included in production too.
gem 'quiet_assets'

Resources