[MERGE] forward port of branch 7.0 up to 35077af

This commit is contained in:
Christophe Simonis 2015-04-01 19:07:59 +02:00
commit 12f600cec9
9 changed files with 42 additions and 37 deletions

View File

@ -1723,13 +1723,10 @@ class account_invoice_tax(osv.osv):
cur_obj = self.pool.get('res.currency')
company_obj = self.pool.get('res.company')
company_currency = False
factor = 1
if ids:
factor = self.read(cr, uid, ids[0], ['factor_tax'])['factor_tax']
if company_id:
company_currency = company_obj.read(cr, uid, [company_id], ['currency_id'])[0]['currency_id'][0]
if currency_id and company_currency:
amount = cur_obj.compute(cr, uid, currency_id, company_currency, amount*factor, context={'date': date_invoice or fields.date.context_today(self, cr, uid)}, round=False)
amount = cur_obj.compute(cr, uid, currency_id, company_currency, amount, context={'date': date_invoice or fields.date.context_today(self, cr, uid)}, round=False)
return {'value': {'tax_amount': amount}}
_order = 'sequence'

View File

@ -23,6 +23,7 @@ import time
import re
from openerp.report import report_sxw
from common_report_header import common_report_header
from openerp import SUPERUSER_ID
from openerp.tools.translate import _
class third_party_ledger(report_sxw.rml_parse, common_report_header):
@ -95,6 +96,7 @@ class third_party_ledger(report_sxw.rml_parse, common_report_header):
if (data['model'] == 'res.partner') and ids:
PARTNER_REQUEST = "AND l.partner_id IN %s"
params += [tuple(ids)]
reconcile = "" if self.reconcil else "AND l.reconcile_id IS NULL "
self.cr.execute(
"SELECT DISTINCT l.partner_id " \
"FROM account_move_line AS l, account_account AS account, " \
@ -103,12 +105,12 @@ class third_party_ledger(report_sxw.rml_parse, common_report_header):
"AND l.account_id = account.id " \
"AND am.id = l.move_id " \
"AND am.state IN %s"
# "AND " + self.query +" " \
"AND " + self.query +" " \
"AND l.account_id IN %s " \
" " + PARTNER_REQUEST + " " \
"AND account.active ", params)
"AND account.active " + reconcile + " ", params)
self.partner_ids = [res['partner_id'] for res in self.cr.dictfetchall()]
objects = obj_partner.browse(self.cr, self.uid, self.partner_ids)
objects = obj_partner.browse(self.cr, SUPERUSER_ID, self.partner_ids)
objects.sort(key=lambda x: (x.ref, x.name))
return super(third_party_ledger, self).set_context(objects, data, self.partner_ids, report_type)

View File

@ -38,6 +38,9 @@ class account_open_closed_fiscalyear(osv.osv_memory):
if not period_journal:
raise osv.except_osv(_('Error!'), _("You have to set the 'End of Year Entries Journal' for this Fiscal Year which is set after generating opening entries from 'Generate Opening Entries'."))
if period_journal.period_id.state == 'done':
raise osv.except_osv(_('Error!'), _("You can not cancel closing entries if the 'End of Year Entries Journal' period is closed."))
ids_move = move_obj.search(cr, uid, [('journal_id','=',period_journal.journal_id.id),('period_id','=',period_journal.period_id.id)])
if ids_move:
cr.execute('delete from account_move where id IN %s', (tuple(ids_move),))

View File

@ -369,7 +369,7 @@ class mail_thread(osv.AbstractModel):
# auto_subscribe: take values and defaults into account
create_values = dict(values)
for key, val in context.iteritems():
if key.startswith('default_'):
if key.startswith('default_') and key[8:] not in create_values:
create_values[key[8:]] = val
self.message_auto_subscribe(cr, uid, [thread_id], create_values.keys(), context=context, values=create_values)

View File

@ -512,23 +512,20 @@
<field name="name"/>
<field name="category_id"/>
<field name="uom_type" on_change="onchange_type(uom_type)"/>
<label for="factor"/>
<div>
<field name="factor"
digits="[42,5]"
attrs="{'invisible':[('uom_type','!=','smaller')],
'readonly':[('uom_type','=','bigger')]}"/>
<field name="factor_inv"
digits="[42,5]"
attrs="{'invisible':[('uom_type','!=','bigger')],
'readonly':[('uom_type','!=','bigger')]}"/>
<p attrs="{'invisible':[('uom_type','!=','smaller')]}" class="oe_grey">
e.g: 1 * (reference unit) = ratio * (this unit)
</p>
<p attrs="{'invisible':[('uom_type','!=','bigger')]}" class="oe_grey">
e.g: 1 * (this unit) = ratio * (reference unit)
</p>
</div>
<field name="factor"
digits="[42,5]"
attrs="{'invisible':[('uom_type','!=','smaller')],
'readonly':[('uom_type','=','bigger')]}"/>
<field name="factor_inv"
digits="[42,5]"
attrs="{'invisible':[('uom_type','!=','bigger')],
'readonly':[('uom_type','!=','bigger')]}"/>
<p attrs="{'invisible':[('uom_type','!=','smaller')]}" class="oe_grey" colspan="2">
e.g: 1 * (reference unit) = ratio * (this unit)
</p>
<p attrs="{'invisible':[('uom_type','!=','bigger')]}" class="oe_grey" colspan="2">
e.g: 1 * (this unit) = ratio * (reference unit)
</p>
</group>
<group>
<field name="active"/>

