diff --git a/addons/account/account_invoice.py b/addons/account/account_invoice.py index 39cc471c2f6..bef6e68221a 100644 --- a/addons/account/account_invoice.py +++ b/addons/account/account_invoice.py @@ -610,15 +610,15 @@ class account_invoice(osv.osv): res[r[0]].append( r[1] ) return res - def copy(self, cr, uid, id, default={}, context=None): - if context is None: - context = {} + def copy(self, cr, uid, id, default=None, context=None): + default = default or {} default.update({ 'state':'draft', 'number':False, 'move_id':False, 'move_name':False, 'internal_number': False, + 'period_id': False, }) if 'date_invoice' not in default: default.update({ @@ -1642,12 +1642,7 @@ class res_partner(osv.osv): } def copy(self, cr, uid, id, default=None, context=None): - if default is None: - default = {} - - if context is None: - context = {} - + default = default or {} default.update({'invoice_ids' : []}) return super(res_partner, self).copy(cr, uid, id, default, context) diff --git a/addons/account_voucher/account_voucher.py b/addons/account_voucher/account_voucher.py index 535f76b8d64..2b63157ef30 100644 --- a/addons/account_voucher/account_voucher.py +++ b/addons/account_voucher/account_voucher.py @@ -91,10 +91,10 @@ class account_voucher(osv.osv): return False def _get_payment_rate_currency(self, cr, uid, context=None): - ''' + """ Return the default value for field payment_rate_currency_id: the currency of the journal if there is one, otherwise the currency of the user's company - ''' + """ if context is None: context = {} journal_pool = self.pool.get('account.journal') journal_id = context.get('journal_id', False) @@ -141,20 +141,22 @@ class account_voucher(osv.osv): def fields_view_get(self, cr, uid, view_id=None, view_type=False, context=None, toolbar=False, submenu=False): mod_obj = self.pool.get('ir.model.data') if context is None: context = {} - if not view_id and context.get('invoice_type', False): - if context.get('invoice_type', False) in ('out_invoice', 'out_refund'): - result = mod_obj.get_object_reference(cr, uid, 'account_voucher', 'view_vendor_receipt_form') - else: - result = mod_obj.get_object_reference(cr, uid, 'account_voucher', 'view_vendor_payment_form') - result = result and result[1] or False - view_id = result - if not view_id and view_type == 'form' and context.get('line_type', False): - if context.get('line_type', False) == 'customer': - result = mod_obj.get_object_reference(cr, uid, 'account_voucher', 'view_vendor_receipt_form') - else: - result = mod_obj.get_object_reference(cr, uid, 'account_voucher', 'view_vendor_payment_form') - result = result and result[1] or False - view_id = result + + if view_type == 'form': + if not view_id and context.get('invoice_type'): + if context.get('invoice_type') in ('out_invoice', 'out_refund'): + result = mod_obj.get_object_reference(cr, uid, 'account_voucher', 'view_vendor_receipt_form') + else: + result = mod_obj.get_object_reference(cr, uid, 'account_voucher', 'view_vendor_payment_form') + result = result and result[1] or False + view_id = result + if not view_id and context.get('line_type'): + if context.get('line_type') == 'customer': + result = mod_obj.get_object_reference(cr, uid, 'account_voucher', 'view_vendor_receipt_form') + else: + result = mod_obj.get_object_reference(cr, uid, 'account_voucher', 'view_vendor_payment_form') + result = result and result[1] or False + view_id = result res = super(account_voucher, self).fields_view_get(cr, uid, view_id=view_id, view_type=view_type, context=context, toolbar=toolbar, submenu=submenu) doc = etree.XML(res['arch']) diff --git a/addons/account_voucher/voucher_payment_receipt_view.xml b/addons/account_voucher/voucher_payment_receipt_view.xml index 5cf9b42be0b..01095d2f265 100644 --- a/addons/account_voucher/voucher_payment_receipt_view.xml +++ b/addons/account_voucher/voucher_payment_receipt_view.xml @@ -205,6 +205,7 @@ + @@ -356,6 +357,7 @@ + diff --git a/addons/mrp/mrp_view.xml b/addons/mrp/mrp_view.xml index dafe399b583..eb1070ac941 100644 --- a/addons/mrp/mrp_view.xml +++ b/addons/mrp/mrp_view.xml @@ -522,6 +522,7 @@ mrp.bom [('id','=',active_id)] tree + tree @@ -776,7 +777,7 @@ - + @@ -972,7 +973,7 @@ - + - +