diff --git a/addons/account/account.py b/addons/account/account.py index 5f20c858cf8..a14c44405b9 100644 --- a/addons/account/account.py +++ b/addons/account/account.py @@ -1463,6 +1463,7 @@ class account_move(osv.osv): line_id = self.pool.get('account.move.line').create(cr, uid, { 'name': _(mode.capitalize()+' Centralisation'), 'centralisation': mode, + 'partner_id': False, 'account_id': account_id, 'move_id': move.id, 'journal_id': move.journal_id.id, @@ -1501,6 +1502,7 @@ class account_move(osv.osv): line_id = self.pool.get('account.move.line').create(cr, uid, { 'name': _('Currency Adjustment'), 'centralisation': 'currency', + 'partner_id': False, 'account_id': account_id, 'move_id': move.id, 'journal_id': move.journal_id.id, diff --git a/addons/account/account_invoice.py b/addons/account/account_invoice.py index c9cf90789cb..250a0446534 100644 --- a/addons/account/account_invoice.py +++ b/addons/account/account_invoice.py @@ -1484,11 +1484,10 @@ class account_invoice_line(osv.osv): new_price = res_final['value']['price_unit'] * currency.rate res_final['value']['price_unit'] = new_price - if result['uos_id'] != res.uom_id.id: - selected_uom = self.pool.get('product.uom_id').browse(cr, uid, result['uos_id'], context=context) - if res.uom_id.category_id.id == selected_uom.category_id.id: - new_price = res_final['value']['price_unit'] * uom_id.factor_inv - res_final['value']['price_unit'] = new_price + if result['uos_id'] and result['uos_id'] != res.uom_id.id: + selected_uom = self.pool.get('product.uom').browse(cr, uid, result['uos_id'], context=context) + new_price = self.pool.get('product.uom')._compute_price(cr, uid, res.uom_id.id, res_final['value']['price_unit'], result['uos_id']) + res_final['value']['price_unit'] = new_price return res_final def uos_id_change(self, cr, uid, ids, product, uom, qty=0, name='', type='out_invoice', partner_id=False, fposition_id=False, price_unit=False, currency_id=False, context=None, company_id=None): diff --git a/addons/account/account_view.xml b/addons/account/account_view.xml index c8246a187f5..5e072c3d258 100644 --- a/addons/account/account_view.xml +++ b/addons/account/account_view.xml @@ -97,7 +97,7 @@
diff --git a/addons/account/wizard/account_open_closed_fiscalyear_view.xml b/addons/account/wizard/account_open_closed_fiscalyear_view.xml index d4cfd398920..16ddfc1f1ac 100644 --- a/addons/account/wizard/account_open_closed_fiscalyear_view.xml +++ b/addons/account/wizard/account_open_closed_fiscalyear_view.xml @@ -5,8 +5,8 @@ account.open.closed.fiscalyear.form account.open.closed.fiscalyear - - + +

This wizard will remove the end of year journal entries of selected fiscal year. Note that you can run this wizard many times for the same fiscal year.

@@ -14,7 +14,7 @@ This wizard will remove the end of year journal entries of selected fiscal year.
-
@@ -23,7 +23,7 @@ This wizard will remove the end of year journal entries of selected fiscal year. - Cancel Opening Entries + Cancel Closing Entries account.open.closed.fiscalyear form tree,form diff --git a/addons/auth_signup/res_users.py b/addons/auth_signup/res_users.py index 5c558ca68d7..b35ff274a6d 100644 --- a/addons/auth_signup/res_users.py +++ b/addons/auth_signup/res_users.py @@ -52,7 +52,7 @@ class res_partner(osv.Model): (not partner.signup_expiration or dt <= partner.signup_expiration) return res - def _get_signup_url_for_action(self, cr, uid, ids, action='login', view_type=None, menu_id=None, res_id=None, context=None): + def _get_signup_url_for_action(self, cr, uid, ids, action='login', view_type=None, menu_id=None, res_id=None, model=None, context=None): """ generate a signup url for the given partner ids and action, possibly overriding the url state components (menu_id, id, view_type) """ res = dict.fromkeys(ids, False) @@ -61,6 +61,7 @@ class res_partner(osv.Model): # when required, make sure the partner has a valid signup token if context and context.get('signup_valid') and not partner.user_ids: self.signup_prepare(cr, uid, [partner.id], context=context) + partner.refresh() # the parameters to encode for the query and fragment part of url query = {'db': cr.dbname} @@ -78,6 +79,8 @@ class res_partner(osv.Model): fragment['view_type'] = view_type if menu_id: fragment['menu_id'] = menu_id + if model: + fragment['model'] = model if res_id: fragment['id'] = res_id diff --git a/addons/crm/crm_lead.py b/addons/crm/crm_lead.py index 3fae85f311d..2fb81a005c0 100644 --- a/addons/crm/crm_lead.py +++ b/addons/crm/crm_lead.py @@ -397,7 +397,8 @@ class crm_lead(base_stage, format_address, osv.osv): search_domain += [('|')] * len(section_ids) for section_id in section_ids: search_domain.append(('section_ids', '=', section_id)) - search_domain.append(('case_default', '=', True)) + else: + search_domain.append(('case_default', '=', True)) # AND with cases types search_domain.append(('type', 'in', types)) # AND with the domain in parameter @@ -423,15 +424,15 @@ class crm_lead(base_stage, format_address, osv.osv): def case_mark_lost(self, cr, uid, ids, context=None): """ Mark the case as lost: state=cancel and probability=0 """ for lead in self.browse(cr, uid, ids): - stage_id = self.stage_find(cr, uid, [lead], lead.section_id.id or False, [('probability', '=', 0.0)], context=context) + stage_id = self.stage_find(cr, uid, [lead], lead.section_id.id or False, [('probability', '=', 0.0),('on_change','=',True)], context=context) if stage_id: self.case_set(cr, uid, [lead.id], values_to_update={'probability': 0.0}, new_stage_id=stage_id, context=context) return True def case_mark_won(self, cr, uid, ids, context=None): - """ Mark the case as lost: state=done and probability=100 """ + """ Mark the case as won: state=done and probability=100 """ for lead in self.browse(cr, uid, ids): - stage_id = self.stage_find(cr, uid, [lead], lead.section_id.id or False, [('probability', '=', 100.0)], context=context) + stage_id = self.stage_find(cr, uid, [lead], lead.section_id.id or False, [('probability', '=', 100.0),('on_change','=',True)], context=context) if stage_id: self.case_set(cr, uid, [lead.id], values_to_update={'probability': 100.0}, new_stage_id=stage_id, context=context) return True @@ -677,29 +678,23 @@ class crm_lead(base_stage, format_address, osv.osv): contact_id = False if customer: contact_id = self.pool.get('res.partner').address_get(cr, uid, [customer.id])['default'] - if not section_id: section_id = lead.section_id and lead.section_id.id or False - - if section_id: - stage_ids = crm_stage.search(cr, uid, [('sequence', '>=', 1), ('section_ids', '=', section_id), ('probability', '>', 0)]) - else: - stage_ids = crm_stage.search(cr, uid, [('sequence', '>=', 1), ('probability', '>', 0)]) - stage_id = stage_ids and stage_ids[0] or False - - return { + val = { 'planned_revenue': lead.planned_revenue, 'probability': lead.probability, 'name': lead.name, 'partner_id': customer and customer.id or False, 'user_id': (lead.user_id and lead.user_id.id), 'type': 'opportunity', - 'stage_id': stage_id or False, 'date_action': fields.datetime.now(), 'date_open': fields.datetime.now(), 'email_from': customer and customer.email or lead.email_from, 'phone': customer and customer.phone or lead.phone, } + if not lead.stage_id or lead.stage_id.type=='lead': + val['stage_id'] = self.stage_find(cr, uid, [lead], section_id, [('state', '=', 'draft'),('type', 'in', ('opportunity','both'))], context=context) + return val def convert_opportunity(self, cr, uid, ids, partner_id, user_ids=False, section_id=False, context=None): customer = False @@ -966,6 +961,11 @@ class crm_lead(base_stage, format_address, osv.osv): # Mail Gateway # ---------------------------------------- + def message_get_reply_to(self, cr, uid, ids, context=None): + """ Override to get the reply_to of the parent project. """ + return [lead.section_id.message_get_reply_to()[0] if lead.section_id else False + for lead in self.browse(cr, uid, ids, context=context)] + def message_new(self, cr, uid, msg, custom_values=None, context=None): """ Overrides mail_thread message_new that is called by the mailgateway through message_process. diff --git a/addons/crm/crm_lead_data.xml b/addons/crm/crm_lead_data.xml index da677972b8b..bb590f49d73 100644 --- a/addons/crm/crm_lead_data.xml +++ b/addons/crm/crm_lead_data.xml @@ -65,6 +65,7 @@ Lost + cancel diff --git a/addons/crm/crm_lead_view.xml b/addons/crm/crm_lead_view.xml index 24837cff586..3d7bd45a209 100644 --- a/addons/crm/crm_lead_view.xml +++ b/addons/crm/crm_lead_view.xml @@ -514,7 +514,7 @@ - + diff --git a/addons/document_page/document_page_view.xml b/addons/document_page/document_page_view.xml index d8daaada967..08c77647d17 100644 --- a/addons/document_page/document_page_view.xml +++ b/addons/document_page/document_page_view.xml @@ -53,7 +53,7 @@