diff --git a/addons/account/account_pre_install.yml b/addons/account/account_pre_install.yml index e295989e698..798c0d954a5 100644 --- a/addons/account/account_pre_install.yml +++ b/addons/account/account_pre_install.yml @@ -7,7 +7,7 @@ wiz = wizards.browse(cr, uid, ref('account.account_configuration_installer_todo')) part = self.pool.get('res.partner').browse(cr, uid, ref('base.main_partner')) # if we know the country and the wizard has not yet been executed, we do it - if (part.country_id.id) and (wiz.state=='open'): + if (part.country_id.id) and (part.country_id.code) and (wiz.state=='open'): mod = 'l10n_'+part.country_id.code.lower() ids = modules.search(cr, uid, [ ('name','=',mod) ], context=context) if ids: diff --git a/addons/account_asset/account_asset.py b/addons/account_asset/account_asset.py index d061a9a1f16..4968ac09fc6 100644 --- a/addons/account_asset/account_asset.py +++ b/addons/account_asset/account_asset.py @@ -170,10 +170,6 @@ class account_asset_asset(osv.osv): for x in range(len(posted_depreciation_line_ids), undone_dotation_number): i = x + 1 amount = self._compute_board_amount(cr, uid, asset, i, residual_amount, amount_to_depr, undone_dotation_number, posted_depreciation_line_ids, total_days, depreciation_date, context=context) - company_currency = asset.company_id.currency_id.id - current_currency = asset.currency_id.id - # compute amount into company currency - amount = currency_obj.compute(cr, uid, current_currency, company_currency, amount, context=context) residual_amount -= amount vals = { 'amount': amount, @@ -214,7 +210,10 @@ class account_asset_asset(osv.osv): l.asset_id IN %s GROUP BY l.asset_id """, (tuple(ids),)) res=dict(cr.fetchall()) for asset in self.browse(cr, uid, ids, context): - res[asset.id] = asset.purchase_value - res.get(asset.id, 0.0) - asset.salvage_value + company_currency = asset.company_id.currency_id.id + current_currency = asset.currency_id.id + amount = self.pool['res.currency'].compute(cr, uid, company_currency, current_currency, res.get(asset.id, 0.0), context=context) + res[asset.id] = asset.purchase_value - amount - asset.salvage_value for id in ids: res.setdefault(id, 0.0) return res diff --git a/addons/web_kanban/static/src/js/kanban.js b/addons/web_kanban/static/src/js/kanban.js index fc9c53ed836..ab48708d9ac 100644 --- a/addons/web_kanban/static/src/js/kanban.js +++ b/addons/web_kanban/static/src/js/kanban.js @@ -28,6 +28,7 @@ instance.web_kanban.KanbanView = instance.web.View.extend({ this.group_by_field = {}; this.grouped_by_m2o = false; this.many2manys = []; + this.m2m_context = {}; this.state = { groups : {}, records : {} @@ -123,6 +124,10 @@ instance.web_kanban.KanbanView = instance.web.View.extend({ this.aggregates[node.attrs.name] = node.attrs[this.group_operators[j]]; break; } + }; + var ftype = node.attrs.widget || this.fields_view.fields[node.attrs.name].type; + if(ftype == "many2many" && "context" in node.attrs) { + this.m2m_context[node.attrs.name] = node.attrs.context; } }, transform_qweb_template: function(node) { @@ -541,7 +546,7 @@ instance.web_kanban.KanbanView = instance.web.View.extend({ var field = record.record[name]; var $el = record.$('.oe_form_field.oe_tags[name=' + name + ']').empty(); if (!relations[field.relation]) { - relations[field.relation] = { ids: [], elements: {}}; + relations[field.relation] = { ids: [], elements: {}, context: self.m2m_context[name]}; } var rel = relations[field.relation]; field.raw_value.forEach(function(id) { @@ -555,7 +560,7 @@ instance.web_kanban.KanbanView = instance.web.View.extend({ }); }); _.each(relations, function(rel, rel_name) { - var dataset = new instance.web.DataSetSearch(self, rel_name, self.dataset.get_context()); + var dataset = new instance.web.DataSetSearch(self, rel_name, self.dataset.get_context(rel.context)); dataset.name_get(_.uniq(rel.ids)).done(function(result) { result.forEach(function(nameget) { $(rel.elements[nameget[0]]).append('' + _.str.escapeHTML(nameget[1]) + ''); diff --git a/openerp/addons/base/ir/ir_sequence.py b/openerp/addons/base/ir/ir_sequence.py index d2296526394..999f12a9d18 100644 --- a/openerp/addons/base/ir/ir_sequence.py +++ b/openerp/addons/base/ir/ir_sequence.py @@ -198,7 +198,7 @@ class ir_sequence(openerp.osv.osv.osv): if new_implementation in ('standard', None): # Implementation has NOT changed. # Only change sequence if really requested. - if row['number_next'] != n: + if values.get('number_next'): self._alter_sequence(cr, row['id'], i, n) else: # Just in case only increment changed diff --git a/openerp/addons/base/tests/test_ir_sequence.py b/openerp/addons/base/tests/test_ir_sequence.py index 18b56daa58c..3064a0f7cc6 100644 --- a/openerp/addons/base/tests/test_ir_sequence.py +++ b/openerp/addons/base/tests/test_ir_sequence.py @@ -215,8 +215,33 @@ class test_ir_sequence_generate(unittest2.TestCase): drop_sequence('test_sequence_type_6') -if __name__ == '__main__': +class Test_ir_sequence_init(common.TransactionCase): + + def test_00(self): + registry, cr, uid = self.registry, self.cr, self.uid + + # test if read statement return the good number_next value (from postgreSQL sequence and not ir_sequence value) + sequence = registry('ir.sequence') + # first creation of sequence (normal) + values = {'number_next': 1, + 'company_id': 1, + 'padding': 4, + 'number_increment': 1, + 'implementation': 'standard', + 'name': 'test-sequence-00'} + seq_id = sequence.create(cr, uid, values) + # Call get next 4 times + sequence.next_by_id(cr, uid, seq_id) + sequence.next_by_id(cr, uid, seq_id) + sequence.next_by_id(cr, uid, seq_id) + read_sequence = sequence.next_by_id(cr, uid, seq_id) + # Read the value of the current sequence + assert read_sequence == "0004", 'The actual sequence value must be 4. reading : %s' % read_sequence + # reset sequence to 1 by write method calling + sequence.write(cr, uid, [seq_id], {'number_next': 1}) + # Read the value of the current sequence + read_sequence = sequence.next_by_id(cr, uid, seq_id) + assert read_sequence == "0001", 'The actual sequence value must be 1. reading : %s' % read_sequence + +if __name__ == "__main__": unittest2.main() - - -# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/openerp/addons/base/workflow/workflow.py b/openerp/addons/base/workflow/workflow.py index 75301a6e4ec..0b67b7b37c5 100644 --- a/openerp/addons/base/workflow/workflow.py +++ b/openerp/addons/base/workflow/workflow.py @@ -178,7 +178,7 @@ class wkf_workitem(osv.osv): _columns = { 'act_id': fields.many2one('workflow.activity', 'Activity', required=True, ondelete="cascade", select=True), 'wkf_id': fields.related('act_id','wkf_id', type='many2one', relation='workflow', string='Workflow'), - 'subflow_id': fields.many2one('workflow.instance', 'Subflow', ondelete="cascade", select=True), + 'subflow_id': fields.many2one('workflow.instance', 'Subflow', ondelete="set null", select=True), 'inst_id': fields.many2one('workflow.instance', 'Instance', required=True, ondelete="cascade", select=True), 'state': fields.char('Status', select=True), }