diff --git a/addons/account/models/account_invoice.py b/addons/account/models/account_invoice.py index 19121cdd05a..44f9c0661ca 100644 --- a/addons/account/models/account_invoice.py +++ b/addons/account/models/account_invoice.py @@ -451,30 +451,16 @@ class AccountInvoice(models.Model): payment_term_id = False fiscal_position = False bank_id = False - p = self.partner_id company_id = self.company_id.id + p = self.partner_id if not company_id else self.partner_id.with_context(force_company=company_id) type = self.type if p: - partner_id = p.id rec_account = p.property_account_receivable_id pay_account = p.property_account_payable_id - if company_id: - if p.property_account_receivable_id.company_id and \ - p.property_account_receivable_id.company_id.id != company_id and \ - p.property_account_payable_id.company_id and \ - p.property_account_payable_id.company_id.id != company_id: - prop = self.env['ir.property'] - rec_dom = [('name', '=', 'property_account_receivable_id'), ('company_id', '=', company_id)] - pay_dom = [('name', '=', 'property_account_payable_id'), ('company_id', '=', company_id)] - res_dom = [('res_id', '=', 'res.partner,%s' % partner_id)] - rec_prop = prop.search(rec_dom + res_dom) or prop.search(rec_dom) - pay_prop = prop.search(pay_dom + res_dom) or prop.search(pay_dom) - rec_account = rec_prop.get_by_record() - pay_account = pay_prop.get_by_record() - if not rec_account and not pay_account: - action = self.env.ref('account.action_account_config') - msg = _('Cannot find a chart of accounts for this company, You should configure it. \nPlease go to Account Configuration.') - raise RedirectWarning(msg, action.id, _('Go to the configuration panel')) + if not rec_account and not pay_account: + action = self.env.ref('account.action_account_config') + msg = _('Cannot find a chart of accounts for this company, You should configure it. \nPlease go to Account Configuration.') + raise RedirectWarning(msg, action.id, _('Go to the configuration panel')) if type in ('out_invoice', 'out_refund'): account_id = rec_account.id @@ -539,7 +525,7 @@ class AccountInvoice(models.Model): @api.multi def get_formview_id(self): """ Update form view id of action to open the invoice """ - if self.type == 'in_invoice': + if self.type in ('in_invoice', 'in_refund'): return self.env.ref('account.invoice_supplier_form').id else: return self.env.ref('account.invoice_form').id diff --git a/addons/account/models/account_move.py b/addons/account/models/account_move.py index 9fffdc30236..ec4070178d5 100644 --- a/addons/account/models/account_move.py +++ b/addons/account/models/account_move.py @@ -830,7 +830,14 @@ class AccountMoveLine(models.Model): #if writeoff_acc_id specified, then create write-off move with value the remaining amount from move in self if writeoff_acc_id and writeoff_journal_id and remaining_moves: - writeoff_to_reconcile = remaining_moves._create_writeoff({'account_id': writeoff_acc_id.id, 'journal_id': writeoff_journal_id.id}) + all_aml_share_same_currency = all([x.currency_id == self[0].currency_id for x in self]) + writeoff_vals = { + 'account_id': writeoff_acc_id.id, + 'journal_id': writeoff_journal_id.id + } + if not all_aml_share_same_currency: + writeoff_vals['amount_currency'] = False + writeoff_to_reconcile = remaining_moves._create_writeoff(writeoff_vals) #add writeoff line to reconcile algo and finish the reconciliation remaining_moves = (remaining_moves + writeoff_to_reconcile).auto_reconcile_lines() diff --git a/addons/calendar/calendar_data.xml b/addons/calendar/calendar_data.xml index 772f6772971..d02c1028745 100644 --- a/addons/calendar/calendar_data.xml +++ b/addons/calendar/calendar_data.xml @@ -118,12 +118,12 @@
|
- ${object.event_id.get_interval(object.event_id.start, 'dayname', tz=object.partner_id.tz)}
+ ${object.event_id.get_interval(object.event_id.start, 'dayname', tz=object.partner_id.tz if not object.event_id.allday else None)}
- ${object.event_id.get_interval(object.event_id.start,'day', tz=object.partner_id.tz)}
+ ${object.event_id.get_interval(object.event_id.start,'day', tz=object.partner_id.tz if not object.event_id.allday else None)}
- ${object.event_id.get_interval(object.event_id.start, 'month', tz=object.partner_id.tz)}
+ ${object.event_id.get_interval(object.event_id.start, 'month', tz=object.partner_id.tz if not object.event_id.allday else None)}
${not object.event_id.allday and object.event_id.get_interval(object.event_id.start, 'time', tz=object.partner_id.tz) or ''}
|
@@ -210,12 +210,12 @@ |
|
- ${object.event_id.get_interval(object.event_id.start, 'dayname', tz=object.partner_id.tz)}
+ ${object.event_id.get_interval(object.event_id.start, 'dayname', tz=object.partner_id.tz if not object.event_id.allday else None)}
- ${object.event_id.get_interval(object.event_id.start,'day', tz=object.partner_id.tz)}
+ ${object.event_id.get_interval(object.event_id.start,'day', tz=object.partner_id.tz if not object.event_id.allday else None)}
- ${object.event_id.get_interval(object.event_id.start, 'month', tz=object.partner_id.tz)}
+ ${object.event_id.get_interval(object.event_id.start, 'month', tz=object.partner_id.tz if not object.event_id.allday else None)}
${not object.event_id.allday and object.event_id.get_interval(object.event_id.start, 'time', tz=object.partner_id.tz) or ''}
|
@@ -302,12 +302,12 @@ |
|
- ${object.event_id.get_interval(object.event_id.start, 'dayname', tz=object.partner_id.tz)}
+ ${object.event_id.get_interval(object.event_id.start, 'dayname', tz=object.partner_id.tz if not object.event_id.allday else None)}
- ${object.event_id.get_interval(object.event_id.start,'day', tz=object.partner_id.tz)}
+ ${object.event_id.get_interval(object.event_id.start,'day', tz=object.partner_id.tz if not object.event_id.allday else None)}
- ${object.event_id.get_interval(object.event_id.start, 'month', tz=object.partner_id.tz)}
+ ${object.event_id.get_interval(object.event_id.start, 'month', tz=object.partner_id.tz if not object.event_id.allday else None)}
${not object.event_id.allday and object.event_id.get_interval(object.event_id.start, 'time', tz=object.partner_id.tz) or ''}
|
diff --git a/addons/calendar/calendar_view.xml b/addons/calendar/calendar_view.xml index 2cf77cd2162..8fbd66a8a93 100644 --- a/addons/calendar/calendar_view.xml +++ b/addons/calendar/calendar_view.xml @@ -101,18 +101,19 @@ |