[IMP] event: code cleaning
bzr revid: psi@tinyerp.co.in-20101011060752-wycy59vnqnb11k2s
This commit is contained in:
parent
d10e1e83af
commit
301ff85dca
|
@ -90,10 +90,10 @@ class event_event(crm.crm_case, osv.osv):
|
|||
#send reminder that will confirm the event for all the people that were already confirmed
|
||||
reg_ids = register_pool.search(cr, uid, [
|
||||
('event_id', '=', event.id),
|
||||
('state', 'not in', ['draft', 'cancel'])])
|
||||
('state', 'not in', ['draft', 'cancel'])], context=context)
|
||||
register_pool.mail_user_confirm(cr, uid, reg_ids)
|
||||
|
||||
return self.write(cr, uid, ids, {'state': 'confirm'})
|
||||
return self.write(cr, uid, ids, {'state': 'confirm'}, context=context)
|
||||
|
||||
def button_confirm(self, cr, uid, ids, context=None):
|
||||
"""This Function Confirm Event.
|
||||
|
@ -116,7 +116,7 @@ class event_event(crm.crm_case, osv.osv):
|
|||
unconfirmed_ids.append(event.id)
|
||||
if unconfirmed_ids:
|
||||
view_id = data_pool._get_id(cr, uid, 'event', 'view_event_confirm')
|
||||
view_data = data_pool.browse(cr, uid, view_id)
|
||||
view_data = data_pool.browse(cr, uid, view_id, context=context)
|
||||
view_id = view_data.res_id
|
||||
context['event_ids'] = unconfirmed_ids
|
||||
return {
|
||||
|
@ -143,7 +143,7 @@ class event_event(crm.crm_case, osv.osv):
|
|||
"""
|
||||
register_pool = self.pool.get('event.registration')
|
||||
res = {}
|
||||
for event in self.browse(cr, uid, ids, context):
|
||||
for event in self.browse(cr, uid, ids, context=context):
|
||||
res[event.id] = {}
|
||||
for field in fields:
|
||||
res[event.id][field] = False
|
||||
|
@ -155,11 +155,11 @@ class event_event(crm.crm_case, osv.osv):
|
|||
|
||||
reg_ids = register_pool.search(cr, uid, [
|
||||
('event_id', '=', event.id),
|
||||
('state', 'in', state)])
|
||||
('state', 'in', state)], context=context)
|
||||
|
||||
number = 0.0
|
||||
if reg_ids:
|
||||
cr.execute('select sum(nb_register) from event_registration where id IN %s', (tuple(reg_ids),))
|
||||
cr.execute('SELECT SUM(nb_register) FROM event_registration WHERE id IN %s', (tuple(reg_ids),))
|
||||
number = cr.fetchone()
|
||||
if 'register_current' in fields:
|
||||
res[event.id]['register_current'] = number and number[0]
|
||||
|
@ -194,8 +194,8 @@ class event_event(crm.crm_case, osv.osv):
|
|||
register_values['description'] = vals['mail_confirm']
|
||||
|
||||
if register_values:
|
||||
reg_ids = register_pool.search(cr, uid, [('event_id', '=', event.id)])
|
||||
register_pool.write(cr, uid, reg_ids, register_values)
|
||||
reg_ids = register_pool.search(cr, uid, [('event_id', '=', event.id)], context=context)
|
||||
register_pool.write(cr, uid, reg_ids, register_values, context=context)
|
||||
return res
|
||||
|
||||
_columns = {
|
||||
|
@ -231,7 +231,7 @@ class event_event(crm.crm_case, osv.osv):
|
|||
'pricelist_id': fields.many2one('product.pricelist', 'Pricelist', readonly=True, states={'draft': [('readonly', False)]}, help="Pricelist version for current event."),
|
||||
'unit_price': fields.related('product_id', 'list_price', type='float', string='Registration Cost', readonly=True, states={'draft':[('readonly',False)]}, help="This will be the default price used as registration cost when invoicing this event. Note that you can specify for each registration a specific amount if you want to", digits_compute=dp.get_precision('Sale Price')),
|
||||
'main_speaker_id': fields.many2one('res.partner','Main Speaker', readonly=False, states={'done': [('readonly', True)]}, help="Speaker who are giving speech on event."),
|
||||
'speaker_ids':fields.many2many('res.partner', 'event_speaker_rel', 'speaker_id', 'partner_id', 'Other Speakers', readonly=False, states={'done': [('readonly', True)]}),
|
||||
'speaker_ids': fields.many2many('res.partner', 'event_speaker_rel', 'speaker_id', 'partner_id', 'Other Speakers', readonly=False, states={'done': [('readonly', True)]}),
|
||||
'address_id': fields.many2one('res.partner.address','Location Address', readonly=False, states={'done': [('readonly', True)]}),
|
||||
'speaker_confirmed': fields.boolean('Speaker Confirmed', readonly=False, states={'done': [('readonly', True)]}),
|
||||
'country_id': fields.related('address_id', 'country_id',
|
||||
|
@ -239,7 +239,6 @@ class event_event(crm.crm_case, osv.osv):
|
|||
'language': fields.char('Language',size=64, readonly=False, states={'done': [('readonly', True)]}),
|
||||
'note': fields.text('Description', readonly=False, states={'done': [('readonly', True)]}),
|
||||
'company_id': fields.many2one('res.company', 'Company', required=False, change_default=True, readonly=False, states={'done': [('readonly', True)]}),
|
||||
|
||||
}
|
||||
|
||||
_defaults = {
|
||||
|
@ -256,7 +255,7 @@ class event_event(crm.crm_case, osv.osv):
|
|||
level = 100
|
||||
|
||||
while len(ids):
|
||||
cr.execute('select distinct parent_id from event_event where id IN %s', (tuple(ids),))
|
||||
cr.execute('SELECT DISTINCT parent_id FROM event_event WHERE id IN %s', (tuple(ids),))
|
||||
ids = filter(None, map(lambda x: x[0], cr.fetchall()))
|
||||
if not level:
|
||||
return False
|
||||
|
@ -359,7 +358,7 @@ class event_registration(osv.osv):
|
|||
val_invoice = inv_pool.onchange_partner_id(cr, uid, [], 'out_invoice', reg.partner_invoice_id.id, False, False)
|
||||
val_invoice['value'].update({'partner_id': reg.partner_invoice_id.id})
|
||||
|
||||
inv_lines_pool.product_id_change(cr, uid, [], reg.event_id.product_id.id, uom =False, partner_id=reg.partner_invoice_id.id, fposition_id=reg.partner_invoice_id.property_account_position.id)
|
||||
inv_lines_pool.product_id_change(cr, uid, [], reg.event_id.product_id.id, uom=False, partner_id=reg.partner_invoice_id.id, fposition_id=reg.partner_invoice_id.property_account_position.id)
|
||||
|
||||
val_invoice['value'].update({
|
||||
'origin': reg.event_product,
|
||||
|
@ -368,7 +367,7 @@ class event_registration(osv.osv):
|
|||
'comment': "",
|
||||
'date_invoice': context.get('date_inv', False)
|
||||
})
|
||||
inv_id = inv_pool.create(cr, uid, val_invoice['value'])
|
||||
inv_id = inv_pool.create(cr, uid, val_invoice['value'], context=context)
|
||||
inv_pool.button_compute(cr, uid, [inv_id])
|
||||
self.history(cr, uid, [reg], _('Invoiced'))
|
||||
return inv_id
|
||||
|
@ -469,12 +468,12 @@ class event_registration(osv.osv):
|
|||
for registration in self.browse(cr, uid, ids, context=context):
|
||||
total_confirmed = registration.event_id.register_current + registration.nb_register
|
||||
if total_confirmed <= registration.event_id.register_max or registration.event_id.register_max == 0:
|
||||
self.do_open(cr, uid, [registration.id], context)
|
||||
self.do_open(cr, uid, [registration.id], context=context)
|
||||
else:
|
||||
unconfirmed_ids.append(registration.id)
|
||||
if unconfirmed_ids:
|
||||
view_id = data_pool._get_id(cr, uid, 'event', 'view_event_confirm_registration')
|
||||
view_data = data_pool.browse(cr, uid, view_id)
|
||||
view_data = data_pool.browse(cr, uid, view_id, context=context)
|
||||
view_id = view_data.res_id
|
||||
context['registration_ids'] = unconfirmed_ids
|
||||
return {
|
||||
|
@ -502,10 +501,10 @@ class event_registration(osv.osv):
|
|||
if registration.tobe_invoiced and not registration.invoice_id:
|
||||
unclosed_ids.append(registration.id)
|
||||
else:
|
||||
self.do_close(cr, uid, [registration.id])
|
||||
self.do_close(cr, uid, [registration.id], context=context)
|
||||
if unclosed_ids:
|
||||
view_id = data_pool._get_id(cr, uid, 'event', 'view_event_make_invoice')
|
||||
view_data = data_pool.browse(cr, uid, view_id)
|
||||
view_data = data_pool.browse(cr, uid, view_id, context=context)
|
||||
view_id = view_data.res_id
|
||||
context['active_ids'] = unclosed_ids
|
||||
return {
|
||||
|
@ -561,10 +560,10 @@ class event_registration(osv.osv):
|
|||
body = regestration.event_id.mail_confirm
|
||||
if subject or body:
|
||||
tools.email_send(src, email_to, subject, body, email_cc = email_cc, openobject_id = regestration.id)
|
||||
self.history(cr, uid, [regestration], subject, history=True, \
|
||||
email=email_to, details=body, \
|
||||
subject=subject, email_from=src, \
|
||||
email_cc=', '.join(email_cc))
|
||||
self.history(cr, uid, [regestration], subject, history = True, \
|
||||
email = email_to, details = body, \
|
||||
subject = subject, email_from = src, \
|
||||
email_cc = ', '.join(email_cc))
|
||||
|
||||
return True
|
||||
|
||||
|
@ -620,12 +619,17 @@ class event_registration(osv.osv):
|
|||
res_obj = self.pool.get('res.partner')
|
||||
|
||||
data_event = event_obj.browse(cr, uid, event_id)
|
||||
res = {'value': {'unit_price': False, 'event_product': False, 'user_id': False,
|
||||
'date': data_event.date_begin, 'date_deadline': data_event.date_end, 'description': data_event.note, 'name': data_event.name,
|
||||
'section_id': data_event.section_id and data_event.section_id.id or False,
|
||||
res = {'value': {'unit_price': False,
|
||||
'event_product': False,
|
||||
'user_id': False,
|
||||
'date': data_event.date_begin,
|
||||
'date_deadline': data_event.date_end,
|
||||
'description': data_event.note,
|
||||
'name': data_event.name,
|
||||
'section_id': data_event.section_id and data_event.section_id.id or False,
|
||||
}}
|
||||
if data_event.user_id.id:
|
||||
res['value'].update({'user_id':data_event.user_id.id})
|
||||
res['value'].update({'user_id': data_event.user_id.id})
|
||||
if data_event.product_id:
|
||||
pricelist_id = data_event.pricelist_id and data_event.pricelist_id.id or False
|
||||
if partner_invoice_id:
|
||||
|
@ -653,7 +657,7 @@ class event_registration(osv.osv):
|
|||
data['contact_id'], data['partner_invoice_id'], data['email_from'] = (False, False, False)
|
||||
if not part:
|
||||
return {'value': data}
|
||||
data['partner_invoice_id']=part
|
||||
data['partner_invoice_id'] = part
|
||||
# this calls onchange_partner_invoice_id
|
||||
d = self.onchange_partner_invoice_id(cr, uid, ids, event_id, part)
|
||||
# this updates the dictionary
|
||||
|
@ -677,8 +681,8 @@ class event_registration(osv.osv):
|
|||
@param event_id: Event ID
|
||||
@param partner_invoice_id: Partner Invoice ID
|
||||
"""
|
||||
data={}
|
||||
context={}
|
||||
data = {}
|
||||
context = {}
|
||||
event_obj = self.pool.get('event.event')
|
||||
prod_obj = self.pool.get('product.product')
|
||||
res_obj = self.pool.get('res.partner')
|
||||
|
@ -686,7 +690,7 @@ class event_registration(osv.osv):
|
|||
data['unit_price']=False
|
||||
if not event_id:
|
||||
return {'value': data}
|
||||
data_event = event_obj.browse(cr, uid, event_id)
|
||||
data_event = event_obj.browse(cr, uid, event_id, context=context)
|
||||
if data_event.product_id:
|
||||
data['event_product'] = data_event.product_id.name
|
||||
pricelist_id = data_event.pricelist_id and data_event.pricelist_id.id or False
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
##############################################################################
|
||||
#
|
||||
#
|
||||
# OpenERP, Open Source Management Solution
|
||||
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
|
||||
#
|
||||
|
@ -15,7 +15,7 @@
|
|||
# GNU Affero General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Affero General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
|
@ -23,7 +23,7 @@ from osv import fields, osv
|
|||
import tools
|
||||
|
||||
class report_event_registration(osv.osv):
|
||||
|
||||
|
||||
_name = "report.event.registration"
|
||||
_description = "Events on registrations and Events on type"
|
||||
_auto = False
|
||||
|
@ -31,19 +31,19 @@ class report_event_registration(osv.osv):
|
|||
_columns = {
|
||||
'date': fields.date('Date', readonly=True),
|
||||
'year': fields.char('Year', size=4, readonly=True),
|
||||
'month':fields.selection([('01','January'), ('02','February'), ('03','March'), ('04','April'),
|
||||
'month': fields.selection([('01','January'), ('02','February'), ('03','March'), ('04','April'),
|
||||
('05','May'), ('06','June'), ('07','July'), ('08','August'), ('09','September'),
|
||||
('10','October'), ('11','November'), ('12','December')], 'Month',readonly=True),
|
||||
'day': fields.char('Day', size=128, readonly=True),
|
||||
'event_id': fields.many2one('event.event', 'Event Related', required=True),
|
||||
'draft_state': fields.integer(' # No of draft Registration.', size=20),
|
||||
'confirm_state': fields.integer(' # No of Confirm Registration', size=20),
|
||||
'register_max': fields.integer('Maximum Registrations'),
|
||||
'nbevent': fields.integer('Number Of Events'),
|
||||
'day': fields.char('Day', size=128, readonly=True),
|
||||
'event_id': fields.many2one('event.event', 'Event Related', required=True),
|
||||
'draft_state': fields.integer(' # No of draft Registration.', size=20),
|
||||
'confirm_state': fields.integer(' # No of Confirm Registration', size=20),
|
||||
'register_max': fields.integer('Maximum Registrations'),
|
||||
'nbevent': fields.integer('Number Of Events'),
|
||||
'type': fields.many2one('event.type', 'Event Type'),
|
||||
'state': fields.selection([('draft', 'Draft'), ('confirm', 'Confirmed'), ('done', 'Done'), ('cancel', 'Cancelled')], 'State', readonly=True, required=True),
|
||||
'user_id':fields.many2one('res.users', 'Responsible', readonly=True),
|
||||
'speaker_id':fields.many2one('res.partner', 'Speaker', readonly=True),
|
||||
'user_id': fields.many2one('res.users', 'Responsible', readonly=True),
|
||||
'speaker_id': fields.many2one('res.partner', 'Speaker', readonly=True),
|
||||
}
|
||||
_order = 'date desc'
|
||||
def init(self, cr):
|
||||
|
@ -53,32 +53,32 @@ class report_event_registration(osv.osv):
|
|||
"""
|
||||
tools.drop_view_if_exists(cr, 'report_event_registration')
|
||||
cr.execute("""
|
||||
create or replace view report_event_registration as (
|
||||
select
|
||||
e.id as id,
|
||||
c.event_id as event_id,
|
||||
e.date_begin as date,
|
||||
e.user_id as user_id,
|
||||
e.main_speaker_id as speaker_id,
|
||||
to_char(e.date_begin, 'YYYY') as year,
|
||||
to_char(e.date_begin, 'MM') as month,
|
||||
to_char(e.date_begin, 'YYYY-MM-DD') as day,
|
||||
count(t.id) as nbevent,
|
||||
t.id as type,
|
||||
(SELECT sum(c.nb_register) FROM event_registration c WHERE c.event_id=e.id and t.id=e.type and state in ('draft')) as draft_state,
|
||||
(SELECT sum(c.nb_register) FROM event_registration c WHERE c.event_id=e.id and t.id=e.type and state in ('open')) as confirm_state,
|
||||
e.register_max as register_max,
|
||||
e.state as state
|
||||
from
|
||||
CREATE OR REPLACE view report_event_registration AS (
|
||||
SELECT
|
||||
e.id AS id,
|
||||
c.event_id AS event_id,
|
||||
e.date_begin AS date,
|
||||
e.user_id AS user_id,
|
||||
e.main_speaker_id AS speaker_id,
|
||||
to_char(e.date_begin, 'YYYY') AS year,
|
||||
to_char(e.date_begin, 'MM') AS month,
|
||||
to_char(e.date_begin, 'YYYY-MM-DD') AS day,
|
||||
count(t.id) AS nbevent,
|
||||
t.id AS type,
|
||||
(SELECT SUM(c.nb_register) FROM event_registration c WHERE c.event_id=e.id AND t.id=e.type AND state IN ('draft')) AS draft_state,
|
||||
(SELECT SUM(c.nb_register) FROM event_registration c WHERE c.event_id=e.id AND t.id=e.type AND state IN ('open')) AS confirm_state,
|
||||
e.register_max AS register_max,
|
||||
e.state AS state
|
||||
FROM
|
||||
event_event e
|
||||
inner join
|
||||
event_registration c on (e.id=c.event_id)
|
||||
inner join
|
||||
event_type t on (e.type=t.id)
|
||||
group by
|
||||
INNER JOIN
|
||||
event_registration c ON (e.id=c.event_id)
|
||||
INNER JOIN
|
||||
event_type t ON (e.type=t.id)
|
||||
GROUP BY
|
||||
to_char(e.date_begin, 'YYYY'),
|
||||
to_char(e.date_begin, 'MM'),
|
||||
t.id, e.id, e.date_begin,e.main_speaker_id,
|
||||
t.id, e.id, e.date_begin, e.main_speaker_id,
|
||||
e.register_max, e.type, e.state, c.event_id, e.user_id,
|
||||
to_char(e.date_begin, 'YYYY-MM-DD')
|
||||
)""")
|
||||
|
|
|
@ -40,6 +40,8 @@ class event_confirm_registration(osv.osv_memory):
|
|||
"""
|
||||
This function gets default values
|
||||
"""
|
||||
if context is None:
|
||||
context = {}
|
||||
registration_pool = self.pool.get('event.registration')
|
||||
registration_ids = context.get('registration_ids', [])
|
||||
res = super(event_confirm_registration, self).default_get(cr, uid, fields, context=context)
|
||||
|
@ -56,7 +58,9 @@ class event_confirm_registration(osv.osv_memory):
|
|||
res.update({'msg': msg})
|
||||
return res
|
||||
|
||||
def confirm(self, cr, uid, ids, context):
|
||||
def confirm(self, cr, uid, ids, context=None):
|
||||
if context is None:
|
||||
context = {}
|
||||
registration_pool = self.pool.get('event.registration')
|
||||
registration_ids = context.get('registration_ids', [])
|
||||
registration_pool.do_open(cr, uid, registration_ids, context=context)
|
||||
|
|
|
@ -18,6 +18,7 @@
|
|||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
from osv import fields, osv
|
||||
from tools.translate import _
|
||||
|
||||
|
@ -29,7 +30,7 @@ class event_make_invoice(osv.osv_memory):
|
|||
_description = "Event Make Invoice"
|
||||
_columns = {
|
||||
'grouped': fields.boolean('Group the invoices'),
|
||||
'invoice_date':fields.date('Invoice Date'),
|
||||
'invoice_date': fields.date('Invoice Date'),
|
||||
}
|
||||
|
||||
def view_init(self, cr, uid, fields, context=None):
|
||||
|
@ -61,7 +62,7 @@ class event_make_invoice(osv.osv_memory):
|
|||
_("Registration doesn't have any partner to invoice."))
|
||||
|
||||
def default_get(self, cr, uid, fields_list, context=None):
|
||||
return super(event_make_invoice, self).default_get(cr, uid, fields_list, context)
|
||||
return super(event_make_invoice, self).default_get(cr, uid, fields_list, context=context)
|
||||
|
||||
def make_invoice(self, cr, uid, ids, context=None):
|
||||
reg_obj = self.pool.get('event.registration')
|
||||
|
@ -70,7 +71,7 @@ class event_make_invoice(osv.osv_memory):
|
|||
if context is None:
|
||||
context = {}
|
||||
|
||||
for data in self.browse(cr, uid, ids):
|
||||
for data in self.browse(cr, uid, ids, context=context):
|
||||
res = reg_obj.action_invoice_create(cr, uid, context.get(('active_ids'),[]), data.grouped, date_inv = data.invoice_date)
|
||||
|
||||
form_id = mod_obj._get_id(cr, uid, 'account', 'invoice_form')
|
||||
|
|
|
@ -19,7 +19,6 @@
|
|||
#
|
||||
##############################################################################
|
||||
|
||||
import wizard
|
||||
import netsvc
|
||||
import tools
|
||||
from osv import fields, osv
|
||||
|
@ -53,7 +52,6 @@ class partner_event_registration(osv.osv_memory):
|
|||
value = {}
|
||||
res_obj = self.pool.get('res.partner')
|
||||
job_obj = self.pool.get('res.partner.job')
|
||||
event_obj = self.pool.get('event.event')
|
||||
reg_obj = self.pool.get('event.registration')
|
||||
mod_obj = self.pool.get('ir.model.data')
|
||||
|
||||
|
@ -62,9 +60,9 @@ class partner_event_registration(osv.osv_memory):
|
|||
contact_id = False
|
||||
email = False
|
||||
if addr.has_key('default'):
|
||||
job_ids = job_obj.search(cr, uid, [('address_id', '=', addr['default'])])
|
||||
job_ids = job_obj.search(cr, uid, [('address_id', '=', addr['default'])], context=context)
|
||||
if job_ids:
|
||||
contact = job_obj.browse(cr, uid, job_ids[0])
|
||||
contact = job_obj.browse(cr, uid, job_ids[0], context=context)
|
||||
if contact:
|
||||
contact_id = contact.contact_id.id
|
||||
email = contact.email
|
||||
|
@ -72,14 +70,13 @@ class partner_event_registration(osv.osv_memory):
|
|||
result = mod_obj._get_id(cr, uid, 'event', 'view_registration_search')
|
||||
res = mod_obj.read(cr, uid, result, ['res_id'])
|
||||
|
||||
data_obj = self.pool.get('ir.model.data')
|
||||
# Select the view
|
||||
id2 = data_obj._get_id(cr, uid, 'event', 'view_event_registration_form')
|
||||
id3 = data_obj._get_id(cr, uid, 'event', 'view_event_registration_tree')
|
||||
id2 = mod_obj._get_id(cr, uid, 'event', 'view_event_registration_form')
|
||||
id3 = mod_obj._get_id(cr, uid, 'event', 'view_event_registration_tree')
|
||||
if id2:
|
||||
id2 = data_obj.browse(cr, uid, id2, context=context).res_id
|
||||
id2 = mod_obj.browse(cr, uid, id2, context=context).res_id
|
||||
if id3:
|
||||
id3 = data_obj.browse(cr, uid, id3, context=context).res_id
|
||||
id3 = mod_obj.browse(cr, uid, id3, context=context).res_id
|
||||
|
||||
for current in self.browse(cr, uid, ids, context=context):
|
||||
for partner in res_obj.browse(cr, uid, record_ids, context=context):
|
||||
|
@ -105,7 +102,7 @@ class partner_event_registration(osv.osv_memory):
|
|||
'views': [(id2, 'form'), (id3, 'tree'), (False, 'calendar'), (False, 'graph')],
|
||||
'type': 'ir.actions.act_window',
|
||||
'search_view_id': res['res_id']
|
||||
}
|
||||
}
|
||||
return value
|
||||
|
||||
def name_get(self, cr, uid, ids, context=None):
|
||||
|
@ -118,7 +115,7 @@ class partner_event_registration(osv.osv_memory):
|
|||
res = []
|
||||
if not ids:
|
||||
return res
|
||||
reads = self.read(cr, uid, ids, ['event_type', 'event_id'], context)
|
||||
reads = self.read(cr, uid, ids, ['event_type', 'event_id'], context=context)
|
||||
for record in reads:
|
||||
event_id = record['event_id'][1]
|
||||
if record['event_type']:
|
||||
|
@ -135,13 +132,13 @@ class partner_event_registration(osv.osv_memory):
|
|||
context = {}
|
||||
partner_id = context.get('active_id', False)
|
||||
if event_id:
|
||||
event = event_obj.browse(cr, uid, event_id)
|
||||
event = event_obj.browse(cr, uid, event_id, context=context)
|
||||
pricelist_id = event.pricelist_id and event.pricelist_id.id or False
|
||||
if partner_id:
|
||||
partner = partner_obj.browse(cr, uid, partner_id, context=context)
|
||||
pricelist_id = pricelist_id or partner.property_product_pricelist.id
|
||||
unit_price = product_obj._product_price(cr, uid, [event.product_id.id], False, False, {'pricelist': pricelist_id})[event.product_id.id]
|
||||
|
||||
|
||||
res['value'] = {
|
||||
'event_type': event.type and event.type.id or False,
|
||||
'start_date': event.date_begin,
|
||||
|
|
Loading…
Reference in New Issue