Chen Log

陳洛格

Archive for April 2014

AutoLink on ruby on rails

leave a comment »

Because the AutoLink on rails has removed in rails 3.1,

so if you have to use the function you must be install other gem: 「Rinku

 

Before you start to install the Rinku Gem,

you must install the Xcode app and agree the license.

then 

$ gem install rinku

 

  • Inserted require 'rinku' into the controller file
  • Inserted the following into the view file <% text = "Go to http://www.abc.com or email me at dude@abc.com" %> and <%= Rinku.auto_link(text, mode=:all, link_attr=nil, skip_tags=nil) %>

key those text on the view file:

auto_link('http://www.pokemon.com', :all, 'target="_blank"')

Reference this url:
https://github.com/vmg/rinku 
http://stackoverflow.com/questions/6418710/replacing-the-auto-link-method-in-ruby-on-rails-3-1

Written by chenagw

2014/04/21 at 00:40

Posted in Uncategorized

Tagged with , , ,

OpenERP email template parameter 信件樣本參數

leave a comment »

use pgAdmin to open PostgreSQL

螢幕快照 2014 04 15 00 49 27

you can use those parameter like(date_order 、partner_id、name) in Email template at OPENERP

${object.date_order} = 訂單日期 order date

${object.partner_id.display_name} =partner Company Name 對方公司名稱與資料

${(object.name or ”).replace(‘/’,’_’)} =order name

${object.state in (‘draft’, ‘sent’) and ‘Quotation’ or ‘Order’} =show Quotation or Order 顯示訂單或估價單

以上都可以參考OpenERP欄目參數去設定

Written by chenagw

2014/04/15 at 00:56

Posted in Uncategorized

Tagged with , ,

OpenERP 信件樣板自動載入

leave a comment »

Now a days Mailing mechanism is to fast for any communication. Here I would like to serve you how to send mail in openerp and how to use a custom templates for sending mail.

Required module for Installation:
–> email_templates
    Here First of all you need to configure outgoing email server. 
    For Outing Mail Servers:
        Settings/Technical/Email/Outing Mail Servers











Google:
    smtp.gmail.com
    SSL Port 465
    StartTLS Port 587

Yahoo:
    smtp.mail.yahoo.com
    SSL Port 465


If you success to configure openerp outgoing email server then lets see how to use a custom templates for sending mail.

Here First of all you need to install email_template module.This module is used to specify the format in which the email has to be send.


For Templates:
      Settings/Technical/Email/Templates





















In templates need to set required field 

Name : Name of the template
Applies to: Model to which the template is related [Ex: sale order]
Form: sender address
To: Destination mail address
Reply To : Preferred Reply address
Subject : Subject of the mail
Body : Body of the email [either plain text or an HTML format]
Add signature: predefine signature for all.

Main important feature of email_templates is dynamically value builder tab where you can fetch your required field from related document model and also use the field value in [Form,TO,Subject,Body] anywhere in mail template.

















Field Description:

Field : Select field from Applies to model 
    In our Example:we select sale order modele in applies to so all sale order filed display here like [name, ref, company_id, partner_id, etc]

Sub-Model : When a relation field like many2one is selected, this field specify the Related model.
       Example: partner_id is many2one field which related with res.partner 
    
Sub-field : When a relation field is selected, this field let us select the target field inside the Sub-Model
        Ex: In sub-model if you select partner_id than you can use all partner table field as sub field 

Placeholder Expression : This is the resulting expression generated when the fields are selected in Dynamic Value Builder. This can be copy pasted in fields in email template.
      ex: ${object.partner_id.email}

In Advanced tab you can find this many field:







 








Language: language of the mail
Outgoing mail server: Outgoing Mail Server configured before
Auto Delete : Permanently delete the email after sending it to save space
Attachment: to attach files on email.


Button events:

Preview: preview of mail_template
  Add context action: this creates a links in [more] in the related document model form view which helps in sending email any time from the form view. 
    example: I have created a template for the sale.order and a link is created by clicking “Add Context action” button in template, a link will be created as shown below screen-shot:



















When you click on this link, a wizard pops up using from which we can send email to clicking send button:





 
 
 
 
 
 
 
 
 
 
 
Thanks,

Mayur Maheshwari

 

請參考:

http://maheshwarimayur.blogspot.tw/2012/12/send-mail-in-openerp-with-mail-templates.html

Written by chenagw

2014/04/13 at 18:07

Posted in Uncategorized

Tagged with

Pow port forward 設定使用方式

leave a comment »

讓 pow 的網址改連到 rails s 打開的 server

如此一來就可以披著 xxx.dev 的網址,實際上連到 rails s -p 3000 (或其他 port) 開好的 server。

參考 pow manual – 2.1.4 Port Proxying

  1. cd ~/.pow/
  2. rm project_name 把你原本的 link 移掉
  3. echo 13001 > project_name 把想用的 port 寫到原名的檔案裡
  4. cd 到你的 project 目錄
  5. rails s -p 13001 ﹣d

加上 -d 是讓程式可以在背景執行 不用一直開著終端機的視窗

需注意如果你有多個 projects,必須自己管理網址跟 port 的對應。

 

詳情請參考:

http://ascendbruce.logdown.com/posts/206764-extend-pow-kill-idle-timeout-and-pow-working-with-spring-or-zeus

Written by chenagw

2014/04/03 at 01:12

Posted in Uncategorized

Tagged with , , , ,

視覺化管理 POW 的軟體-Anvil For Mac

leave a comment »

螢幕快照 2014 04 03 00 29 31

Zero-config through Pow

http://anvilformac.com/

 

Written by chenagw

2014/04/03 at 00:31

Posted in Uncategorized

Tagged with , ,