Unable to add yii extension to my project? - yii

is their any common method to add extension to my yii project?
how can i add extension to my yii please explain the steps

"Application Configuration" plays important role when installing extensions. By default this configuration will be in a php file (i.e protected/config/main.php )
Yii is a framework, not an application ... so you need to edit the php code yourself.
1) some people develops extensions as Yii components where you need to add these extensions into "components" configuration.
2) Some people develops extensions as Yii modules, you need to add these modules into "modules" configuration.
3) Some people develops behaviors, where you need to edit your Controller or model classes to add these behaviors.
there are many other types of extensions as well... you need to follow the guidelines provided by extension developer.

Related

Is it possible to integrate Webpack/VueJS with the Odoo Framework (v12)?

I'd like to integrate VueJS through WebPack in one of my custom Odoo modules, and have it start up automatically when I launch Odoo-bin.
Does anyone have a solution?
Is it even possible?
I know you can include VueJS as a simple .JS file in the module's template, but that means I can't use the .vue components supported by WebPack.
I also read that Odoo has its own JS framework, but I couldn't find good tutorials/documentation for it.
EDIT: To anyone that might be wondering how I solved this, here's what I did:
I initialized a package.json file in the root of my Odoo folder using npm init. I added a start script to the package that launches webpack and bundles all vue components in myAddons folder (where I store my custom modules), then launches Odoo through the python odoo-bin ... command. All that's left is to use npm start to start it all up.
This way, the vue components get bundled into single JS files, that I then add to the templates of my modules. This has a small inconvenient in that the first bundle has to be done manually in order to know which JS files need to be imported to the templates. Also, i'm still trying to figure out how to bundle the components of every single module separately. Will update this once I find a proper way to do it. ...Hopefully.
By default, odoo frontend part is heavily built upon backbone, jquery, underscore. If you want to use any other JS library, you have to make sure the compatibility in between them. The odoo backend parts of JS functionalities are written under web module can be found in odoo/addons/web/static/src/js directory in odoo community codes. The ecommerce/website part is under website* modules.
Along with the fact that the Odoo JS API documentation is basically non-existent (as of the time I am posting this) .. I would add the fact that its going to be like working with a moving target compared to calling Odoo's JSON-RPC API directly since their JSON-RPC API changes very little over different versions of Odoo.
Moreover, making JSON-RPC API calls with Axios is extremely simple. So just go directly to the server's JSON-RPC API from your Vue project.
This is what I am doing with at odooinvue.org which is basically a Vue project that uses Odoo in the back-end. That project is designed specifically as a resource for Vue developers that are trying to use Odoo in the back-end but have difficulty because they are new to Odoo development.
I suggest trying #StartupGuy's odooinvue, which is really nice.
With Odoo 14 they created a new modern frontend framework: Owl framework.
I have not tried it myself.

How to use external API within Yii2 application?

I'd like to use external API within Yii2 application.
I couldn't find any tutorial about it.
I'd like to know how to do it in a decent way - do I have to build separate module to use this API or organize it in another way?
Any simple examples would be appreciated.
I'd like to build a tool, to use external API of other online application. To be straightforward - I'd like to import invoices etc. from external accounting system to my Yii2 application. This accounting system has API and I wonder how to use it properly inside Yii2 application.
The perfect solution for now would be to install ready module like "yii2-accountingsystemname-api", then I put some login and password for this system and I'm good to go - I can use it inside my application like:
getInvoices->all() etc.
After doing a bit of research I have found this guide that explains how to use third-Party code with the Yii2 application:
http://www.yiiframework.com/doc-2.0/guide-tutorial-yii-integration.html
This is a excerpt from that article:
Using Third-Party Libraries in Yii To use a third-party library in a
Yii application, you mainly need to make sure the classes in the
library are properly included or can be autoloaded.
Using Composer Packages Many third-party libraries are released in
terms of Composer packages. You can install such libraries by taking
the following two simple steps:
modify the composer.json file of your application and specify which
Composer packages you want to install. run composer install to install
the specified packages. The classes in the installed Composer packages
can be autoloaded using the Composer autoloader. Make sure the entry
script of your application contains the following lines to install the
Composer autoloader:
// install Composer autoloader
require(__DIR__ . '/../vendor/autoload.php');
// include Yii class file
require(__DIR__ . '/../vendor/yiisoft/yii2/Yii.php');
I suggest that you read the article because there is lots of other valuable information that may help you, and possibly better suit your needs than what I copied above.
Best of luck with your project!

