Monday, 24 October 2016

Group by date in ODOO

Group by Date in ODOO

Adding a Group By in the search view will allow the user to group the records in tree view by Month and not by Day. For example, in the event tree view we can see the Group By 'Start Month' and it will result in the following:


Group by filter for the same is:

<filter string="Start Month" domain="[]" context="{'group_by':'date_begin'}"/>

Here it groups the records by month, to allow grouping by day, we have to change the code to:

<filter string="Start Month" domain="[]" context="{'group_by':'date_begin:day'}"/>



Thursday, 18 August 2016

Associating editors with file types




To associate an editor with a file type in eclipse:

  1. Select Window -> Preferences
  2. Then go to General->Editors->File Associations and you can select the editor for each file types.
  3. Click OK to save the changes.
You can also open the file in your preferred editor by right-clicking on the file and then choose Open With.

Monday, 25 April 2016

Adding a new language in ODOO

Following are the steps for adding a new language in ODOO(OpenERP):

1. Login to your database as Administrator user and go to 'Settings->Languages->Load a Translation'. Select a language in the pop up window(wizard). You can also select the 'Overwrite Existing Terms' and 'Website to translate' in the wizard. Then click on Load button for loading the new language.


Once the language is created you will get the following confirmation message.


You can also see the list of languages installed in your ODOO databse in 'Settings->Translations->Languages'.

2. After installing the language translations for all the labels(terms) in base modules will be created in the database automatically. But for your customized modules to get translated we need to setup the translation for all the terms(field labels, button names, menu names etc) manually. For this go to 'Settings->Translations->Import / Export->Export Translation'. In the wizard which opens on clicking the above menu, select the following values:
    a. Language
    b. File format: Select 'PO File'.
    c. Modules To Export: Select your customized modules here. For example I am selecting the Sales         Management module. In your case it might be something like Sales Management Customization         or Purchase Management Customization etc.
Then click on 'Export' button.


Once the export translation is completed you will get the following window from which you can download the PO file for your selected language.



3. Open the downloaded PO file and add the translations for each labels in English. In the file add value to 'msgstr' which should be the translation of the value in 'msgid' to your new language.









4. After making the changes in the PO file, copy the file to 'i18n' folder of your module in addons. If there is no folder named i18n create the folder in your module and copy the PO file in it.























5. Now restart the server and upgrade your module.
6. Then select the language in 'Preferences' in your user and it will load your database in  new language.





























The translated view will look like the following:






















For any doubts, suggestions or problems you can comment below or contact me via email.

Thanks,

Gopan

Saturday, 23 April 2016

Remove a field from Messages and communication history in ODOO

To remove a field from Messages and Communication history in Odoo models you can set the attribute track_visibility='none' in the field definition.

For example to remove the 'Expected Revenue' in opportunity form view's messages and communication history you can do the following:












For removing the Expected Revenue(planned_revenue) field we have inherit the crm_lead model and override the planned_revenue field.

class CrmLead(models.Model):
    _inherit = 'crm.lead'
planned_revenue = fields.Float(string='Expected Revenue', track_visibility='none') #Expected revenue field.

After upgrading the module the field expected revenue will not be tracked on making changes to the table.





How to track a field in messages in Odoo

For tracking the state changes, field changes etc for a model in Odoo, the model should inherit 'mail.thread' and in the form view of the model we have to provide the following code after the <sheet> tag.

Python file:
class SaleOrder(models.Models):
    _name = "sale.order"
    _inherit = ['mail.thread', 'ir.needaction_mixin']

XML view:
<div class="oe_chatter">
   <field name="message_follower_ids" widget="mail_followers" groups="base.group_user"/>
   <field name="message_ids" widget="mail_thread"/>
</div>

Adding the above code will show the following:

  • Created by
  • Modified by etc
For tracking a field we have to specify it in the field definition with parameter track_visibility set to 'always' or 'onchange' like the following:


state = fields.Selection([('draft', 'Unconfirmed'), ('open', 'Confirmed')], string='Status', readonly=True, track_visibility='always')
The following image shows the tracking of field Untaxed Amount in sales orders.




Tuesday, 1 March 2016

Setting up a developer account in Moneris


For setting up the Moneris developer account, please follow the below steps:




  1. Go to https://esqa.moneris.com/mpg/index.php
    Log in using the credentials shown in the page

  2. From the dashboard, go to Admin -> Hosted Paypage Config and click on Generate a New Configuration button . Please note that there are configurations of other developers/users listed
    below the button, do not edit or delete those configurations.

  3. After clicking on Generate a New Configuration button, you will get a ps_store_id and hpp_key for your developer account and a warning message like below:

    This configuration is currently flagged as temporary and will be deleted in 15 minutes.
    To confirm this configuration please click 'Save Changes' below.

    ps_store_id: BBMQCtore3
    hpp_key: hp2MAP$JFRUS


    Then under Basic Configurations enter a description about your account or website.
  4. Then select a transaction type. By default, it will be 'Purchase'.
  5. Select the Payment Methods you need. For example, Credit cards, Gift cards etc.
    NOTE: Different payment types require extra coding to handle the transaction response and create a receipt.
  6. Then select the Response method and enter Approved URL and Declined URL. After a successful transaction the Moneris payment gateway will redirect to the Approved URL you have specified and if the transaction is declined, it will redirect to the Declined URL.


    Then save the changes, now your developer account is ready.

    For integrating your Moneris payment gateway account with ODOO you can use the following details:

    Response Method: Sent to your server as a POST
    Approval URL: https://SITEURLHERE/payment/moneris/dpn
    Declined URL: https://SITEURLHERE/payment/moneris/cancel
    Use "Enhanced Cancel" Enabled
    Use "Response Fallback" Disabled
    Under Configure Response Fields, ECI and txn_number Enabled.
    Under security features, Transaction Verification Enabled, and set to be displayed as key/value pairs on moneris's server.

    The ODOO-Moneris integration module is available at https://github.com/willxinc/odoo-payment_moneris