Showing posts with label OpenERP. Show all posts
Showing posts with label OpenERP. Show all posts

Sunday, May 5, 2013

Rails 4

Rails just keeps on changing. Both Rails 3 and 4, as well as Ruby 1.9 and 2.0, bring hundreds of improvements, including new APIs and substantial performance enhancements. The fourth edition of this award-winning classic has been reorganized and refocused so it’s more useful than ever before for developers new to Ruby and Rails.

Rails 4 will only support Ruby 1.9.3+ versions.

Upgrading from Rails 3.2 to Rails 4.0 : 

If you want to upgrade your rails 3 application in rails 4, then you need to do changes in your rails application. If your application is currently on any version of Rails older than 3.2.x, you should upgrade to Rails 3.2 before attempting one to Rails 4.0 and do the changes in... 

Gemfile : 

Rails 4.0 removed the assets group from Gemfile. You'd need to remove that line from your Gemfile when upgrading. In Rails 4.0, several features have been extracted into gems. You just add the extracted gems to your Gemfile to bring the functionality back.     
  • Hash-based & Dynamic finder methods
  • Mass assignment protection in Active Record models.
  • ActiveRecord::SessionStore
  • Active Record Observers
  • Active Resource
  • Action Caching
  • Page Caching
  • Sprockets
  • Performance tests

Action Mailer : 
No changes  

Action Support: 
Rails 4.0 removes the j alias for ERB::Util#json_escape since j is already used for ActionView::Helpers::JavaScriptHelper#escape_javascript. 

Action Pack:
 Rails 4.0 introduces ActiveSupport::KeyGenerator and uses this as a base from which to generate and verify signed cookies. Existing signed cookies generated with Rails 3.x will be transparently upgraded if you leave your existing secret_token in place and add the new secret_key_base. 
 # config/initializers/secret_token.rb
Myapp::Application.config.secret_token = 'existing secret token'
Myapp::Application.config.secret_key_base = 'new secret key base' 