Is there any difference between modules & app in odoo

I have installed odoo ver8.0 in my local machine.
I just want to know:
Is there any difference between modules & apps in odoo. If yes what is it?
Also i want to know the difference between the links 'Local modules' & 'Apps' in the left menu of odoo
Difference between the links 'Local modules' & 'Apps' in the left menu:
The "Apps" are online (it doesn't work to me because I use the OCA version) and the "Local modules" you can install them offline. What I do is install the disable_openerp_online module, in order to hide the "Apps" menu, because you can install your own local "Apps" from the "Local modules" menu as well.
The main difference between "Application" and "Module":
It’s common to hear about Odoo modules and applications. But what
exactly is the difference between them? Modules are building blocks of
Odoo applications. A module can add or modify Odoo features. It is
supported by a directory containing a manifest or descriptor file
(named __openerp__.py) and the remaining files that implement its
features. Sometimes, modules can also be referred to as “add-ons.”
Applications are not different from regular modules, but functionally,
they provide a central feature, around which other modules add
features or options. They provide the core elements for a functional
area, such as accounting or HR, around which other modules add
features. Because of this, they are highlighted in the Odoo Apps menu.
Modules are individual pieces/directories of code that extend introduce functionality. An app is a collection of modules, usually with a configuration option, that represent the same purpose (for example: Sale or Purchase).
https://www.odoo.com/forum/help-1/question/what-is-the-difference-between-an-app-an-addon-and-a-module-56285

Combine ASP.NET MVC4 bundling and require.js javascript module dependency

Is there a way to use the bundle functionality of ASP.NET MVC4 and the JavaScript module dependency feature of require.js
I want to load all my modules with ASP.NET MVC4 bundle features and use require.js to organize the relationships between them.
The problem is that require.js doesn't find the needed dependencies while all the modules are loaded via bundles.
I don't want require.js to go and try to load files asynchronous I just want it to use already loaded modules via bundles.
What should the main file look like in this case.
I Have the following structure in _Layout.chtml
#Scripts.Render("~/bundles/jquery",
"~/bundles/jqueryval",
"~/bundles/jslibs",
"~/Scripts/require.js",
"~/bundles/tjProductivity",
"~/Scripts/tjpApp/main.js"
)
#RenderSection("scripts", required: false)
And then in each scripts section I want to load all modules that will be used for that page via Bundle.config but let require.js manage dependencies between them.
It's possible, use almond.js, from the creator of RequireJS.
The only shortcoming is that you have to always add the module names on your modules...
A good reference on integrating requirejs and mvc:
http://www.codeproject.com/Articles/614507/Modular-Javascript-Using-Require-Js
and
http://www.stefanprodan.eu/2012/09/intro-requirejs-for-asp-net-mvc/
- note that it doesn't using bundling.
This article shows you how to integrate RequireJS in a ASP.NET MVC 4
project and structure the JavaScript code in such a manner that any C#
programmer can understand and use it without advanced js programming
skills.

Creating a Cocoa Framework & using it from another Cocoa project

OK, I know this question seems pretty easy to answer, or maybe documented, but I'm honestly 100% confused around the subject, with effects as... silly as submitting an application for review by Apple and then realizing (by the logs they sent me back), that the Framework wasn't there (actually, it was... but my Cocoa app was looking for it elsewhere).
Ok, so... let's say I have a framework with like 100 different classes I mostly use (which I do have), what settings should I use if I want to "bundle" my Framework with my apps (and copy it in the framework folder of the app bundle)?
Build Settings -> Installation Directory? (of the Framework)
Build Settings -> Header Search Paths? (of the App)
Build Settings -> Library Search Paths? (of the App)
Build Settings -> Framework Search Paths? (of the App)
use #rpath? and how?
anything else?
Given that I mostly have issues "linking" my frameworks to my apps (the framework compiles great, but there may be a runtime error occasionally when the app using it tries to run (which I... occasionally manage to solve - but without actually knowing how... lol)), what would you suggest?
Third party frameworks should be included with the app in a Frameworks directory of the app bundle.
Add a new copy files build phase and specify the Frameworks directory, then add your frameworks to this directory:
You may also need to tell Xcode where the frameworks are by adding a Framework Search Path like "$(SRCROOT)/MyFrameworks".