Forward port of branch 7.0 up to b3485fb
This commit is contained in:
commit
7e33a4746b
|
@ -121,14 +121,18 @@ class account_invoice_line(osv.osv):
|
||||||
if inv.currency_id.id != company_currency:
|
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})
|
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:
|
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)
|
# price with discount and without tax included
|
||||||
line.update({'price': round(valuation_price_unit * line['quantity'], account_prec)})
|
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({
|
diff_res.append({
|
||||||
'type': 'src',
|
'type': 'src',
|
||||||
'name': i_line.name[:64],
|
'name': i_line.name[:64],
|
||||||
'price_unit': price_diff,
|
'price_unit': round(price_diff / line['quantity'], account_prec),
|
||||||
'quantity': line['quantity'],
|
'quantity': line['quantity'],
|
||||||
'price': round(price_diff * line['quantity'], account_prec),
|
'price': price_diff,
|
||||||
'account_id': acc,
|
'account_id': acc,
|
||||||
'product_id': line['product_id'],
|
'product_id': line['product_id'],
|
||||||
'uos_id': line['uos_id'],
|
'uos_id': line['uos_id'],
|
||||||
|
|
|
@ -99,7 +99,7 @@ class event_event(osv.osv):
|
||||||
reg_ids = register_pool.search(cr, uid, [
|
reg_ids = register_pool.search(cr, uid, [
|
||||||
('event_id', '=', event.id),
|
('event_id', '=', event.id),
|
||||||
('state', 'not in', ['draft', 'cancel'])], context=context)
|
('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)
|
return self.write(cr, uid, ids, {'state': 'confirm'}, context=context)
|
||||||
|
|
||||||
def button_confirm(self, cr, uid, ids, context=None):
|
def button_confirm(self, cr, uid, ids, context=None):
|
||||||
|
@ -128,7 +128,7 @@ class event_event(osv.osv):
|
||||||
res = {}
|
res = {}
|
||||||
for event in self.browse(cr, uid, ids, context=context):
|
for event in self.browse(cr, uid, ids, context=context):
|
||||||
res[event.id] = False
|
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:
|
if curr_reg_id:
|
||||||
for reg in register_pool.browse(cr, uid, curr_reg_id, context=context):
|
for reg in register_pool.browse(cr, uid, curr_reg_id, context=context):
|
||||||
if reg.state in ('open','done'):
|
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])])
|
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
|
#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:
|
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:
|
else:
|
||||||
register_pool.write(cr, uid, curr_reg_ids, {'nb_register': num_of_seats}, context=context)
|
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)
|
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):
|
def unsubscribe_to_event(self, cr, uid, ids, context=None):
|
||||||
register_pool = self.pool.get('event.registration')
|
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
|
#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)
|
return register_pool.button_reg_cancel(cr, SUPERUSER_ID, curr_reg_ids, context=context)
|
||||||
|
|
||||||
def _check_closing_date(self, cr, uid, ids, context=None):
|
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):
|
def onchange_event_type(self, cr, uid, ids, type_event, context=None):
|
||||||
values = {}
|
values = {}
|
||||||
if type_event:
|
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 ={
|
dic ={
|
||||||
'reply_to': type_info.default_reply_to,
|
'reply_to': type_info.default_reply_to,
|
||||||
'email_registration_id': type_info.default_email_registration.id,
|
'email_registration_id': type_info.default_email_registration.id,
|
||||||
|
|
Loading…
Reference in New Issue