vendor/plugins:
Rails 4.0 no longer supports loading plugins from vendor/plugins. You must replace any plugins by extracting them to gems and adding them to your Gemfile. If you choose not to make them gems, you can move them into, say, lib/my_plugin/* and add an appropriate initializer in config/initializers/my_plugin.rb.
 


Active Record:
Rails 4.0 has removed the identity map from Active Record, If you have manually enabled it in your application, you will have to remove the following config that has no effect anymore: config.active_record.identity_map.


The delete method in collection associations can now receive Fixnum or String arguments as record ids, besides records, pretty much like the destroy method does. Previously it raised ActiveRecord::AssociationTypeMismatch for such arguments. From Rails 4.0 on delete automatically tries to find the records matching the given ids before deleting them


Rails 4.0 has removed attr_accessible and attr_protected feature in favor of Strong Parameters. You can use the Protected Attributes gem to a smoothly upgrade path.


Rails 4.0 requires that scopes use a callable object such as a Proc or lambda:
scope:active,where(active: true)
#becomes
scope:active,->{where active: true}
 


Active Model:
Rails 4.0 has changed how errors attach with the ActiveModel::Validations::ConfirmationValidator. Now when confirmation validations fail, the error will be attached to :#{attribute}_confirmation instead of attribute.


Active Resource:
Rails 4.0 extracted Active Resource to its own gem.
 

Sprockets-rails :
assets:precompile:primary has been removed. Use assets:precompile instead.
 

Sass-rails:
asset_url with two arguments is deprecated. For example: asseurl("rails.png", image) becomes asset-url("rails.png")


Executables:
The script directory has been removed in favor of a new bin directory. This is where your app’s executables will live, and running rake rails:update:bin will put bundle, rake, and rails binstubs into your app’s bin directory. This change can be useful in development, especially on a machine with multiple Ruby versions and gems. You can use bin/rails instead of bundle exec rails to ensure you run your executables in the correct environment.

Wednesday, April 17, 2013

Odoo OpenERP 7 Hotel Management

Hotel Management module incorporates addresses key functionalities in hospitality industry. It includes following functions :

1.Room Reservations 
2.Transportation Management  
3.Restaurant Management   
4.Laundry Management   
5.Banquet Hall Booking    
  
Room Reservations (at Reception)  
This enables user to book room through walk-in enquiries/ and through web booking form.
 

Web Based Booking Form:
This enables user to book room through internet.Booking form is featured with Paypal and authorised .net integration




Transport Management
Management can maintain a fleet record for internal as well as third party service providers. Invoicing can be maintained with the instruction maintained at the time of room booking

Restaurant Management
Restaurant Management module not only maintain table orders but also efficiently maintain inventory at different locations. It is linked to KOT preparation as well. User can link restaurant bills with are occupied room no. so that payment can be received from the customer at the time of checkout. 


Laundry Management
Efficiently maintain billing and inventory movement for laundry requests. It maintains separate workflow for internal and Room wise laundry requests


Banquet Hall Booking
User can generate multiple quotation for each of the lead generated by marketing department with unlimited permutation combination of service / product offerings for various events.



Housekeeping Work Management
User can maintain / schedule various housekeeping works for each of the house keeper. similarly, We can maintain a track of repair / replacement request generated so far with expense made for it.


Thursday, April 11, 2013

Odoo OpenERP 7 Login using Google Accounts with OAUTH Module

This Blog Deals with Login in OpenERP with Google Account and Google App Domain Account details so that you need not to create user in OpenERP Manually.

Before Starting further discussion Install Following Module in Database: 
1. OAuth2 Authentication
2. Sign up with OAuth2 Authentication
3. Open-ID Authentication.
4. Sign Up
 

                    In this blog we will see how we can log into OpenERP Using your Google Id and Google APPS Domain.   

Login With Google Account:  
                             First of All Change Some General Setting under Settings>>Configuration >>General Settings  

                           Check Option Allow external users to sign up also specify Template for New User. What Ever User you specify here who's access rights will be applied to every new user created after login through Google Account ID.
 

 Also Check Activate the public portal option and restart Server with --db-filter option as  
 $: ./openerp-server -db-filter=Your_Database_Name (for manual start up of server) 

 
After Starting OpenERP Server with –-db-flter Option On OpenERP Login Screen you will see Other Login Options Available like Login in with Google,Google APP Domains,Launchpad,Open-ID.

 Login in With Google Option: 

Before Using this option we need to get Client Id from Google API Console. Login to Google API Console and Create New Project Over there. you will get Client ID and also set Up Redirect URL to your local host (Note: I am running my OpenERP at portal 8077).

Now in OpenERP under Settings>>Users>>Oauth Providers Edit Google Oauth Option and Specify Client Id you get from Google API console. Also Check Allowed Check Box and Keep other things as it is.

On Login Screen Click on Login In With Google button which will Redirect you to Google login screen enter your Google credentials and grant access to OpenERP. 


After Allowing Access you will be Redirect to OpenERP System . 


Login With Google APP Domain: 
Go to Settings>>Users>>Users Open any User Record and then Enter Open-ID Details of that User. Here Open-ID URL is Google App Domain URL and Open-ID Email is Email id of User on that Domain.


Now on login screen select Google App Login option here specify Google App Domain you want to login with like pragtech.co.in or example.net and then click on Log in button. 

You will be redirected to Domain which you entered in Google App Domain. 
Enter your user-name & Password and then Click on Allow button to grant permission. After successful login you will be redirect to OpenERP System.

Difference between Google Login and Google App Domain login is that in Google login User is created automatically in system while in Google App login we have to assign Open-ID URL and Email Id to existing user . In Pragmatic we have created feature by which user is created automatically in Google App Domain Login also.


Odoo OpenERP 7 Medical Hospital Healthcare Management


 

We are please to annouce the upgrade of the OpenERP Medical module for OpenERP V7. Here are some screenshots of it.

1.Creating a Hospital record



2.Creating a Patient record


3.Creating a Physician record


4.Creating Prescription for the patient


5.Record of the in-patient (patient who is hospitalized)


6.Creating a lab test report


7.Lab report in pdf format


8.Creating appointments for the patient


9. Creating a Health Center Building record. This features help to maintain the hierarchy of the hospital.



10.Creating a record for Ward with in the building.



11.Creating record for beds in the hospital.


12.List of the diseases already present in the Medical Module according to ICD-10.

Monday, March 14, 2011

Things to note while migrating OpenERP 5 modules to OpenERP 6 (OpenERP 5 to OpenERP 6 Module Migration)

Pragmatic Techsoft Pvt Ltd. (http://www.pragtech.co.in) has put forward a list of technical changes which need to be taken care while migrating modules from OpenERP 5 to OpenERP 6. This list is no way comprehensive and comments and feedback are welcome.


Wizard

OpenERP V5
1. Both normal and memory wizards are used.
2. Normal Wizard created by single .py file, which is created in wizard folder of our module.
3. To call normal wizard we need following code in .xml file which is outside the wizard folder.
<wizard
            id="wizard_student"
            model="student.student"
            name="student.student.wizard"
            string="Student Detail"/>

4. To call memory wizard we need following code in .xml file which is outside the wizard folder. If we call wizard on button.
<button name="%(act_student_memory_wizard)d" string="Memory Wizard" type="action"/>
OpenERP V6
1. Only memory wizards are used.
2. Wizard in V6 is similar to memory wizard in V5.
3. To call wizard we need following code in .xml file which is outside the wizard folder. If we call wizard on button.
<button name="%(student.act_student_memory_wizard)d" string="Memory Wizard" type="action"/>
4. if we call the wizard through Action menu then we need following code to call given wizard
<act_window name="Student Detail"
            res_model="student.detail.bymarks"
            src_model="student.student"
            key2="client_action_multi"
            multi="True"
            view_mode="form"
            view_type="form"
            target="new"
            id="action_student_onmarks"/>

Search views

OpenERP V5:
1. The only facility of search is there in list view(treeview).
OpenERP V6:
1. Improves over built-in search features in v5
2. Always associated with other view: list, calendar, ...
New view type: <search>
    Two main building blocks:
        • <field name='...'>
        • <filter domain='...' context='...'>
    Structured with:
        • <group>
        • <separator>
        • <newline>
No need of select=”1” or select=”2”,just need select=”True”

<record id="view_sales_order_filter" model="ir.ui.view">
            <field name="name">sale.order.list.select</field>
            <field name="model">sale.order</field>
            <field name="type">search</field>
            <field name="arch" type="xml">
                <search string="Search Sales Order">
                    <filter icon="terp-document-new" string="Quotations" domain="[('state','=','draft')]" help="Sales Order that haven't yet been confirmed"/>
                    <filter icon="terp-check" string="Sales" domain="[('state','in',('manual','progress'))]"/>
                    <separator orientation="vertical"/>
                    <filter icon="terp-dolar_ok!" string="To Invoice" domain="[('state','=','manual')]" help="Sales Order ready to be invoiced"/>
                    <separator orientation="vertical"/>
                    <field name="name" select="1"/>
                    <field name="date_order" select="1" string="Order date" />
                    <field name="partner_id" select="1"/>
                    <field name="user_id" select="1">
                        <filter domain="[('user_id','=',uid)]" help="My Sale Orders" icon="terp-personal"/>
                    </field>
                    <newline/>
                    <group expand="0" string="Group By..." colspan="11" col="11" groups="base.group_extended">
                        <filter string="Customer" icon="terp-personal" domain="[]" context="{'group_by':'partner_id'}"/>
                        <filter string="Salesman" icon="terp-personal" domain="[]" context="{'group_by':'user_id'}"/>
                        <separator orientation="vertical"/>
                        <filter string="State" icon="terp-stock_effects-object-colorize" domain="[]" context="{'group_by':'state'}"/>
                        <separator orientation="vertical"/>
                        <filter string="Order Date" icon="terp-go-month" domain="[]" context="{'group_by':'date_order'}"/>
                    </group>
             </search>
            </field>
        </record>


<record id="action_order_form" model="ir.actions.act_window">
            <field name="name">Sales Orders</field>
            <field name="type">ir.actions.act_window</field>
            <field name="res_model">sale.order</field>
            <field name="view_type">form</field>
            <field name="view_mode">tree,form,calendar,graph</field>
            <field name="search_view_id" ref="view_sales_order_filter"/>
            <field name="help">Sales Orders helps you manage quotations and orders done with your customers. OpenERP suggests that you to start by creating a quotation. Once the order is confirmed, the quotation is converted into a Sale Order. OpenERP can handle several types of products so that a sales order can trigger tasks, delivery orders, manufacturing orders, purchases and so on. Based on the configuration of the sale order, a draft invoice will be generated so that you just have to confirm it when you want to bill your customer.</field>
        </record>
        <menuitem action="action_order_form" id="menu_sale_order" parent="base.menu_sales" sequence="3" groups="base.group_sale_salesman,base.group_sale_manager"/>

<fields> with embedded <filters>
    Advanced attributes for <field>:
    • context=”{'country_visible':True}”
    • domain=”[('country_id', '=', 'Belgium')]”
    • filter_domain=”['|', ('location_to', '=', self),
                        ('location_src', '=', self)]”
    Default values for filters and fields, via action context:
    • context=”{'search_default_filter1': True}”
    • context=”{'search_default_field1': 'test'}”
    • context=”{'search_default_field1': lang}”
    Specific search view can be forced in caller action:

<field name="search_view_id" ref="view_sales_order_filter"/>
context attribute of elements can toggle aggregation of associated list views
<filter string="Salesman" icon="terp-personal" domain="[]" context="{'group_by':'user_id'}"/>
Multiple group-by levels are supported
    • <filter string="Salesman,State"
                    name="salesman_state"
                    context="{'group_by':['user_id','state']}"/>
    Order of group-by entries matters!

Tree Views


Openerp V5:
1. Normal Tree view is there.
2. We can edit data in columns in tree view, but no buttons are theire to process on selected row.

Openerp V6:
1. List views can now display buttons
        Regular <button> elements as in form views
            Action/Method/Workflow called on single record

    2. Columns can be toggled via context
        • context = {'section_mode': True}
    • <field name=”country_id”
        invisible=”context.get('invisible_country')”>

Diagram views

OpenERP V5:
1. No diagram view is theire.
2. But we can see similar to it in customized workflow

OpenERP V6:
New <diagram> view type
Constructed with
    • <node object=”node.model”
        shape=”...”
            bgcolor=”...”>
    • <arrow object=”transition.model”
                source=”source_field”
                destination=”dest_field” >
    • <field> (included in quick view)
Objects must form a coherent graph
<node> model must have a many2one to its container

<record id="view_marketing_campaign_diagram" model="ir.ui.view">
        <field name="name">marketing.campaign.diagram</field>
        <field name="model">marketing.campaign</field>
        <field name="type">diagram</field>
        <field name="arch" type="xml">
            <diagram string="Campaign Editor">
                <node object="marketing.campaign.activity" shape="rectangle:type=='subcampaign'" bgcolor="gray:start==True">
                    <field name="name"/>
                    <field name="type"/>
                    <field name="start" invisible="1"/>
                    <field name="condition" widget="char"/>
                </node>
                <arrow object="marketing.campaign.transition" source="activity_from_id" destination="activity_to_id" label="['name']">
                    <field name="activity_from_id"/>
                    <field name="activity_to_id"/>
                    <field name="interval_nbr"/>
                    <field name="interval_type"/>
                </arrow>
            </diagram>
        </field>
    </record>

Testing framework: YAML

OpenERP V5:
1. No such Testing framework(.YAML) file used in it.
OpenERP V6:
1. New YAML data serialization supported in v6
2. Data-oriented syntax “YAML Ain't a Markup Language”
3. Whitespace delimiters, Python-like
    Human-readable
        no quotes, brackets, braces, ... by default
    Supports everything supported by XML and more
        Calling internal service such as workflows
            Arbitrary python code
4. When added to the test section of the module descriptor, tests are rolled back by default
    New logging level test for showing test results

    OpenERP supports specific custom types:
    • !record {model: res_model, id: xml_id, context: {...} }
    • !python {model: res_model}
    • !workflow {model:res_model, action:signal, ref: xml_id}
    And equivalents for all XML supported elements
    • !act_window
    • !report
    • !function
    • !menuitem
    • !assert

In order to test Account Journal Select wizard I open journal entries using this wizard
-
    !record {model: account.journal.select, id: account_journal_select_0}:
    {}
-
    I clicked on Open Journal Button to open the entries

-
    !python {model: account.journal.select}: |
    self.action_open_window(cr, uid, [ref("account_journal_select_0")], {"lang":
     'en_US', "active_model": "account.journal.period", "active_ids": [ref("account.a_recv")],
     "tz": False, "active_id": ref("account.a_recv"), })
-
    I check that the entries open successfully

Other Improvements


OpenERP V5:
1.Simpler __terp__ structure: data, demo

2. Security:
        safe_eval
        Private _methods() are callable via RPC
        def _foo(self):
        print “hi all “
3. class for res.partner.function object is present.

OpenERP V6:
1. Simpler __openerp__ structure: data, demo, test

2. API:
        _defaults may be literal
        _constraints, _sql_constraints may be callables
3. Security:
        safe_eval replaced built-in eval
        Private _methods() not callable via RPC
        def _foo(self):
        print “hi all “
        1. if you try to call this method on button ,it will not allow you
            2. so solution for this problem is that do not define function start with _(underscore).

4. Reporting engine more modular (e.g report_webkit)

5. Performance improvements in RML reports
    <blockTable rowHeights="2cm" colWidths="11.0,7.0">
    Smarter translations, cached
6. Actions have new properties:
    help="Business description for this action"
    multi=True
7. Simpler XML declaration for wizards actions
    res.roles => res.groups

8. base_report_designer includes OOo plugin

9. 'View logs' shows XML ID now

10. class for res.partner.function object is not not V6 replace by char field.

Action Help

Openerp V5:
1. There is no facility of help regarding action

Openerp V6:
1. you can specify help of action by following way
<record id="action_tax_code_tree" model="ir.actions.act_window">
            <field name="name">Chart of Taxes</field>
            <field name="res_model">account.tax.code</field>
            <field name="domain">[('parent_id','=',False)]</field>
            <field name="view_type">tree</field>
            <field name="view_id" ref="view_tax_code_tree"/>
            <field name="help">The chart of taxes is used to generate your periodic tax statement. You will see here the taxes with codes related to your legal statement according to your country.</field>
        </record>