Unable to install new module in OpenERP 6 - module

I have developed a module 'newpatient' which I am unable to install through a Compressed file folder. I have read the OpenERP dev. book as well as this blog on creation of new module. When installing after a copy-paste job from this blog, the module 'notebook' gets installed & working. I apply the same steps (Even checked the code n times now) to my module but still CAN'T get it installed. Even though I get the msg on ERP client ' Modules installed', the module is not in the 'Modules' list. What could be possibly wrong?
Here's the code. the newpatient.py file:
from osv import fields, osv
import time
class newpatient(osv.osv):
_name = "Newpatient"
_description = "Creating new patient"
_columns = {'name':fields.char('Name',size=30,required=True),
'address':fields.char('Address',size=50,required=True),
}
newpatient()
The __init__.py file:
import newpatient
The __openerp__.py file:
{
"name" : "Newpatient",
"version" : "1.0",
"author" : "K Y",
"category" : "Generic Modules/Others",
"depends" : ["base"],
"init_xml" : [newpatient_view.xml],
"demo_xml" : [],
"update_xml" : [],
"installable": True,
"active": False
}
Really stuck. Would appreciate some help.

I'm not sure but try with
_name="newpatient"
To check if the module is installed, go to "Administration / Customisation / Database Structure" and look for newpatient (because it could be your view that isn't well formated)
Tell me if it works...

Related

Issues creating Admin module controller on Prestashop

The controller for URI "/modules/mm_custom/deleter" is not callable. Class "Mm_Custom\Controller\ConfigureController" does not exist.
[InvalidArgumentException 0]
That's what I get after 3 days trying to set an AdminController on my Prestashop module.
Here is the controller "configureController.php":
<?php
// modules/mm_custom/src/controller/configureController.php
namespace Mm_Custom\Controller;
use Symfony\Component\HttpFoundation\Response;
use PrestaShopBundle\Controller\Admin\FrameworkBundleAdminController;
class ConfigureController extends FrameworkBundleAdminController
{
public function deleteAction()
{
return new Response('Hello');
}
}
Here is the routes.yml :
# modules/mm_custom/config/routes.yml
delete:
path: mm_custom/deleter
methods: [GET]
defaults:
_controller: 'Mm_Custom\Controller\ConfigureController::deleteAction'
Here is the composer.json at the module folder root:
{
"name": "sixten/mm_custom",
"description": "A tool developped to allow your customers to easily and efficiently custom your product.",
"autoload": {
"psr-4": {
"Mm_Custom\\Controller\\": "src/Controller/"
}
},
"config": {
"prepend-autoloader": false
},
"type": "prestashop-module"
}
If the problem is not from a mistake in the code himself, it might comes from the fact that I couldn't run the composer dumpautoload console command in the module's folder directly because the website is online on a ftp server.
I put the composer.json somewhere else on my computer, ran the command and copy/paste the composer.json and the vendor file I get in the ftp's module folder. Maybe it's not the good way to do it ?
Thanks for reading me !

Creating custom Emmets / Snippets

I have this specific use case where from my extension, I want users to be able to type !myamltemplate in a yaml file and be able to load in a designated yaml template for users to start editing. This is similar to the ! Emmet that VSCode currently supports.
So is there a way to create my custom Emmets and if not what's the best way to implement this use case.
Edit1:
I see we have this doc on how to use custom Emmets but the example shows using a html one.
Can this be used for yaml files as well ?
Can the yaml template be loaded from a file
I would like to also have diagnostics and validations on the user edited values in yaml file
Edit2:
I was able to achieve my use case with Snippets
// package.json
"contributes": {
"snippets": [
{
"language": "yaml",
"path": "./snippets.json"
}
]
}
// snippets.json
{
"yaml": {
"prefix": "!mytemplate",
"body": [
"name: install and configure DB",
"hosts: testServer",
"vars:",
" oracle_db_port_value : 1521",
"tasks:",
" -name: Install the Oracle DB",
" yum: <code to install the DB>",
" ",
" -name: Ensure the installed service is enabled and running",
"service:",
" name: <your service name>"
],
"description": "Creates a yaml definition from template"
}
}
Questions
Is this the best approach for this use case ?
Where can I find samples for .tmSnippets as described herein Using TextMate snippets
Thank you!

Vue Dev Tools - does not working "Open in Editor" button. How to fix this?

I am trying to setup this feature from tutorial:
https://github.com/vuejs/vue-devtools/blob/master/docs/open-in-editor.md
but got an error
"C:\Users\User\AppData\Local\Programs\Microsoft" не является внутренней или внешней, исполняемой программой или пакетным файлом.
Could not open LeadsEdit.vue in the editor.
The editor process exited with an error: (code 1).
To specify an editor, sepcify the EDITOR env variable or add "editor" field to your Vue project config.
in my vue.config.js (project based on vue cli 3.0)
const openInEditor = require('launch-editor-middleware');
module.exports = {
configureWebpack: {
devtool: 'source-map',
},
devServer: {
before(app) {
app.use('/__open-in-editor', openInEditor('code'))
}
}
}
UPD. Without this code the problem still remain.
UPD2.
I am trying to set EDITOR variable in .env file
VUE_APP_EDITOR=/c/Users/User/AppData/Local/Programs/Microsoft VS Code/Code.exe
Or with vue.config.js
const openInEditor = require('launch-editor-middleware');
module.exports = {
configureWebpack: {
devtool: 'source-map',
},
devServer: {
before(app) {
app.use('/__open-in-editor', openInEditor('/c/Users/User/AppData/Local/Programs/Microsoft VS Code/Code.exe'))
}
}
}
But the problem still remains
What may cause this problem?
How can I fix this error?
It seems like dev tools is trying to open the editor executable C:\Users\User\AppData\Local\Programs\Microsoft, which is most likely wrong. The default install location on Windows 10 is (to the best of my knowledge) C:\Users\User\AppData\Local\Programs\Microsoft VS Code\Code.exe.
launch-editor tries to find the editor from the currently running processes and falls back to the environment variables EDITOR and VISUAL (see https://github.com/yyx990803/launch-editor#why), so you can probably set the EDITOR env var to the correct path.
Probably, there are quotes missing around the editor config so it gets cut off at the first space. I don't really know where the path comes from, either you configured it via environment variables or in your vue project config.
Based on the information in your updated question, you could try this:
I don't know where the variable name VUE_APP_EDITOR comes from, but I guess it should be EDITOR. Change it to EDITOR and see what happens
The path you are using looks wrong (i.e. not like a windows path). Try c:/Users/User/AppData/Local/Programs/Microsoft VS Code/Code.exe instead.
E.g.:
app.use('/__open-in-editor', openInEditor('c:/Users/User/AppData/Local/Programs/Microsoft VS Code/Code.exe'))
You can test whether the path is correct by starting a cmd shell and entering the path. If it is correct, VS Code should open. If not, it will tell you the path was not found.
Also have a look at this, there is some more on how to integrate vue devtools & VS Code: https://gist.github.com/moreta/d3989686b6a1f2416b5802cac8df16b4

Custom Module is not installed on the kurento media server but appears on the kurento-media-server --list

I am trying to develop a custom module for the Kurento-media-server but i have find two roadblocks,following the instructions on the documentation i have been able to:
create the custom module folder with the command:
kurento-module-scaffold.sh <module_name> <output_directory>
and them generate the files with:
cmake .. -DCMAKE_INSTALL_PREFIX=/usr && make && sudo make install
i have added two lines to the bgRemoverFilterOpenCVImpl on the /src/server/objects/bgRemoverFilterOpenCVImpl.cpp file so the filter adds a hello world text to the image.
void bgRemoverFilterOpenCVImpl::process (cv::Mat &mat)
{
cv::Point textOrg(50, 50);
putText( mat, "Hello World", textOrg, 1, 2, cv::Scalar(0, 0, 0) );
}
i them build the .deb file with debuild -us -uc and install it successfully so that when i run the kurento-media-server --list command i see my new custom module on the list:
....
bgRemoverFilter
bgremoverfilter.bgRemoverFilter
....
i them generated the js client code with the command cmake .. -DGENERATE_JS_CLIENT_PROJECT=TRUE and added the js generated folder to my node.js project using npm link for test purposes i am using the Kurento-Chroma project from the Kurento-node-repository so i have modified it to register my module and to create my custom filter instead of the chroma one. for this made changes to the server.js file on lines 28 and 249:
...
//kurento.register('kurento-module-chroma');
kurento.register('kurento-module-bgremoverfilter');
...
pipeline.create('bgremoverfilter.bgRemoverFilter', options, function(error, filter) {
if (error) {
return callback(error);
}
return callback(null, webRtcEndpoint, filter);
});
the node application runs correctly but when i start the loopback to get my videofeed with the filter applied it sends this error message:
Error message from server: Exiting with error SyntaxError: Module 'bgRemoverFilter' is not installed in the Kurento Media Server
despite the module being loaded on kurento-media-server --list the app cant create the filter object, i thought this was a naming issue so when i create a one word name custom module like "harel" to avoid camel case naming problems and install it i get on the list:
...
harel
harel.harel
...
and when trying to create and use this filter on the same kurento-chroma example i get a different error:
SyntaxError: sink param should be a MediaElement, not harel
at ChecktypeError (/home/ubuntu/www/kurento-chroma/node_modules/kurento-client/lib/checkType.js:32:10)
at checkMediaElement (/home/ubuntu/www/kurento-chroma/node_modules/kurento-client-core/lib/abstracts/MediaElement.js:1082:11)
at checkType (/home/ubuntu/www/kurento-chroma/node_modules/kurento-client/lib/checkType.js:84:25)
at WebRtcEndpoint.MediaElement.connect (/home/ubuntu/www/kurento-chroma/node_modules/kurento-client-core/lib/abstracts/MediaElement.js:489:3)
at connectMediaElements (/home/ubuntu/www/kurento-chroma/server.js:260:20)
at /home/ubuntu/www/kurento-chroma/server.js:197:17
at /home/ubuntu/www/kurento-chroma/server.js:254:20
at callback2 (/home/ubuntu/www/kurento-chroma/node_modules/kurento-client/lib/KurentoClient.js:527:7)
at /home/ubuntu/www/kurento-chroma/node_modules/kurento-client/lib/KurentoClient.js:385:7
at Object.dispatchCallback [as callback] (/home/ubuntu/www/kurento-chroma/node_modules/kurento-jsonrpc/lib/index.js:613:9)
so, am i missing something on the installation process? i suspect there is something wrong with the JS generated code in the first case.
on the second case when using a single word name, why does this work? the app is able to create the filter but then fails when trying to connect it to the webrtcEndPoint
i have look at all the questions and threads i could find but did'nt get any answers. here is a repository with my custom filter code including the generated js library
please help, if more clarifications or details are needed request them.
UPDATE
i wrote to one of the kurento developers that recommended i use kurento-media-server --version to get the actual list of loaded modules, this is a followup to that:
kurento-media-server --version returns:
Version: 6.7.0~1.g6ebaa27
Found modules:
Module: 'backgroundremoval' version '0.0.1~3.g045ef96'
Module: 'bgremoverfilter' version '0.0.1~0.g3a1e793'
Module: 'chroma' version '6.6.1~3.g6df8f1d'
Module: 'core' version '6.6.3'
Module: 'elements' version '6.6.3'
Module: 'filters' version '6.7.0~1.g0314843'
Module: 'harel' version '0.0.1~0.gaec7e6d'
so yes backgroundremoval, bgremoverfilter and harel are the custom modules i have created and they are on the list.
i still dont know why when i use a camelcase name as bacgroundRemoverFilter i cant get the module to load in javascript althoug the generated code is loaded on my node.js project when it tries to create the filter the app sends the "module not installed error"
so i started using all minus names, for my module "harel" this gets loaded with no problems and when i try to create the media element with
pipeline.create('harel.harel')...
the filter gets created but them fails when a try to connect it to a webrtcEnpoint with
filter.connect(webRtcEndpoint, function(error) {
if (error) {
return callback(error);
}
return callback(null);
});
it returns the error: SyntaxError: sink param should be a MediaElement, not harel
turns out that error is send by /node_modules/kurento-client-core/lib/abstracts/MediaElement.js:489:3 when calling a function Checktype
checkType('MediaElement', 'sink', sink, {required: true});
so i added a console.log() after the filter its created to see what was different between the chroma filter and my custom filter, this is the result:
harel {
domain: null,
_events:
{ removeListener: [Function],
newListener: [Function],
_describe: [Function: bound emit],
_rpc: [Function: encodeRpc],
release: { [Function: bound onceWrapper] listener: [Function] } },
_eventsCount: 5,
_maxListeners: undefined,
id: 'ad5e2447-3801-4d96-81b4-c40390b16248_kurento.MediaPipeline/18e8c6b9-df88-4d52-851c- 8c664a26ee3d_harel.harel' }
ChromaFilter {
domain: null,
_events:
{ removeListener: [Function],
newListener: [Function],
_describe: [Function: bound emit],
_rpc: [Function: encodeRpc],
release: { [Function: bound onceWrapper] listener: [Function] } },
_eventsCount: 5,
_maxListeners: undefined,
id: '97f370b5-81ae-45e1-a979- dab6c1c4cd28_kurento.MediaPipeline/06658282-67bf-47bc- b006-9f0dbae01767_chroma.ChromaFilter' }
both objects have the same properties excetp for the id. so how come the same function works with ChromaFilter bu not with harel if the object passed is almost the same. This is were i am now. will keep digging.
The problem with my process was that i used npm link to add the generated client-js code to my node.js app. For that to work i had to install the kurento-client package on the client-js folder and when my app ran it will generate the custom plugin with a different kurento-client than the one it was using.
so even thought the Chroma-filter and my harel module looked the same they were from two different kurento-client classes.
instead of using npm-link i just copied the generated js-client code inside my node-modules folder and that did the trick.
hope this is usefull to people that find this error.

Sublime text 3, Package Controll - cant install packages

I realized like a week ago that I cannot install any new packages via Package Control. I tried everything even reinstalling sublime, while cleaning all files /Library/Application Support/ everything. Still the same problem. Any ideas?
ignored packages updated to: ["Emmet", "Vintage"]
reloading settings Packages/User/Package Control.sublime-settings
reloading settings Packages/User/Preferences.sublime-settings
Package Control: Error downloading package. HTTP exception InvalidCertificateException (Host codeload.github.com returned an invalid certificate ([SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:548))) downloading https://codeload.github.com/sergeche/emmet-sublime/zip/master.
error: Package Control
Unable to download Emmet. Please view the console for more details.
ignored packages updated to: ["Vintage"]
reloading settings Packages/User/Package Control.sublime-settings
reloading settings Packages/User/Preferences.sublime-settings
reloading settings Packages/User/Preferences.sublime-settings
You can change the precedence of the downloader in ~/.config/sublime-text-3/Packages/User/Package Control.sublime-settings.
"downloader_precedence":
{
"linux":
[
"urllib",
"curl",
"wget"
],
"osx":
[
"curl",
"urllib"
],
"windows":
[
"wininet"
]
},
Changing urllib to curl has worked for me.
For OSX:
bhanu's answer is correct but my "Package Control Settings - User" file was not at that exact location. More general instructions:
Open Command Palette (Cmd+Shift+P on Mac)
Type Package Control Settings
Open 'Package Control Settings - Default' and search for downloader_precedence
It probably looks like this - note the default osx downloader is "urllib":
"downloader_precedence": {
"windows": ["wininet"],
"osx": ["urllib"],
"linux": ["urllib", "curl", "wget"]
},
You can't actually edit the Default. Override this setting by going to Command Palette > 'Package Control Settings - User'
Copy-paste the snippet above into the User file (correct indentation and add comma after existing settings if needed) and make "curl" the first osx downloader:
"downloader_precedence": {
"windows": ["wininet"],
"osx": ["curl", "urllib"],
"linux": ["urllib", "curl", "wget"]
},