[MRG] merge with lp:openobject-addons

bzr revid: tpa@tinyerp.com-20140212113807-mbuwn7n791cf221d
This commit is contained in:
Turkesh Patel (Open ERP)
2014-02-12 17:08:07 +05:30
10 changed files with 92 additions and 17 deletions
+1
View File
@@ -495,6 +495,7 @@ class account_bank_statement(osv.osv):
ctx = (context or {}).copy()
ctx['journal_id'] = self.browse(cr, uid, ids[0], context=context).journal_id.id
return {
'name': _('Journal Items'),
'view_type':'form',
'view_mode':'tree',
'res_model':'account.move.line',
+1
View File
@@ -352,6 +352,7 @@ class account_asset_asset(osv.osv):
context = {}
context.update({'search_default_asset_id': ids, 'default_asset_id': ids})
return {
'name': _('Journal Items'),
'view_type': 'form',
'view_mode': 'tree,form',
'res_model': 'account.move.line',
+1 -1
View File
@@ -9,7 +9,7 @@
<field name="name">Meeting Types Tree</field>
<field name="model">calendar.event.type</field>
<field name="arch" type="xml">
<tree string="Meeting Types" editable="bottom">
<tree string="Meeting Types">
<field name="name"/>
</tree>
</field>
+4 -2
View File
@@ -264,14 +264,16 @@ class crm_phonecall(osv.osv):
Open meeting's calendar view to schedule a meeting on current phonecall.
:return dict: dictionary value for created meeting view
"""
partner_ids = []
phonecall = self.browse(cr, uid, ids[0], context)
if phonecall.partner_id and phonecall.partner_id.email:
partner_ids.append(phonecall.partner_id.id)
res = self.pool.get('ir.actions.act_window').for_xml_id(cr, uid, 'calendar', 'action_calendar_event', context)
res['context'] = {
'default_phonecall_id': phonecall.id,
'default_partner_id': phonecall.partner_id and phonecall.partner_id.id or False,
'default_partner_ids': partner_ids,
'default_user_id': uid,
'default_email_from': phonecall.email_from,
'default_state': 'open',
'default_name': phonecall.name,
}
return res
+2 -2
View File
@@ -58,7 +58,7 @@
<field name="view_mode">tree,calendar</field>
<field name="view_id" ref="crm_case_inbound_phone_tree_view"/>
<field name="domain">[]</field>
<field name="context">{'default_state': 'done'}</field>
<field name="context">{}</field>
<field name="search_view_id" ref="crm.view_crm_case_phonecalls_filter"/>
<field name="help" type="html">
<p class="oe_view_nocontent_create">
@@ -106,7 +106,7 @@
<field name="view_mode">tree,calendar</field>
<field name="view_id" ref="crm_case_phone_tree_view"/>
<field name="domain">[('state','!=','done')]</field>
<field name="context" eval="'{\'default_state\':\'open\'}'"/>
<field name="context">{}</field>
<field name="search_view_id" ref="crm.view_crm_case_phonecalls_filter"/>
<field name="help" type="html">
<p class="oe_view_nocontent_create">
+3 -2
View File
@@ -48,7 +48,8 @@
<field name="view_type">form</field>
<field name="view_mode">tree,form</field>
</record>
<menuitem action="action_header_img" id="menu_header_img" parent="base.menu_custom" sequence="14"/>
<menuitem id="menu_webkit" name="Webkit" parent="base.menu_custom"/>
<menuitem action="action_header_img" id="menu_header_img" parent="menu_webkit" sequence="14"/>
<record id="action_header_webkit" model="ir.actions.act_window">
<field name="name">Webkit Headers/Footers</field>
@@ -56,7 +57,7 @@
<field name="view_type">form</field>
<field name="view_mode">tree,form</field>
</record>
<menuitem action="action_header_webkit" id="menu_header_webkit" parent="base.menu_custom" sequence="14"/>
<menuitem action="action_header_webkit" id="menu_header_webkit" parent="menu_webkit" sequence="14"/>
</data>
</openerp>
+12 -7
View File
@@ -378,20 +378,25 @@ class Website(openerp.addons.web.controllers.main.Home):
#------------------------------------------------------
# Server actions
#------------------------------------------------------
@http.route(['/website/action/<id_or_xml_id>'], type='http', auth="public", website=True)
def actions_server(self, id_or_xml_id, **post):
@http.route('/website/action/<path_or_xml_id_or_id>', type='http', auth="public", website=True)
def actions_server(self, path_or_xml_id_or_id, **post):
cr, uid, context = request.cr, request.uid, request.context
res, action_id, action = None, None, None
ServerActions = request.registry['ir.actions.server']
# find the action_id, either an int, an int into a basestring, or an xml_id
if isinstance(id_or_xml_id, basestring) and '.' in id_or_xml_id:
action_id = request.registry['ir.model.data'].xmlid_to_res_id(request.cr, request.uid, id_or_xml_id, raise_if_not_found=False)
else:
# find the action_id: either an xml_id, the path, or an ID
if isinstance(path_or_xml_id_or_id, basestring) and '.' in path_or_xml_id_or_id:
action_id = request.registry['ir.model.data'].xmlid_to_res_id(request.cr, request.uid, path_or_xml_id_or_id, raise_if_not_found=False)
if not action_id:
action_ids = ServerActions.search(cr, uid, [('website_path', '=', path_or_xml_id_or_id), ('website_published', '=', True)], context=context)
action_id = action_ids and action_ids[0] or None
if not action_id:
try:
action_id = int(id_or_xml_id)
action_id = int(path_or_xml_id_or_id)
except ValueError:
pass
# check it effectively exists
if action_id:
action_ids = ServerActions.exists(cr, uid, [action_id], context=context)
+2
View File
@@ -43,6 +43,7 @@
<field name="name">Website Partner Post and Thanks Demo</field>
<field name="condition">True</field>
<field name="website_published" eval="True"/>
<field name="website_path">partner_thanks</field>
<field name="model_id" ref="base.model_res_partner"/>
<field name="code">
partner_id, partner = False, None
@@ -118,6 +119,7 @@ response = request.website.render("website.template_partner_post", values)
<field name="name">Website Partners Comment Form</field>
<field name="condition">True</field>
<field name="website_published" eval="True"/>
<field name="website_path">partner_comment</field>
<field name="model_id" ref="base.model_res_partner"/>
<field name="code">
partner_ids = pool['res.partner'].search(cr, uid, [('customer', '=', True)], context=context)
+31 -1
View File
@@ -1,5 +1,7 @@
# -*- coding: utf-8 -*-
import urlparse
from openerp.addons.web.http import request
from openerp.osv import fields, osv
@@ -9,15 +11,43 @@ class actions_server(osv.Model):
_name = 'ir.actions.server'
_inherit = ['ir.actions.server']
def _compute_website_url(self, cr, uid, id, website_path, xml_id, context=None):
base_url = self.pool['ir.config_parameter'].get_param(cr, uid, 'web.base.url', context=context)
link = website_path or xml_id or (id and '%d' % id) or ''
if base_url and link:
path = '%s/%s' % ('/website/action', link)
return '%s' % urlparse.urljoin(base_url, path)
return ''
def _get_website_url(self, cr, uid, ids, name, args, context=None):
res = dict.fromkeys(ids, False)
for action in self.browse(cr, uid, ids, context=context):
if action.state == 'code' and action.website_published:
res[action.id] = self._compute_website_url(cr, uid, action.id, action.website_path, action.xml_id, context=context)
return res
_columns = {
'xml_id': fields.function(
osv.osv.get_xml_id, type='char', string="External ID",
help="ID of the action if defined in a XML file"),
'website_path': fields.char('Website Path'),
'website_url': fields.function(
_get_website_url, type='char', string='Website URL',
help='The full URL to access the server action through the website.'),
'website_published': fields.boolean(
'Available on the Website',
help='A code server action can be executed from the website, using a dedicated'
'controller. The address is <base>/website/action/<id_or_xml_id>.'
'controller. The address is <base>/website/action/<website_path>.'
'Set this field as True to allow users to run this action. If it'
'set to is False the action cannot be run through the website.'),
}
def on_change_website_path(self, cr, uid, ids, website_path, xml_id, context=None):
values = {
'website_url': self._compute_website_url(cr, uid, ids[0], website_path, xml_id, context=context)
}
return {'value': values}
def _get_eval_context(self, cr, uid, action, context=None):
""" Override to add the request object in eval_context. """
eval_context = super(actions_server, self)._get_eval_context(cr, uid, action, context=context)
+35 -2
View File
@@ -6,10 +6,43 @@
<field name="name">ir.actions.server.form.website</field>
<field name="model">ir.actions.server</field>
<field name="inherit_id" ref="base.view_server_action_form"/>
<field name="arch" type="xml">
<data>
<xpath expr="//field[@name='state']" position="after">
<field name="website_published"
attrs="{'invisible': [('state', '!=', 'code')]}"/>
</xpath>
<xpath expr="//field[@name='sequence']" position="after">
<field name="xml_id" invisible="1"/>
<field name="website_path"
on_change="on_change_website_path(website_path, xml_id, context)"
attrs="{'invisible': ['|', ('website_published', '!=', True), ('state', '!=', 'code')]}"/>
<field name="website_url" readonly="1"
attrs="{'invisible': ['|', ('website_published', '!=', True), ('state', '!=', 'code')]}"/>
</xpath>
</data>
</field>
</record>
<record model="ir.ui.view" id="view_server_action_tree_website">
<field name="name">ir.actions.server.tree.website</field>
<field name="model">ir.actions.server</field>
<field name="inherit_id" ref="base.view_server_action_tree"/>
<field name="arch" type="xml">
<xpath expr="//field[@name='sequence']" position="after">
<field name="website_url"/>
</xpath>
</field>
</record>
<record model="ir.ui.view" id="view_server_action_search_website">
<field name="name">ir.actions.server.search.website</field>
<field name="model">ir.actions.server</field>
<field name="inherit_id" ref="base.view_server_action_search"/>
<field name="arch" type="xml">
<xpath expr="//field[@name='state']" position="after">
<field name="website_published"
attrs="{'invisible': [('state', '!=', 'code')]}"/>
<filter string="Website" name="website"
domain="[('website_published', '=', True), ('state', '=', 'code')]"/>
</xpath>
</field>
</record>