Forward port of branch saas-5 up to rev 4895281e
This commit is contained in:
commit
80d8532370
|
@ -118,10 +118,6 @@ class crossovered_budget_lines(osv.osv):
|
||||||
raise osv.except_osv(_('Error!'),_("The Budget '%s' has no accounts!") % ustr(line.general_budget_id.name))
|
raise osv.except_osv(_('Error!'),_("The Budget '%s' has no accounts!") % ustr(line.general_budget_id.name))
|
||||||
date_to = line.date_to
|
date_to = line.date_to
|
||||||
date_from = line.date_from
|
date_from = line.date_from
|
||||||
if context.has_key('wizard_date_from'):
|
|
||||||
date_from = context['wizard_date_from']
|
|
||||||
if context.has_key('wizard_date_to'):
|
|
||||||
date_to = context['wizard_date_to']
|
|
||||||
if line.analytic_account_id.id:
|
if line.analytic_account_id.id:
|
||||||
cr.execute("SELECT SUM(amount) FROM account_analytic_line WHERE account_id=%s AND (date "
|
cr.execute("SELECT SUM(amount) FROM account_analytic_line WHERE account_id=%s AND (date "
|
||||||
"between to_date(%s,'yyyy-mm-dd') AND to_date(%s,'yyyy-mm-dd')) AND "
|
"between to_date(%s,'yyyy-mm-dd') AND to_date(%s,'yyyy-mm-dd')) AND "
|
||||||
|
|
|
@ -86,7 +86,7 @@ class budget_report(report_sxw.rml_parse):
|
||||||
}
|
}
|
||||||
result.append(res)
|
result.append(res)
|
||||||
|
|
||||||
line_ids = c_b_lines_obj.search(self.cr, self.uid, [('id', 'in', budget_ids), ('analytic_account_id','=',an_ids[i][0])])
|
line_ids = c_b_lines_obj.search(self.cr, self.uid, [('id', 'in', budget_ids), ('analytic_account_id','=',an_ids[i][0]), ('date_to', '>=', d_from), ('date_from', '<=', d_to)])
|
||||||
line_id = c_b_lines_obj.browse(self.cr, self.uid, line_ids)
|
line_id = c_b_lines_obj.browse(self.cr, self.uid, line_ids)
|
||||||
tot_theo = tot_pln = tot_prac = tot_perc = 0.00
|
tot_theo = tot_pln = tot_prac = tot_perc = 0.00
|
||||||
|
|
||||||
|
|
|
@ -57,7 +57,7 @@ class pad_common(osv.osv_memory):
|
||||||
#get content of the real field
|
#get content of the real field
|
||||||
for record in model.browse(cr, uid, [context["object_id"]]):
|
for record in model.browse(cr, uid, [context["object_id"]]):
|
||||||
if record[real_field]:
|
if record[real_field]:
|
||||||
myPad.setText(path, html2plaintext(record[real_field]))
|
myPad.setText(path, (html2plaintext(record[real_field]).encode('utf-8')))
|
||||||
#Etherpad for html not functional
|
#Etherpad for html not functional
|
||||||
#myPad.setHTML(path, record[real_field])
|
#myPad.setHTML(path, record[real_field])
|
||||||
|
|
||||||
|
|
|
@ -67,7 +67,8 @@ class pos_order_report(osv.osv):
|
||||||
l.product_id as product_id
|
l.product_id as product_id
|
||||||
from pos_order_line as l
|
from pos_order_line as l
|
||||||
left join pos_order s on (s.id=l.order_id)
|
left join pos_order s on (s.id=l.order_id)
|
||||||
left join product_template pt on (pt.id=l.product_id)
|
left join product_product p on (p.id=l.product_id)
|
||||||
|
left join product_template pt on (pt.id=p.product_tmpl_id)
|
||||||
left join product_uom u on (u.id=pt.uom_id)
|
left join product_uom u on (u.id=pt.uom_id)
|
||||||
group by
|
group by
|
||||||
s.date_order, s.partner_id,s.state,
|
s.date_order, s.partner_id,s.state,
|
||||||
|
|
|
@ -367,6 +367,10 @@ class ir_model_fields(osv.osv):
|
||||||
model = self.pool[vals['model']]
|
model = self.pool[vals['model']]
|
||||||
if vals['model'].startswith('x_') and vals['name'] == 'x_name':
|
if vals['model'].startswith('x_') and vals['name'] == 'x_name':
|
||||||
model._rec_name = 'x_name'
|
model._rec_name = 'x_name'
|
||||||
|
|
||||||
|
if self.pool.fields_by_model is not None:
|
||||||
|
cr.execute('SELECT * FROM ir_model_fields WHERE id=%s', (res,))
|
||||||
|
self.pool.fields_by_model.setdefault(vals['model'], []).append(cr.dictfetchone())
|
||||||
model.__init__(self.pool, cr)
|
model.__init__(self.pool, cr)
|
||||||
model._prepare_setup_fields(cr, SUPERUSER_ID)
|
model._prepare_setup_fields(cr, SUPERUSER_ID)
|
||||||
model._setup_fields(cr, SUPERUSER_ID)
|
model._setup_fields(cr, SUPERUSER_ID)
|
||||||
|
@ -446,7 +450,7 @@ class ir_model_fields(osv.osv):
|
||||||
column_rename = (obj, (obj._table, item.name, vals['name']))
|
column_rename = (obj, (obj._table, item.name, vals['name']))
|
||||||
final_name = vals['name']
|
final_name = vals['name']
|
||||||
|
|
||||||
if 'model_id' in vals and vals['model_id'] != item.model_id:
|
if 'model_id' in vals and vals['model_id'] != item.model_id.id:
|
||||||
raise except_orm(_("Error!"), _("Changing the model of a field is forbidden!"))
|
raise except_orm(_("Error!"), _("Changing the model of a field is forbidden!"))
|
||||||
|
|
||||||
if 'ttype' in vals and vals['ttype'] != item.ttype:
|
if 'ttype' in vals and vals['ttype'] != item.ttype:
|
||||||
|
|
|
@ -7,6 +7,7 @@ import test_expression
|
||||||
import test_func
|
import test_func
|
||||||
import test_ir_actions
|
import test_ir_actions
|
||||||
import test_ir_attachment
|
import test_ir_attachment
|
||||||
|
import test_ir_model
|
||||||
import test_ir_filters
|
import test_ir_filters
|
||||||
import test_ir_sequence
|
import test_ir_sequence
|
||||||
import test_ir_values
|
import test_ir_values
|
||||||
|
|
|
@ -0,0 +1,44 @@
|
||||||
|
import unittest2
|
||||||
|
|
||||||
|
import openerp.tests.common as common
|
||||||
|
|
||||||
|
class test_ir_model(common.TransactionCase):
|
||||||
|
|
||||||
|
def test_00(self):
|
||||||
|
# Create some custom model and fields
|
||||||
|
cr, uid, context = self.cr, self.uid, {}
|
||||||
|
|
||||||
|
ir_model = self.registry('ir.model')
|
||||||
|
ir_model_fields = self.registry('ir.model.fields')
|
||||||
|
ir_model_access = self.registry('ir.model.access')
|
||||||
|
candy_model_id = ir_model.create(cr, uid, {
|
||||||
|
'name': 'Candies',
|
||||||
|
'model': 'x_candy',
|
||||||
|
'info': 'List of candies',
|
||||||
|
'state': 'manual',
|
||||||
|
}, context=context)
|
||||||
|
# security rule to avoid warning
|
||||||
|
ir_model_access.create(cr, uid, {
|
||||||
|
'name': 'Candies are for everybody',
|
||||||
|
'model_id': candy_model_id,
|
||||||
|
'perm_read': True,
|
||||||
|
'perm_write': True,
|
||||||
|
'perm_create': True,
|
||||||
|
'perm_unlink': True,
|
||||||
|
})
|
||||||
|
|
||||||
|
assert self.registry('x_candy'), "Custom model not present in registry"
|
||||||
|
|
||||||
|
ir_model_fields.create(cr, uid, {
|
||||||
|
'name': 'x_name',
|
||||||
|
'field_description': 'Name',
|
||||||
|
'model_id': candy_model_id,
|
||||||
|
'state': 'manual',
|
||||||
|
'ttype': 'char',
|
||||||
|
}, context=context)
|
||||||
|
|
||||||
|
assert 'x_name' in self.registry('x_candy')._all_columns, "Custom field not present in registry"
|
||||||
|
assert self.registry('x_candy')._rec_name == 'x_name', "The _rec_name on custom model was not updated"
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
unittest2.main()
|
|
@ -510,6 +510,7 @@ def html2plaintext(html, body_id=None, encoding='utf-8'):
|
||||||
html = html.replace(' ' * 2, ' ')
|
html = html.replace(' ' * 2, ' ')
|
||||||
html = html.replace('>', '>')
|
html = html.replace('>', '>')
|
||||||
html = html.replace('<', '<')
|
html = html.replace('<', '<')
|
||||||
|
html = html.replace('&', '&')
|
||||||
|
|
||||||
# strip all lines
|
# strip all lines
|
||||||
html = '\n'.join([x.strip() for x in html.splitlines()])
|
html = '\n'.join([x.strip() for x in html.splitlines()])
|
||||||
|
@ -671,4 +672,4 @@ def email_split(text):
|
||||||
# sometimes returns emails without at least '@'. The '@'
|
# sometimes returns emails without at least '@'. The '@'
|
||||||
# is strictly required in RFC2822's `addr-spec`.
|
# is strictly required in RFC2822's `addr-spec`.
|
||||||
if addr[1]
|
if addr[1]
|
||||||
if '@' in addr[1]]
|
if '@' in addr[1]]
|
||||||
|
|
Loading…
Reference in New Issue