View File

@ -670,7 +670,6 @@ class task(osv.osv):
res[task.id]['progress'] = 0.0
if (task.remaining_hours + hours.get(task.id, 0.0)):
res[task.id]['progress'] = round(min(100.0 * hours.get(task.id, 0.0) / res[task.id]['total_hours'], 99.99),2)
# TDE CHECK: if task.state in ('done','cancelled'):
if task.stage_id and task.stage_id.fold:
res[task.id]['progress'] = 100.0
return res
@ -879,18 +878,23 @@ class task(osv.osv):
def fields_view_get(self, cr, uid, view_id=None, view_type='form', context=None, toolbar=False, submenu=False):
users_obj = self.pool.get('res.users')
if context is None: context = {}
# read uom as admin to avoid access rights issues, e.g. for portal/share users,
# this should be safe (no context passed to avoid side-effects)
obj_tm = users_obj.browse(cr, SUPERUSER_ID, uid, context=context).company_id.project_time_mode_id
tm = obj_tm and obj_tm.name or 'Hours'
res = super(task, self).fields_view_get(cr, uid, view_id, view_type, context, toolbar, submenu=submenu)
if tm in ['Hours','Hour']:
# read uom as admin to avoid access rights issues, e.g. for portal/share users,
# this should be safe (no context passed to avoid side-effects)
obj_tm = users_obj.browse(cr, SUPERUSER_ID, uid, context=context).company_id.project_time_mode_id
try:
# using get_object to get translation value
uom_hour = self.pool['ir.model.data'].get_object(cr, uid, 'product', 'product_uom_hour', context=context)
except ValueError:
uom_hour = False
if not obj_tm or not uom_hour or obj_tm.id == uom_hour.id:
return res
eview = etree.fromstring(res['arch'])
# if the project_time_mode_id is not in hours (so in days), display it as a float field
def _check_rec(eview):
if eview.attrib.get('widget','') == 'float_time':
eview.set('widget','float')
@ -902,9 +906,13 @@ class task(osv.osv):
res['arch'] = etree.tostring(eview)
# replace reference of 'Hours' to 'Day(s)'
for f in res['fields']:
# TODO this NOT work in different language than english
# the field 'Initially Planned Hours' should be replaced by 'Initially Planned Days'
# but string 'Initially Planned Days' is not available in translation
if 'Hours' in res['fields'][f]['string']:
res['fields'][f]['string'] = res['fields'][f]['string'].replace('Hours',tm)
res['fields'][f]['string'] = res['fields'][f]['string'].replace('Hours', obj_tm.name)
return res
def get_empty_list_help(self, cr, uid, help, context=None):

View File

@ -588,9 +588,6 @@
<field name="model">product.product</field>
<field name="inherit_id" ref="product.product_search_form_view"/>
<field name="arch" type="xml">
<filter name="filter_to_sell" position="before">
<filter name="filter_to_purchase" string="To Purchase" icon="terp-accessories-archiver+" domain="[('purchase_ok', '=', 1)]"/>
</filter>
<filter name="filter_to_sell" position="after">
<filter name="filter_to_purchase" string="Can be Purchased" icon="terp-accessories-archiver+" domain="[('purchase_ok', '=', 1)]"/>
</filter>

View File

@ -219,7 +219,8 @@ class purchase_order(osv.osv):
if po.requisition_id and all(purchase_id.state in ['draft', 'cancel'] for purchase_id in po.requisition_id.purchase_ids if purchase_id.id != po.id):
procurement_ids = self.pool['procurement.order'].search(cr, uid, [('requisition_id', '=', po.requisition_id.id)], context=context)
for procurement in proc_obj.browse(cr, uid, procurement_ids, context=context):
procurement.move_id.write({'location_id': procurement.move_id.location_dest_id.id})
if procurement.move_id:
procurement.move_id.write({'location_id': procurement.move_id.location_dest_id.id})
return res

View File

@ -1643,7 +1643,7 @@ instance.web.json_node_to_xml = function(node, human_readable, indent) {
cr = human_readable ? '\n' : '';
if (typeof(node) === 'string') {
return sindent + node;
return sindent + node.replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/>/g, '&gt;').replace(/"/g, '&quot;');
} else if (typeof(node.tag) !== 'string' || !node.children instanceof Array || !node.attrs instanceof Object) {
throw new Error(
_.str.sprintf(_t("Node [%s] is not a JSONified XML node"),