[MERGE] forward port of branch saas-3 up to 12f600c
This commit is contained in:
commit
8ad11055bb
|
@ -1520,12 +1520,11 @@ class account_invoice_tax(models.Model):
|
|||
|
||||
@api.multi
|
||||
def amount_change(self, amount, currency_id=False, company_id=False, date_invoice=False):
|
||||
factor = self.factor_tax if self else 1
|
||||
company = self.env['res.company'].browse(company_id)
|
||||
if currency_id and company.currency_id:
|
||||
currency = self.env['res.currency'].browse(currency_id)
|
||||
currency = currency.with_context(date=date_invoice or fields.Date.context_today(self))
|
||||
amount = currency.compute(amount * factor, company.currency_id, round=False)
|
||||
amount = currency.compute(amount, company.currency_id, round=False)
|
||||
return {'value': {'tax_amount': amount}}
|
||||
|
||||
@api.v8
|
||||
|
|
|
@ -24,7 +24,7 @@ from openerp.osv import osv
|
|||
from openerp.tools.translate import _
|
||||
from openerp.report import report_sxw
|
||||
from common_report_header import common_report_header
|
||||
|
||||
from openerp import SUPERUSER_ID
|
||||
|
||||
class third_party_ledger(report_sxw.rml_parse, common_report_header):
|
||||
|
||||
|
@ -101,6 +101,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, " \
|
||||
|
@ -109,12 +110,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 = sorted(objects, key=lambda x: (x.ref, x.name))
|
||||
return super(third_party_ledger, self).set_context(objects, data, self.partner_ids, report_type)
|
||||
|
||||
|
|
|
@ -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),))
|
||||
|
|
|
@ -393,7 +393,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)
|
||||
|
||||
|
|
|
@ -597,8 +597,6 @@
|
|||
<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')],
|
||||
|
@ -607,13 +605,12 @@
|
|||
digits="[42,5]"
|
||||
attrs="{'invisible':[('uom_type','!=','bigger')],
|
||||
'readonly':[('uom_type','!=','bigger')]}"/>
|
||||
<p attrs="{'invisible':[('uom_type','!=','smaller')]}" class="oe_grey">
|
||||
<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">
|
||||
<p attrs="{'invisible':[('uom_type','!=','bigger')]}" class="oe_grey" colspan="2">
|
||||
e.g: 1 * (this unit) = ratio * (reference unit)
|
||||
</p>
|
||||
</div>
|
||||
</group>
|
||||
<group>
|
||||
<field name="active"/>
|
||||
|
|
|
@ -660,7 +660,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
|
||||
|
@ -843,18 +842,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')
|
||||
|
@ -866,9 +870,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):
|
||||
|
|
|
@ -1658,7 +1658,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, '&').replace(/</g, '<').replace(/>/g, '>').replace(/"/g, '"');
|
||||
} 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"),
|
||||
|
|
Loading…
Reference in New Issue