Last active
November 5, 2018 12:40
-
-
Save inspiretk/082e7b60bce061c23909a7af8d448869 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Go to https://www.jetbrains.com/pycharm/ and download your pycharm | |
Install pycharm | |
Go here for how to do your settings: pycharm odoo template coding https://www.youtube.com/watch?v=vytzDo33qdM https://github.com/mohamedmagdy/odoo-pycharm-templates | |
Download settings.jar https://github.com/mohamedmagdy/odoo-pycharm-templates | |
Open pycharm | |
File | Import Settings... > find the settings file > Ok | |
File | Invalidate Chaches / Restart... > Just Restart |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
odoo_add_qweb_template # add the main structure of the qweb report | |
<template id="UNIQUE_ID"> | |
<t t-call="report.html_container"> | |
<t t-call="report.internal_layout"> | |
<!-- <t t-call="report.external_layout"> --> | |
<div class="page"> | |
<h2>TITLE FOR YOUR REPORT</h2> | |
<!-- | |
Build your report here! | |
Do it in awesome way ;) | |
--> | |
</div> | |
</t> | |
</t> | |
</template> | |
odoo_button # add odoo button | |
<button name="button_method_name" type="object" string="ObjectButton"/> | |
odoo_button_box # Add button box on view | |
<div class="oe_button_box" name="expense_button_box"> | |
<button name="toggle_active" | |
type="object" | |
confirm="(Un)archiving a project automatically (un)archives its tasks and issues. Do you want to proceed?" | |
class="oe_stat_button" | |
icon="fa-archive"> | |
<field name="active" widget="boolean_button" options='{"terminology": "archive"}'/> | |
</button> | |
</div> | |
odoo_button_box # Add button box on view | |
<div class="oe_button_box" name="expense_button_box"> | |
<button name="toggle_active" | |
type="object" | |
confirm="(Un)archiving a project automatically (un)archives its tasks and issues. Do you want to proceed?" | |
class="oe_stat_button" | |
icon="fa-archive"> | |
<field name="active" widget="boolean_button" options='{"terminology": "archive"}'/> | |
</button> | |
</div> | |
odoo_data # Create the main tag | |
<?xml version="1.0" encoding="utf-8"?> | |
<odoo> | |
<data> | |
</data> | |
</odoo> | |
odoo_declare_qweb_reports # Add a declaration for new qweb report | |
<!-- QWeb Reports --> | |
<!-- NAME & FILE_NAME should be the same --> | |
<report | |
id="UNIQUE_REPORT_ID" | |
model="MODEL_WHERE_THE_REPORT_WILL_BE_PRINTED" | |
report_type="qweb-pdf" | |
string="LABEL" | |
name="NAME" | |
file="FILE_NAME" | |
/> | |
odoo_domain # Add domain to your field | |
domain="[('', '=', ), ]" | |
odoo_field # add commun field on view | |
<field name="name"/> | |
odoo_field_binary # add new field to type binary | |
new_field = fields.Binary(string="", ) | |
odoo_field_boolean # Add new field to type boolean | |
is_new_field = fields.Boolean(string="", ) | |
odoo_field_char # add new field to type char. A string of limited length. The required size parameter determines its size. | |
#fields.char( | |
# 'Field Name', | |
# size=n [, | |
# Optional Parameters]), # where ''n'' is an integer. | |
# eg 'city' : fields.char('City Name', size=30, required=True), | |
new_field = fields.Char(string="", required=False, ) | |
odoo_field_date # add new field to type date | |
new_field = fields.Date(string="", required=False, ) | |
odoo_field_datetime # add new field to type datetime | |
new_field = fields.Datetime(string="", required=False, ) | |
odoo_field_float # add new field to type float | |
new_field = fields.Float(string="", required=False, ) | |
odoo_field_html # add new field to type HTML | |
new_field = fields.HTML(string="", ) | |
odoo_field_integer # add new field to type integer | |
new_field = fields.Integer(string="", required=False, ) | |
odoo_field_many2one # | |
new_field_id = fields.Many2one(comodel_name="", string="", required=False, ) | |
odoo_field_many2many | |
new_field_ids = fields.Many2many(comodel_name="", relation="", column1="", column2="", string="", ) | |
odoo_field_one2many | |
new_field_ids = fields.One2many(comodel_name="", inverse_name="", string="", required=False, ) | |
odoo_field_selection | |
state = fields.Selection(string="", selection=[('', ''), ('', ''), ], required=False, ) | |
odoo_field_text # A text field with no limit in length. | |
new_field = fields.Text(string="", required=False, ) | |
odoo_field_state # Add state field with progressbar on view | |
<field name="state" widget="statusbar" statusbar_visible=""/> | |
odoo_field_title # Add title for form view | |
<div class="oe_title"> | |
<label for="name" class="oe_edit_only"/> | |
<h1> | |
<field name="name" placeholder="......"/> | |
</h1> | |
</div> | |
odoo_form # Create form view | |
<record id="" model="ir.ui.view"> | |
<field name="name"></field> | |
<field name="model"></field> | |
<field name="arch" type="xml"> | |
<form string=""> | |
<sheet> | |
<group> | |
<field name="name"/> | |
</group> | |
</sheet> | |
</form> | |
</field> | |
</record> | |
odoo_form_header # Add form's header with 'state' and button | |
<header> | |
<button name="" string="" class="oe_highlight" states="" type=""/> | |
<field name="state" widget="statusbar" statusbar_visible="" statusbar_colors="{'KEY_IS_STATE':'VALUE_IS_COLOR'}"/> | |
</header> | |
odoo_form_inherit # Inherit existing form view | |
<!-- Inherit Form View to Modify it --> | |
<record id="" model="ir.ui.view"> | |
<field name="name"></field> | |
<field name="model"></field> | |
<field name="inherit_id" ref=""/> | |
<field name="arch" type="xml"> | |
<xpath expr="//field[@name='name']" position=""> | |
<!-- Add your fields or attributes here --> | |
</xpath> | |
</field> | |
</record> | |
odoo_form_social # add social messaging and followers | |
<div class="oe_chatter"> | |
<field name="message_follower_ids" widget="mail_followers"/> | |
<field name="message_ids" widget="mail_thread"/> | |
</div> | |
odoo_kaban # create kaban view | |
<record id="" model="ir.ui.view"> | |
<field name="name"></field> | |
<field name="model"></field> | |
<field name="arch" type="xml"> | |
<kanban> | |
<field name="name"/> | |
<templates> | |
<t t-name="kanban-box"> | |
</t> | |
</templates> | |
</kanban> | |
</field> | |
</record> | |
odoo_menuitem_action # Create new menu item for action | |
<menuitem id="UNIQUE_ID_categ" name="" parent="" action="" sequence=""/> | |
odoo_menuitem_categ # Create new menu item for categorisation | |
<!-- This Menu Item Must have a parent --> | |
<menuitem id="UNIQUE_ID_categ" name="" parent="" sequence=""/> | |
odoo_menuitem_root # Create new menu item in the upper bar | |
<!-- This Menu Item will appear in the Upper bar, That's why It needs NO parent or action --> | |
<menuitem id="MODULE_NAME_root" name="" sequence=""/> | |
odoo_notebook # Add notebook and a page | |
<notebook> | |
<page string=""> | |
<group> | |
<field name=""/> | |
</group> | |
</page> | |
</notebook> | |
odoo_page # add a page | |
<page string=""> | |
<group> | |
<field name=""/> | |
</group> | |
</page> | |
odoo_qweb_table # Add main structure of the qweb table | |
<table class="table table-condensed"> | |
<thead> | |
<tr> | |
<th>HEAD_1</th> | |
<th class="text-right">HEAD_2</th> | |
<th class="text-right">HEAD_3</th> | |
<th class="text-right">HEAD_4</th> | |
</tr> | |
</thead> | |
<tbody> | |
<tr t-foreach="o.OBJECTS" t-as="OBJECT"> | |
<t t-if="len(taxline['level']) > 5"> | |
<t t-set="style" t-value="'font-weight:normal;'"/> | |
</t> | |
<t t-if="not len(taxline['level']) > 5"> | |
<t t-set="style" t-value="'font-weight:bold;'"/> | |
</t> | |
<td> | |
<span t-att-style="style" t-esc="taxline['level']" style="color:white;"/> | |
<span t-att-style="style" t-if="taxline['code']" t-esc="taxline['code']"/> | |
<span t-att-style="style" t-esc="taxline['name']"/> | |
</td> | |
<td class="text-right"><span t-att-style="style" t-esc="taxline['debit']"/></td> | |
<td class="text-right"><span t-att-style="style" t-esc="taxline['credit']"/></td> | |
<td class="text-right"> | |
<span t-att-style="style" t-esc="formatLang(taxline['tax_amount'], currency_obj=res_company.currency_id)"/> | |
</td> | |
</tr> | |
</tbody> | |
</table> | |
odoo_search # Create search view | |
<record id="" model="ir.ui.view"> | |
<field name="name"></field> | |
<field name="model"></field> | |
<field name="arch" type="xml"> | |
<search string=""> | |
<field name="name" string="string" domain="[()]"/> | |
</search> | |
</field> | |
</record> | |
odoo_security_category # Add new security category | |
<record id="" model="ir.module.category"> | |
<field name="name"></field> | |
<field name="sequence" eval="1"/> | |
</record> | |
odoo_security_group # Create new group, then assign new permission | |
<record id="" model="res.groups"> | |
<field name="name"></field> | |
<field name="category_id" ref=""/> | |
<field name="implied_ids" eval="[(4, ref('base.group_user'))]"/> | |
</record> | |
odoo_security_rule # Create new security rule | |
<record id="" model="ir.rule"> | |
<field name="name"></field> | |
<field ref="model_name_of_model" name="model_id"/> | |
<field name="domain_force">[('', '', )]</field> | |
<field name="perm_write" eval="1"/> | |
<field name="perm_create" eval="1"/> | |
<field name="perm_read" eval="1"/> | |
<field name="perm_unlink" eval="1"/> | |
<!-- You can attach this rule to a specific group, Or make it Global --> | |
<field name="groups" eval="[(4, ref('group_id'))]"/> | |
<!--<field name="global" eval="1"/> --> | |
</record> | |
odoo_tree # Create Tree View | |
<record id="" model="ir.ui.view"> | |
<field name="name"></field> | |
<field name="model"></field> | |
<field name="arch" type="xml"> | |
<tree string=""> | |
<field name="name"/> | |
</tree> | |
</field> | |
</record> | |
odoo_tree_inherit # Inherit existing tree view | |
<record id="" model="ir.ui.view"> | |
<field name="name"></field> | |
<field name="model"></field> | |
<field name="inherit_id" ref=""/> | |
<field name="arch" type="xml"> | |
<xpath expr="//field[@name='name']" position=""> | |
<!-- Add new fields here --> | |
</xpath> | |
</field> | |
</record> | |
odoo_view_action # Create view action | |
<record id="" model="ir.actions.act_window"> | |
<field name="name"></field> | |
<field name="type">ir.actions.act_window</field> | |
<field name="res_model"></field> | |
<field name="view_mode">tree,form</field> | |
<field name="help" type="html"> | |
<p class="oe_view_nocontent_create"> | |
<!-- Add Text Here --> | |
</p><p> | |
<!-- More details about what a user can do with this object will be OK --> | |
</p> | |
</field> | |
</record> | |
odoo_wkf # Add workflow | |
<record id="" model="workflow"> | |
<field name="name"></field> | |
<field name="osv"></field> | |
<field name="on_create">True</field> | |
</record> | |
odoo_wkf_activity # Add new activity | |
<record id="" model="workflow.activity"> | |
<field name="wkf_id" ref=""/> | |
<!--<field name="flow_start">True</field>--> | |
<!--<field name="flow_stop">True</field>--> | |
<field name="name"></field> | |
<field name="kind">function</field> | |
<field name="action">METHOD_NAME()</field> | |
</record> | |
odoo_wkf_transistion # Add new transistion to an existing workflow | |
<record id="" model="workflow.transition"> | |
<field name="act_from" ref=""/> | |
<field name="act_to" ref=""/> | |
<field name="signal"></field> | |
</record> | |
odoo_xpath # Add the structure of xpath | |
<xpath expr="//field[@name='name']" position=""> | |
<!-- Add your fields or attributes here --> | |
</xpath> | |
odoo_xpath_attributes # Add the structure of xpath with attributes | |
<xpath expr="//field[@name='']" position="attributes"> | |
<attribute name="required">1</attribute> | |
<attribute name="readonly">1</attribute> | |
</xpath> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# menuitem name is the Menu Name that you cick on. It calls action from act_window id action_myconference, with view_ode tree view. | |
# res_model model to present views for myonferences.myconf (found from .py file in main folder). res = resource model. If act_window | |
# has src_model = "", this goes in the Action menu of the page. If not, it goes to the main menu up top. | |
# https://stackoverflow.com/questions/44673341/what-are-the-difference-between-res-model-src-model-and-model-terminology-in-od# | |
<?xml version="1.0"?> | |
<odoo> | |
<!-- Action to open To-do Task list --> | |
<act_window id="action_myconference" | |
name="Manage Conferences" | |
res_model="myconferences.myconf" | |
view_mode="tree,form" /> | |
<!-- Menu item to open To-do Task list --> | |
<menuitem id="menu_myconference" | |
name="Oil" | |
action="action_myconference"/> | |
</odoo> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment