[MERGE]: Merge with latest trunk-addons

bzr revid: rpa@tinyerp.com-20120727045438-740vzcigf5phqqej
This commit is contained in:
Rucha (Open ERP) 2012-07-27 10:24:38 +05:30
commit 450c60762c
25 changed files with 185 additions and 222 deletions

View File

@ -455,7 +455,6 @@ class account_analytic_account(osv.osv):
'invoice_on_timesheets' : fields.boolean("Invoice On Timesheets"),
'month_ids': fields.function(_analysis_all, multi='analytic_analysis', type='many2many', relation='account_analytic_analysis.summary.month', string='Month'),
'user_ids': fields.function(_analysis_all, multi='analytic_analysis', type="many2many", relation='account_analytic_analysis.summary.user', string='User'),
'template_id': fields.many2one('account.analytic.account', 'Template of Contract'),
'hours_qtt_est': fields.float('Estimation of Hours to Invoice'),
'est_total' : fields.function(_sum_of_fields, type="float",multi="sum_of_all", string="Total Estimation"),
'invoiced_total' : fields.function(_sum_of_fields, type="float",multi="sum_of_all", string="Total Invoiced"),
@ -483,18 +482,15 @@ class account_analytic_account(osv.osv):
def on_change_template(self, cr, uid, ids, template_id, context=None):
if not template_id:
return {}
res = {'value':{}}
template = self.browse(cr, uid, template_id, context=context)
res['value']['date_start'] = template.date_start
res['value']['date'] = template.date
res['value']['fix_price_invoices'] = template.fix_price_invoices
res['value']['invoice_on_timesheets'] = template.invoice_on_timesheets
res['value']['quantity_max'] = template.quantity_max
res['value']['hours_qtt_est'] = template.hours_qtt_est
res['value']['amount_max'] = template.amount_max
res['value']['to_invoice'] = template.to_invoice.id
res['value']['pricelist_id'] = template.pricelist_id.id
res['value']['description'] = template.description
res = super(account_analytic_account, self).on_change_template(cr, uid, ids, template_id, context=context)
if template_id and 'value' in res:
template = self.browse(cr, uid, template_id, context=context)
res['value']['fix_price_invoices'] = template.fix_price_invoices
res['value']['invoice_on_timesheets'] = template.invoice_on_timesheets
res['value']['hours_qtt_est'] = template.hours_qtt_est
res['value']['amount_max'] = template.amount_max
res['value']['to_invoice'] = template.to_invoice.id
res['value']['pricelist_id'] = template.pricelist_id.id
return res
account_analytic_account()
@ -532,40 +528,25 @@ class account_analytic_account_summary_user(osv.osv):
def init(self, cr):
tools.sql.drop_view_if_exists(cr, 'account_analytic_analysis_summary_user')
cr.execute('CREATE OR REPLACE VIEW account_analytic_analysis_summary_user AS (' \
'SELECT ' \
'(u.account_id * u.max_user) + u."user" AS id, ' \
'u.account_id AS account_id, ' \
'u."user" AS "user", ' \
'COALESCE(SUM(l.unit_amount), 0.0) AS unit_amount ' \
'FROM ' \
'(SELECT ' \
'a.id AS account_id, ' \
'u1.id AS "user", ' \
'MAX(u2.id) AS max_user ' \
'FROM ' \
'res_users AS u1, ' \
'res_users AS u2, ' \
'account_analytic_account AS a ' \
'GROUP BY u1.id, a.id ' \
') AS u ' \
'LEFT JOIN ' \
'(SELECT ' \
'l.account_id AS account_id, ' \
'l.user_id AS "user", ' \
'SUM(l.unit_amount) AS unit_amount ' \
'FROM account_analytic_line AS l, ' \
'account_analytic_journal AS j ' \
'WHERE (j.type = \'general\') and (j.id=l.journal_id) ' \
'GROUP BY l.account_id, l.user_id ' \
') AS l '
'ON (' \
'u.account_id = l.account_id ' \
'AND u."user" = l."user"' \
') ' \
'GROUP BY u."user", u.account_id, u.max_user' \
')')
cr.execute('''CREATE OR REPLACE VIEW account_analytic_analysis_summary_user AS (
with mu as
(select max(id) as max_user from res_users)
, lu AS
(SELECT
l.account_id AS account_id,
coalesce(l.user_id, 0) AS user_id,
SUM(l.unit_amount) AS unit_amount
FROM account_analytic_line AS l,
account_analytic_journal AS j
WHERE (j.type = 'general' ) and (j.id=l.journal_id)
GROUP BY l.account_id, l.user_id
)
select (lu.account_id * mu.max_user) + lu.user_id as id,
lu.account_id as account_id,
lu.user_id as "user",
unit_amount
from lu, mu)''')
account_analytic_account_summary_user()
class account_analytic_account_summary_month(osv.osv):

View File

@ -20,9 +20,6 @@
<field name="inherit_id" ref="analytic.view_account_analytic_account_form"/>
<field eval="40" name="priority"/>
<field name="arch" type="xml">
<xpath expr='//field[@name="type"]' position='after'>
<field name="template_id" on_change="on_change_template(template_id,context)" domain="[('type','=','template')]" attrs="{'invisible': [('type','in',['view', 'normal','template'])]}" context="{'default_type' : 'template'}"/>
</xpath>
<xpath expr='//div[@name="duration"]' position="after" version="7.0">
<label for="quantity_max"/>
<div>

View File

@ -161,6 +161,7 @@ class account_analytic_account(osv.osv):
"The type 'Analytic account' stands for usual accounts that you only want to use in accounting.\n"\
"If you select Contract or Project, it offers you the possibility to manage the validity and the invoicing options for this account.\n"\
"The special type 'Template of Project' allows you to define a template with default data that you can reuse easily."),
'template_id': fields.many2one('account.analytic.account', 'Template of Contract'),
'description': fields.text('Description'),
'parent_id': fields.many2one('account.analytic.account', 'Parent Analytic Account', select=2),
'child_ids': fields.one2many('account.analytic.account', 'parent_id', 'Child Accounts'),
@ -184,6 +185,17 @@ class account_analytic_account(osv.osv):
}, string='Currency', type='many2one', relation='res.currency'),
}
def on_change_template(self, cr, uid, ids, template_id, context=None):
if not template_id:
return {}
res = {'value':{}}
template = self.browse(cr, uid, template_id, context=context)
res['value']['date_start'] = template.date_start
res['value']['date'] = template.date
res['value']['quantity_max'] = template.quantity_max
res['value']['description'] = template.description
return res
def on_change_partner_id(self, cr, uid, ids,partner_id, name, context={}):
res={}
if partner_id:

View File

@ -18,6 +18,7 @@
<field name="partner_id" on_change="on_change_partner_id(partner_id, name)" attrs="{'required':[('type','=','contract')]}"/>
<field name="parent_id" on_change="on_change_parent(parent_id)" attrs="{'invisible': [('type','in',['contract','template'])]}"/>
<field name="type"/>
<field name="template_id" on_change="on_change_template(template_id,context)" domain="[('type','=','template')]" attrs="{'invisible': [('type','in',['view', 'normal','template'])]}" context="{'default_type' : 'template'}"/>
</group>
<group>
<field name="code"/>

View File

@ -1,29 +1,20 @@
openerp.anonymous = function(instance) {
instance.web.client_actions.add("login", "instance.web.Login");
instance.web.WebClient.include({
show_login: function() {
var self = this, _super = this._super;
this.login.load_db_list().then(function() {
var dblist = self.login._db_list;
instance.web.Login.include({
start: function() {
var self = this;
return $.when(this._super()).pipe(function() {
var dblist = self._db_list;
if (dblist && dblist.length === 1) {
self.login.remember_credentials = false;
self.remember_credentials = false;
// XXX get login/pass from server (via a rpc call) ?
self.login.do_login(dblist[0], 'anonymous', 'anonymous').fail(function() {
_super.apply(self, []);
});
} else {
_super.apply(self, []);
return self.do_login(dblist[0], 'anonymous', 'anonymous')
}
});
},
restart: function() {
return this.start();
}
});
instance.web.UserMenu.include({
init: function(parent) {
this._super(parent);
@ -39,8 +30,8 @@ openerp.anonymous = function(instance) {
var p = self.getParent();
var am = p.action_manager;
p.$element.find('.oe_leftbar').hide();
am.do_action({type:'ir.actions.client', tag:'login'});
am.inner_widget.on('login', p, p.restart);
am.do_action({type:'ir.actions.client', tag:'login', target: 'new'});
am.dialog_widget.on('login', p, p.restart);
});
}
});

View File

@ -73,7 +73,7 @@
<field name="arch" type="xml">
<form string="Meetings" version="7.0">
<header>
<button name="case_open" string="Confirm" type="object" class="oe_highlight"
<button name="case_open" string="Confirm" type="object"
states="draft"/>
<button name="case_close" string="Done" type="object"
states="open"/>

View File

@ -208,7 +208,6 @@ class crm_lead(base_stage, osv.osv):
'channel_id': fields.many2one('crm.case.channel', 'Channel', help="Communication channel (mail, direct, phone, ...)"),
'contact_name': fields.char('Contact Name', size=64),
'partner_name': fields.char("Customer Name", size=64,help='The name of the future partner company that will be created while converting the lead into opportunity', select=1),
'opt_in': fields.boolean('Opt-In', oldname='optin', help="If opt-in is checked, this contact has accepted to receive emails."),
'opt_out': fields.boolean('Opt-Out', oldname='optout', help="If opt-out is checked, this contact has refused to receive emails or unsubscribed to a campaign."),
'type':fields.selection([ ('lead','Lead'), ('opportunity','Opportunity'), ],'Type', help="Type is used to separate Leads and Opportunities"),
'priority': fields.selection(crm.AVAILABLE_PRIORITIES, 'Priority', select=True),
@ -279,12 +278,6 @@ class crm_lead(base_stage, osv.osv):
self.create_send_note(cr, uid, [obj_id], context=context)
return obj_id
def on_change_opt_in(self, cr, uid, ids, opt_in):
return {'value':{'opt_in':opt_in,'opt_out':False}}
def on_change_opt_out(self, cr, uid, ids, opt_out):
return {'value':{'opt_out':opt_out,'opt_in':False}}
def onchange_stage_id(self, cr, uid, ids, stage_id, context={}):
if not stage_id:
return {'value':{}}
@ -772,6 +765,7 @@ class crm_lead(base_stage, osv.osv):
res['context'] = {
'default_opportunity_id': opportunity.id,
'default_partner_id': opportunity.partner_id and opportunity.partner_id.id or False,
'default_partner_ids' : opportunity.partner_id and [opportunity.partner_id.id] or False,
'default_user_id': uid,
'default_section_id': opportunity.section_id and opportunity.section_id.id or False,
'default_email_from': opportunity.email_from,

View File

@ -204,8 +204,7 @@
<field name="state" groups="base.group_no_one"/>
</group>
<group string="Mailings">
<field name="opt_in" on_change="on_change_opt_in(opt_in)"/>
<field name="opt_out" on_change="on_change_opt_out(opt_out)"/>
<field name="opt_out" />
</group>
</group>
</page>
@ -543,8 +542,7 @@
<field name="channel_id" widget="selection"/>
</group>
<group string="Mailings">
<field name="opt_in" on_change="on_change_opt_in(opt_in)"/>
<field name="opt_out" on_change="on_change_opt_out(opt_out)"/>
<field name="opt_out" />
</group>
<group string="Misc">
<field name="active"/>

View File

@ -129,7 +129,7 @@
<button type="action"
string="Schedule a Meeting"
name="%(base_calendar.action_crm_meeting)d"
context="{'search_default_partner_ids': active_id}"/>
context="{'search_default_partner_ids': active_id, 'default_partner_ids' : [active_id]}"/>
<button type="action" string="Schedule a Call"
name="%(crm.crm_case_categ_phone_create_partner)d"
context="{'search_default_partner_id': active_id, 'default_duration': 1.0}" />

View File

@ -7,7 +7,6 @@
type: opportunity
stage_id: crm.stage_lead1
state: draft
opt_in: True
-
I create lead record to call Mailing opt-out onchange method.
-

View File

@ -226,7 +226,7 @@
<field name="arch" type="xml">
<field name="company_id" position="before">
<field name="weight"/>
<field name="weight_net"/>
<field name="weight_net" groups="base.group_no_one"/>
</field>
</field>
</record>
@ -251,7 +251,7 @@
<field name="arch" type="xml">
<xpath expr="/form/sheet/notebook/page/field[@name='move_lines']/tree/field[@name='product_uom']" position="after">
<field name="weight"/>
<field name="weight_net"/>
<field name="weight_net" groups="base.group_no_one"/>
</xpath>
</field>
</record>
@ -264,7 +264,7 @@
<field name="arch" type="xml">
<xpath expr="//group[@name='main_grp']" position="inside">
<field name="weight"/>
<field name="weight_net"/>
<field name="weight_net" groups="base.group_no_one"/>
</xpath>
</field>
</record>
@ -299,7 +299,7 @@
<field name="model">stock.picking</field>
<field name="inherit_id" ref="stock.view_picking_out_form"/>
<field name="arch" type="xml">
<xpath expr="/form/header/button[@string='Create Invoice']" position="after">
<xpath expr="/form/header/button[@string='Create Invoice/Refund']" position="after">
<button name="%(report_shipping)d" string="Delivery Order" states="done" type="action" icon="gtk-print"/>
</xpath>
</field>

View File

@ -5,3 +5,4 @@ access_hr_holidays_employee,hr.holidays.employee,model_hr_holidays,base.group_us
access_hr_holydays_status_employee,hr.holidays.status employee,model_hr_holidays_status,base.group_user,1,0,0,0
access_hr_holidays_remain_user,hr.holidays.ramain.user,model_hr_holidays_remaining_leaves_user,base.group_hr_user,1,1,1,1
access_resource_calendar_leaves_manager,resource_calendar_leaves_manager,resource.model_resource_calendar_leaves,base.group_hr_manager,1,1,1,1
access_crm_meeting_type_manager,crm.meeting.type.manager,base_calendar.model_crm_meeting_type,base.group_hr_manager,1,1,1,1

1 id name model_id:id group_id:id perm_read perm_write perm_create perm_unlink
5 access_hr_holydays_status_employee hr.holidays.status employee model_hr_holidays_status base.group_user 1 0 0 0
6 access_hr_holidays_remain_user hr.holidays.ramain.user model_hr_holidays_remaining_leaves_user base.group_hr_user 1 1 1 1
7 access_resource_calendar_leaves_manager resource_calendar_leaves_manager resource.model_resource_calendar_leaves base.group_hr_manager 1 1 1 1
8 access_crm_meeting_type_manager crm.meeting.type.manager base_calendar.model_crm_meeting_type base.group_hr_manager 1 1 1 1

View File

@ -198,6 +198,13 @@ class account_analytic_account(osv.osv):
_columns = {
'use_timesheets': fields.boolean('Timesheets', help="Check this field if this project manages timesheets"),
}
def on_change_template(self, cr, uid, ids, template_id, context=None):
res = super(account_analytic_account, self).on_change_template(cr, uid, ids, template_id, context=context)
if template_id and 'value' in res:
template = self.browse(cr, uid, template_id, context=context)
res['value']['use_timesheets'] = template.use_timesheets
return res
account_analytic_account()

View File

@ -90,32 +90,28 @@ class account_analytic_line(osv.osv):
context2 = context.copy()
context2['lang'] = partner.lang
cr.execute("SELECT product_id, to_invoice, sum(unit_amount), product_uom_id " \
cr.execute("SELECT product_id, to_invoice, sum(unit_amount), product_uom_id, name " \
"FROM account_analytic_line as line " \
"WHERE account_id = %s " \
"AND id IN %s AND to_invoice IS NOT NULL " \
"GROUP BY product_id,to_invoice,product_uom_id", (account.id, tuple(ids),))
"GROUP BY product_id, to_invoice, product_uom_id, name", (account.id, tuple(ids),))
for product_id, factor_id, qty, uom in cr.fetchall():
product = product_obj.browse(cr, uid, product_id, context2)
for product_id, factor_id, qty, uom, line_name in cr.fetchall():
if data.get('product'):
product_id = data['product'][0]
product = product_obj.browse(cr, uid, product_id, context=context2)
if not product:
raise osv.except_osv(_('Error'), _('At least one line has no product !'))
factor_name = ''
factor = invoice_factor_obj.browse(cr, uid, factor_id, context2)
if not data.get('product', False):
if factor.customer_name:
factor_name = product.name+' - '+factor.customer_name
else:
factor_name = product.name
else:
data['product'] = data['product'][0]
factor_name = product_obj.name_get(cr, uid, [data['product']], context=context)[0][1]
raise osv.except_osv(_('Error'), _('There is no product defined for the line %s. Please select one or force the product through the wizard.') % (line_name))
factor = invoice_factor_obj.browse(cr, uid, factor_id, context=context2)
factor_name = product_obj.name_get(cr, uid, [product_id], context=context2)[0][1]
if factor.customer_name:
factor_name += ' - ' + factor.customer_name
ctx = context.copy()
ctx.update({'uom':uom})
if account.pricelist_id:
pl = account.pricelist_id.id
price = pro_price_obj.price_get(cr,uid,[pl], data.get('product', False) or product_id, qty or 1.0, account.partner_id.id, context=ctx)[pl]
price = pro_price_obj.price_get(cr,uid,[pl], product_id, qty or 1.0, account.partner_id.id, context=ctx)[pl]
else:
price = 0.0
@ -131,7 +127,7 @@ class account_analytic_line(osv.osv):
'invoice_line_tax_id': [(6,0,tax )],
'invoice_id': last_invoice,
'name': factor_name,
'product_id': data.get('product',product_id),
'product_id': product_id,
'invoice_line_tax_id': [(6,0,tax)],
'uos_id': uom,
'account_id': account_id,
@ -179,7 +175,7 @@ class hr_timesheet_invoice_create(osv.osv_memory):
'time': fields.boolean('Time spent', help='The time of each work done will be displayed on the invoice'),
'name': fields.boolean('Description', help='The detail of each work done will be displayed on the invoice'),
'price': fields.boolean('Cost', help='The cost of each work done will be displayed on the invoice. You probably don\'t want to check this'),
'product': fields.many2one('product.product', 'Product', help='Fill this field only if you want to force to use a specific product. Keep empty to use the real product that comes from the cost.'),
'product': fields.many2one('product.product', 'Force Product', help='Fill this field only if you want to force to use a specific product. Keep empty to use the real product that comes from the cost.'),
}
_defaults = {

View File

@ -20,22 +20,31 @@
##############################################################################
import time
from report import report_sxw
from report_webkit import webkit_report
from report_webkit import report_helper
from osv import osv
from tools import mod10r
import sys
import os
import re
from mako.template import Template
from mako.lookup import TemplateLookup
from mako import exceptions
from report import report_sxw
from report_webkit import webkit_report
from report_webkit import report_helper
from osv import osv
from osv.osv import except_osv
from tools import mod10r
from tools.translate import _
from tools.config import config
import wizard
import addons
import pooler
from tools.config import config
from mako.template import Template
from mako import exceptions
from tools.translate import _
from osv.osv import except_osv
class l10n_ch_report_webkit_html(report_sxw.rml_parse):
@ -143,53 +152,26 @@ class l10n_ch_report_webkit_html(report_sxw.rml_parse):
'digits!\nPlease check your company '
'information for the invoice:\n%s') %(invoice_name)))
return ''
def mako_template(text):
"""Build a Mako template.
This template uses UTF-8 encoding
"""
tmp_lookup = TemplateLookup() #we need it in order to allow inclusion and inheritance
return Template(text, input_encoding='utf-8', output_encoding='utf-8', lookup=tmp_lookup)
class BVRWebKitParser(webkit_report.WebKitParser):
def setLang(self, lang):
if not lang:
lang = 'en_US'
self.localcontext['lang'] = lang
def formatLang(self, value, digits=None, date=False, date_time=False, grouping=True, monetary=False):
"""format using the know cursor, language from localcontext"""
if digits is None:
digits = self.parser_instance.get_digits(value)
if isinstance(value, (str, unicode)) and not value:
return ''
pool_lang = self.pool.get('res.lang')
lang = self.localcontext['lang']
lang_ids = pool_lang.search(self.parser_instance.cr, self.parser_instance.uid, [('code','=',lang)])[0]
lang_obj = pool_lang.browse(self.parser_instance.cr, self.parser_instance.uid, lang_ids)
if date or date_time:
if not str(value):
return ''
date_format = lang_obj.date_format
parse_format = '%Y-%m-%d'
if date_time:
value=value.split('.')[0]
date_format = date_format + " " + lang_obj.time_format
parse_format = '%Y-%m-%d %H:%M:%S'
if not isinstance(value, time.struct_time):
return time.strftime(date_format, time.strptime(value, parse_format))
else:
date = datetime(*value.timetuple()[:6])
return date.strftime(date_format)
return lang_obj.format('%.' + str(digits) + 'f', value, grouping=grouping, monetary=monetary)
def create_single_pdf(self, cursor, uid, ids, data, report_xml, context=None):
"""generate the PDF"""
self.parser_instance = self.parser(
cursor,
context = context or {}
if report_xml.report_type != 'webkit':
return super(WebKitParser,self).create_single_pdf(cursor, uid, ids, data, report_xml, context=context)
self.parser_instance = self.parser(cursor,
uid,
self.name2,
context=context
)
context=context)
self.pool = pooler.get_pool(cursor.dbname)
objs = self.getObjects(cursor, uid, ids, context)
self.parser_instance.set_context(objs, data, ids, report_xml.report_type)
@ -201,7 +183,7 @@ class BVRWebKitParser(webkit_report.WebKitParser):
if not template and report_xml.report_webkit_data :
template = report_xml.report_webkit_data
if not template :
raise except_osv(_('Webkit Report template not found !'), _(''))
raise except_osv(_('Error'),_('Webkit Report template not found !'))
header = report_xml.webkit_header.html
footer = report_xml.webkit_header.footer_html
if not header and report_xml.header:
@ -210,43 +192,19 @@ class BVRWebKitParser(webkit_report.WebKitParser):
_('Please set a header in company settings')
)
if not report_xml.header :
#I know it could be cleaner ...
header = u"""
<html>
<head>
<style type="text/css">
${css}
</style>
<script>
function subst() {
var vars={};
var x=document.location.search.substring(1).split('&');
for(var i in x) {var z=x[i].split('=',2);vars[z[0]] = unescape(z[1]);}
var x=['frompage','topage','page','webpage','section','subsection','subsubsection'];
for(var i in x) {
var y = document.getElementsByClassName(x[i]);
for(var j=0; j<y.length; ++j) y[j].textContent = vars[x[i]];
}
}
</script>
</head>
<body style="border:0; margin: 0;" onload="subst()">
</body>
</html>"""
self.parser_instance.localcontext.update({'setLang':self.setLang})
self.parser_instance.localcontext.update({'formatLang':self.formatLang})
header = ''
default_head = addons.get_module_resource('report_webkit', 'default_header.html')
with open(default_head,'r') as f:
header = f.read()
css = report_xml.webkit_header.css
if not css :
css = ''
user = self.pool.get('res.users').browse(cursor, uid, uid)
company = user.company_id
parse_template = template
#default_filters=['unicode', 'entity'] can be used to set global filter
body_mako_tpl = Template(parse_template ,input_encoding='utf-8', output_encoding='utf-8')
body_mako_tpl = mako_template(template)
#BVR specific
bvr_path = addons.get_module_resource(os.path.join('l10n_ch','report','bvr.mako'))
body_bvr_tpl = Template(file(bvr_path).read(), input_encoding='utf-8', output_encoding='utf-8')
body_bvr_tpl = mako_template(file(bvr_path).read())
helper = report_helper.WebKitHelper(cursor, uid, report_xml.id, context)
##BVR Specific
htmls = []
@ -254,58 +212,48 @@ class BVRWebKitParser(webkit_report.WebKitParser):
self.parser_instance.localcontext['objects'] = [obj]
if not company.bvr_only:
try:
html = body_mako_tpl.render(
helper=helper,
html = body_mako_tpl.render(helper=helper,
css=css,
_=self.translate_call,
**self.parser_instance.localcontext
)
**self.parser_instance.localcontext)
except Exception, e:
raise Exception(exceptions.text_error_template().render())
htmls.append(html)
if not company.invoice_only:
try:
bvr = body_bvr_tpl.render(
helper=helper,
css=css,
_=self.translate_call,
**self.parser_instance.localcontext
)
bvr = body_bvr_tpl.render(helper=helper,
css=css,
_=self.translate_call,
**self.parser_instance.localcontext)
except Exception, e:
raise Exception(exceptions.text_error_template().render())
htmls.append(bvr)
head_mako_tpl = Template(header, input_encoding='utf-8', output_encoding='utf-8')
try:
head = head_mako_tpl.render(
helper=helper,
head = head_mako_tpl.render(helper=helper,
css=css,
_debug=False,
_=self.translate_call,
**self.parser_instance.localcontext
)
**self.parser_instance.localcontext)
except Exception, e:
raise Exception(exceptions.text_error_template().render())
foot = False
if footer and company.invoice_only :
foot_mako_tpl = Template(footer, input_encoding='utf-8', output_encoding='utf-8')
try:
foot = foot_mako_tpl.render(
helper=helper,
foot = foot_mako_tpl.render(helper=helper,
css=css,
_=self.translate_call,
**self.parser_instance.localcontext
)
**self.parser_instance.localcontext)
except Exception, e:
raise Exception(exceptions.text_error_template().render())
if report_xml.webkit_debug :
try:
deb = head_mako_tpl.render(
helper=helper,
deb = head_mako_tpl.render(helper=helper,
css=css,
_debug=html,
_=self.translate_call,
**self.parser_instance.localcontext
)
**self.parser_instance.localcontext)
except Exception, e:
raise Exception(exceptions.text_error_template().render())
return (deb, 'html')

View File

@ -81,8 +81,7 @@
<field name="arch" type="xml">
<search string="Messages Search">
<field name="user_id"/>
<field name="body"/>
<field name="subject" filter_domain="['|', ('subject', 'ilike', self), ('record_name', 'ilike', self)]" />
<field name="subject" string="Content" filter_domain="['|', ('subject', 'ilike', self), ('body', 'ilike', self)]" />
<field name="type"/>
<filter icon="terp-personal+" string="My Feeds"
name="my_feeds" help="My Feeds"

View File

@ -843,10 +843,15 @@ openerp.mail = function(session) {
this.ds = new session.web.DataSet(this, this.view.model);
this.ds_users = new session.web.DataSet(this, 'res.users');
},
start: function() {
var self = this;
this._super.apply(this, arguments);
// NB: all the widget should be modified to check the actual_mode property on view, not use
// any other method to know if the view is in create mode anymore
this.view.on("change:actual_mode", this, this._check_visibility);
this._check_visibility();
mail.ChatterUtils.bind_events(this);
this.$element.find('button.oe_mail_button_followers').click(function () { self.do_toggle_followers(); });
if (! this.params.see_subscribers_options) {
@ -859,7 +864,11 @@ openerp.mail = function(session) {
.mouseleave(function () { $(this).html('Following').removeClass('oe_mail_button_mouseover').addClass('oe_mail_button_mouseout'); });
this.reinit();
},
_check_visibility: function() {
this.$element.toggle(this.view.get("actual_mode") !== "create");
},
destroy: function () {
this._super.apply(this, arguments);
},

View File

@ -1226,6 +1226,13 @@ class account_analytic_account(osv.osv):
'use_tasks': fields.boolean('Tasks Mgmt.',help="If check,this contract will be available in the project menu and you will be able to manage tasks or track issues"),
'company_uom_id': fields.related('company_id', 'project_time_mode_id', type='many2one', relation='product.uom'),
}
def on_change_template(self, cr, uid, ids, template_id, context=None):
res = super(account_analytic_account, self).on_change_template(cr, uid, ids, template_id, context=context)
if template_id and 'value' in res:
template = self.browse(cr, uid, template_id, context=context)
res['value']['use_tasks'] = template.use_tasks
return res
def _trigger_project_creation(self, cr, uid, vals, context=None):
'''

View File

@ -1,6 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data noupdate="1">
<!-- This will set the unit of measure used in projects and tasks.-->
<record id="base.main_company" model="res.company">
<field name="project_time_mode_id" ref="product.uom_hour"></field>
</record>
<!-- Requests Links -->
<record id="req_link_project" model="res.request.link">

View File

@ -274,9 +274,6 @@
<!--
Resource: project.project
-->
<record id="base.main_company" model="res.company">
<field name="project_time_mode_id" ref="product.product_uom_hour"></field>
</record>
<!-- Projects -->
<!-- <record id="all_projects_account" model="project.project">

View File

@ -593,6 +593,13 @@ class account_analytic_account(osv.osv):
'use_issues' : fields.boolean('Issues Tracking', help="Check this field if this project manages issues"),
}
def on_change_template(self, cr, uid, ids, template_id, context=None):
res = super(account_analytic_account, self).on_change_template(cr, uid, ids, template_id, context=context)
if template_id and 'value' in res:
template = self.browse(cr, uid, template_id, context=context)
res['value']['use_issues'] = template.use_issues
return res
def _trigger_project_creation(self, cr, uid, vals, context=None):
res = super(account_analytic_account, self)._trigger_project_creation(cr, uid, vals, context=context)
return res or vals.get('use_issues')

View File

@ -275,6 +275,13 @@ class account_analytic_account(osv.osv):
_columns = {
'use_phases': fields.boolean('Phases Planing', help="Check this field if project manages phases"),
}
def on_change_template(self, cr, uid, ids, template_id, context=None):
res = super(account_analytic_account, self).on_change_template(cr, uid, ids, template_id, context=context)
if template_id and 'value' in res:
template = self.browse(cr, uid, template_id, context=context)
res['value']['use_phases'] = template.use_phases
return res
def _trigger_project_creation(self, cr, uid, vals, context=None):
res= super(account_analytic_account, self)._trigger_project_creation(cr, uid, vals, context=context)

View File

@ -156,9 +156,11 @@
<button name="invoice_corrected" states="invoice_except" string="Ignore Exception"/>
<button name="ship_recreate" states="shipping_except" string="Recreate Delivery Order"/>
<button name="ship_corrected" states="shipping_except" string="Ignore Exception"/>
<button name="action_quotation_send" string="Send by Mail" type="object" states="draft,sent"/>
<button name="print_quotation" string="Send by Post" type="object" states="draft,sent"/>
<button name="action_button_confirm" states="draft" string="Confirm" type="object" class="oe_highlight"/>
<button name="action_quotation_send" string="Send by Mail" type="object" states="draft" class="oe_highlight"/>
<button name="action_quotation_send" string="Send by Mail" type="object" states="sent"/>
<button name="print_quotation" string="Send by Post" type="object" states="draft" class="oe_highlight"/>
<button name="print_quotation" string="Send by Post" type="object" states="sent"/>
<button name="action_button_confirm" states="draft" string="Confirm" type="object"/>
<button name="action_button_confirm" states="sent" string="Confirm" class="oe_highlight" type="object"/>
<button name="action_view_invoice" string="Open Invoice" type="object" class="oe_highlight"
attrs="{'invisible': ['|','|',('state', '!=','progress'), ('invoiced', '=', True),('order_policy','=','picking')]}"/>

View File

@ -738,7 +738,7 @@
<!-- <button name="action_assign" states="confirmed" string="Check Availability" type="object"/> -->
<button name="force_assign" states="confirmed" string="Force Availability" type="object" class="oe_highlight"/>
<button name="action_process" states="assigned" string="Confirm &amp; Transfer" groups="stock.group_stock_user" type="object" class="oe_highlight"/>
<button name="%(action_stock_invoice_onshipping)d" string="Create Invoice" attrs="{'invisible': ['|','|',('state','&lt;&gt;','done'),('invoice_state','=','invoiced'),('invoice_state','=','none')]}" type="action" class="oe_highlight"/>
<button name="%(action_stock_invoice_onshipping)d" string="Create Invoice/Refund" attrs="{'invisible': ['|','|',('state','&lt;&gt;','done'),('invoice_state','=','invoiced'),('invoice_state','=','none')]}" type="action" class="oe_highlight"/>
<button name="%(act_stock_return_picking)d" string="Reverse Transfer" states="done" type="action"/>
<button name="button_cancel" states="assigned,confirmed,draft" string="_Cancel"/>
<field name="state" widget="statusbar" statusbar_visible="draft,assigned,done" statusbar_colors='{"shipping_except":"red","invoice_except":"red","waiting_date":"blue"}'/>

View File

@ -98,9 +98,15 @@ class stock_partial_picking(osv.osv_memory):
if context is None: context = {}
res = super(stock_partial_picking, self).default_get(cr, uid, fields, context=context)
picking_ids = context.get('active_ids', [])
if context['active_model'] == 'purchase.order':
active_model = context.get('active_model')
if active_model == 'purchase.order':
for purchase_order in self.pool.get('purchase.order').browse(cr, uid, picking_ids, context=context):
picking_ids = [picking_id.id for picking_id in purchase_order.picking_ids]
elif active_model == 'sale.order':
for sale_order in self.pool.get('sale.order').browse(cr, uid, picking_ids, context=context):
picking_ids = [picking.id for picking in sale_order.picking_ids]
if not picking_ids or len(picking_ids) != 1:
# Partial Picking Processing may only be done for one picking at a time
return res
@ -108,7 +114,7 @@ class stock_partial_picking(osv.osv_memory):
# (already seen in previous bug where context passed was containing ir.ui.menu as active_model and the menu
# ID as active_id). Though this should be fixed in clients now, this place is sensitive enough to ensure the
# consistancy of the context.
assert context.get('active_model') in ('stock.picking', 'stock.picking.in', 'stock.picking.out', 'purchase.order'), 'Bad context propagation'
assert active_model in ('stock.picking', 'stock.picking.in', 'stock.picking.out', 'purchase.order', 'sale.order'), 'Bad context propagation'
picking_id, = picking_ids
if 'picking_id' in fields:
res.update(picking_id=picking_id)