diff --git a/addons/account_anglo_saxon/invoice.py b/addons/account_anglo_saxon/invoice.py index 1b2bc15b7ad..d4dc1bba23f 100644 --- a/addons/account_anglo_saxon/invoice.py +++ b/addons/account_anglo_saxon/invoice.py @@ -121,14 +121,18 @@ class account_invoice_line(osv.osv): if inv.currency_id.id != company_currency: valuation_price_unit = self.pool.get('res.currency').compute(cr, uid, company_currency, inv.currency_id.id, valuation_price_unit, context={'date': inv.date_invoice}) if valuation_price_unit != i_line.price_unit and line['price_unit'] == i_line.price_unit and acc: - price_diff = round(i_line.price_unit - valuation_price_unit, account_prec) - line.update({'price': round(valuation_price_unit * line['quantity'], account_prec)}) + # price with discount and without tax included + price_unit = self.pool['account.tax'].compute_all(cr, uid, line['taxes'], + i_line.price_unit * (1-(i_line.discount or 0.0)/100.0), line['quantity'])['total'] + price_line = round(valuation_price_unit * line['quantity'], account_prec) + price_diff = round(price_unit - price_line, account_prec) + line.update({'price': price_line}) diff_res.append({ 'type': 'src', 'name': i_line.name[:64], - 'price_unit': price_diff, + 'price_unit': round(price_diff / line['quantity'], account_prec), 'quantity': line['quantity'], - 'price': round(price_diff * line['quantity'], account_prec), + 'price': price_diff, 'account_id': acc, 'product_id': line['product_id'], 'uos_id': line['uos_id'], diff --git a/addons/event/event.py b/addons/event/event.py index 79072a2646b..ec3e60797cc 100644 --- a/addons/event/event.py +++ b/addons/event/event.py @@ -99,7 +99,7 @@ class event_event(osv.osv): reg_ids = register_pool.search(cr, uid, [ ('event_id', '=', event.id), ('state', 'not in', ['draft', 'cancel'])], context=context) - register_pool.mail_user_confirm(cr, uid, reg_ids) + register_pool.mail_user_confirm(cr, uid, reg_ids, context=context) return self.write(cr, uid, ids, {'state': 'confirm'}, context=context) def button_confirm(self, cr, uid, ids, context=None): @@ -128,7 +128,7 @@ class event_event(osv.osv): res = {} for event in self.browse(cr, uid, ids, context=context): res[event.id] = False - curr_reg_id = register_pool.search(cr, uid, [('user_id', '=', uid), ('event_id', '=' ,event.id)]) + curr_reg_id = register_pool.search(cr, uid, [('user_id', '=', uid), ('event_id', '=' ,event.id)], context=context) if curr_reg_id: for reg in register_pool.browse(cr, uid, curr_reg_id, context=context): if reg.state in ('open','done'): @@ -197,7 +197,7 @@ class event_event(osv.osv): curr_reg_ids = register_pool.search(cr, uid, [('user_id', '=', user.id), ('event_id', '=' , ids[0])]) #the subscription is done with SUPERUSER_ID because in case we share the kanban view, we want anyone to be able to subscribe if not curr_reg_ids: - curr_reg_ids = [register_pool.create(cr, SUPERUSER_ID, {'event_id': ids[0] ,'email': user.email, 'name':user.name, 'user_id': user.id, 'nb_register': num_of_seats})] + curr_reg_ids = [register_pool.create(cr, SUPERUSER_ID, {'event_id': ids[0] ,'email': user.email, 'name':user.name, 'user_id': user.id, 'nb_register': num_of_seats}, context=context)] else: register_pool.write(cr, uid, curr_reg_ids, {'nb_register': num_of_seats}, context=context) return register_pool.confirm_registration(cr, SUPERUSER_ID, curr_reg_ids, context=context) @@ -205,7 +205,7 @@ class event_event(osv.osv): def unsubscribe_to_event(self, cr, uid, ids, context=None): register_pool = self.pool.get('event.registration') #the unsubscription is done with SUPERUSER_ID because in case we share the kanban view, we want anyone to be able to unsubscribe - curr_reg_ids = register_pool.search(cr, SUPERUSER_ID, [('user_id', '=', uid), ('event_id', '=', ids[0])]) + curr_reg_ids = register_pool.search(cr, SUPERUSER_ID, [('user_id', '=', uid), ('event_id', '=', ids[0])], context=context) return register_pool.button_reg_cancel(cr, SUPERUSER_ID, curr_reg_ids, context=context) def _check_closing_date(self, cr, uid, ids, context=None): @@ -221,7 +221,7 @@ class event_event(osv.osv): def onchange_event_type(self, cr, uid, ids, type_event, context=None): values = {} if type_event: - type_info = self.pool.get('event.type').browse(cr,uid,type_event,context) + type_info = self.pool.get('event.type').browse(cr,uid,type_event, context=context) dic ={ 'reply_to': type_info.default_reply_to, 'email_registration_id': type_info.default_email_registration.id,