diff --git a/addons/account/account_invoice.py b/addons/account/account_invoice.py index 0271512904c..223398e4107 100644 --- a/addons/account/account_invoice.py +++ b/addons/account/account_invoice.py @@ -26,6 +26,7 @@ import openerp.exceptions from openerp.osv import fields, osv, orm from openerp.tools.translate import _ +from openerp import SUPERUSER_ID class account_invoice(osv.osv): def _amount_all(self, cr, uid, ids, name, args, context=None): @@ -98,7 +99,7 @@ class account_invoice(osv.osv): ctx = context.copy() result = {} currency_obj = self.pool.get('res.currency') - for invoice in self.browse(cr, uid, ids, context=context): + for invoice in self.browse(cr, SUPERUSER_ID, ids, context=context): nb_inv_in_partial_rec = max_invoice_id = 0 result[invoice.id] = 0.0 if invoice.move_id: @@ -319,7 +320,7 @@ class account_invoice(osv.osv): 'account.move.reconcile': (_get_invoice_from_reconcile, None, 50), }, help="Remaining amount due."), - 'payment_ids': fields.function(_compute_lines, relation='account.move.line', type="many2many", string='Payments'), + 'payment_ids': fields.function(_compute_lines, relation='account.move.line', type="many2many", string='Payments', groups='base.group_user'), 'move_name': fields.char('Journal Entry', size=64, readonly=True, states={'draft':[('readonly',False)]}), 'user_id': fields.many2one('res.users', 'Salesperson', readonly=True, track_visibility='onchange', states={'draft':[('readonly',False)]}), 'fiscal_position': fields.many2one('account.fiscal.position', 'Fiscal Position', readonly=True, states={'draft':[('readonly',False)]}), diff --git a/addons/account_followup/account_followup.py b/addons/account_followup/account_followup.py index 9237282ad80..4ed125022f8 100644 --- a/addons/account_followup/account_followup.py +++ b/addons/account_followup/account_followup.py @@ -273,7 +273,7 @@ class res_partner(osv.osv): if date <= current_date and aml['balance'] > 0: strbegin = "" strend = "" - followup_table +="" + strbegin + str(aml['date']) + strend + strbegin + aml['name'] + strend + strbegin + aml['ref'] + strend + strbegin + str(date) + strend + strbegin + str(aml['balance']) + strend + strbegin + block + strend + "" + followup_table +="" + strbegin + str(aml['date']) + strend + strbegin + aml['name'] + strend + strbegin + (aml['ref'] or '') + strend + strbegin + str(date) + strend + strbegin + str(aml['balance']) + strend + strbegin + block + strend + "" total = rml_parse.formatLang(total, dp='Account', currency_obj=currency) followup_table += ''' diff --git a/addons/portal_sale/portal_sale.py b/addons/portal_sale/portal_sale.py index aef730ab0a2..bf144080c1c 100644 --- a/addons/portal_sale/portal_sale.py +++ b/addons/portal_sale/portal_sale.py @@ -20,6 +20,7 @@ ############################################################################## from openerp.osv import osv, fields +from openerp import SUPERUSER_ID class sale_order(osv.Model): @@ -35,7 +36,7 @@ class sale_order(osv.Model): def _portal_payment_block(self, cr, uid, ids, fieldname, arg, context=None): result = dict.fromkeys(ids, False) payment_acquirer = self.pool['payment.acquirer'] - for this in self.browse(cr, uid, ids, context=context): + for this in self.browse(cr, SUPERUSER_ID, ids, context=context): if this.state not in ('draft', 'cancel') and not this.invoiced: result[this.id] = payment_acquirer.render_payment_block( cr, uid, this.name, this.amount_total, this.pricelist_id.currency_id.id, diff --git a/addons/portal_sale/security/ir.model.access.csv b/addons/portal_sale/security/ir.model.access.csv index 191b2bd82a0..2afc50fe5bb 100644 --- a/addons/portal_sale/security/ir.model.access.csv +++ b/addons/portal_sale/security/ir.model.access.csv @@ -5,16 +5,8 @@ access_account_invoice,account.invoice,account.model_account_invoice,base.group_ access_account_invoice_tax,account.invoice.tax,account.model_account_invoice_tax,base.group_portal,1,0,0,0 access_account_invoice_line,account.invoice.line,account.model_account_invoice_line,base.group_portal,1,0,0,0 access_account_journal,account.journal,account.model_account_journal,base.group_portal,1,0,0,0 -access_account_voucher,account.voucher,account_voucher.model_account_voucher,base.group_portal,1,0,0,0 -access_account_voucher_line,account.voucher.line,account_voucher.model_account_voucher_line,base.group_portal,1,0,0,0 -access_account_move,account.move,account.model_account_move,base.group_portal,1,0,0,0 -access_account_move_line,account.move.line,account.model_account_move_line,base.group_portal,1,0,0,0 -access_account_move_reconcile,account.move.reconcile,account.model_account_move_reconcile,base.group_portal,1,0,0,0 -access_account_fiscalyear,account.sequence.fiscalyear,account.model_account_sequence_fiscalyear,base.group_portal,1,0,0,0 +access_sale_shop,sale.shop,sale.model_sale_shop,base.group_portal,1,0,0,0 access_product_list,product.pricelist,product.model_product_pricelist,base.group_portal,1,0,0,0 access_res_partner,res.partner,base.model_res_partner,base.group_portal,1,0,0,0 access_account_tax,account.tax,account.model_account_tax,base.group_portal,1,0,0,0 -access_account_fiscalyear,account.fiscalyear,account.model_account_fiscalyear,base.group_portal,1,0,0,0 access_res_partner_category,res.partner.category,base.model_res_partner_category,base.group_portal,1,0,0,0 -access_account_period,account.period,account.model_account_period,base.group_portal,1,0,0,0 -access_account_account,account.account,account.model_account_account,base.group_portal,1,0,0,0 diff --git a/addons/portal_sale/security/portal_security.xml b/addons/portal_sale/security/portal_security.xml index e1328fa7cf2..bd7d8c1a53a 100644 --- a/addons/portal_sale/security/portal_security.xml +++ b/addons/portal_sale/security/portal_security.xml @@ -18,7 +18,7 @@ their documents through the portal. Portal Personal Quotations/Sales Orders - [('message_follower_ids','in',[user.partner_id.id])] + [('message_follower_ids','child_of',[user.commercial_partner_id.id])] @@ -26,17 +26,31 @@ their documents through the portal. + + Portal Sales Orders Line + + [('order_id.message_follower_ids','child_of',[user.commercial_partner_id.id])] + + + + Portal Personal Account Invoices - [('message_follower_ids','in',[user.partner_id.id])] + [('message_follower_ids','child_of',[user.commercial_partner_id.id])] + + + + Portal Invoice Lines + + [('invoice_id.message_follower_ids','child_of',[user.commercial_partner_id.id])] Portal Personal Contacts - [('message_follower_ids','in',[user.partner_id.id])] + [('message_follower_ids','in',[user.commercial_partner_id.id])] diff --git a/addons/web/controllers/main.py b/addons/web/controllers/main.py index 5030a977f18..31a2c52f99d 100644 --- a/addons/web/controllers/main.py +++ b/addons/web/controllers/main.py @@ -1709,16 +1709,18 @@ class ExportFormat(object): raise NotImplementedError() def base(self, data, token): + params = simplejson.loads(data) model, fields, ids, domain, import_compat = \ operator.itemgetter('model', 'fields', 'ids', 'domain', 'import_compat')( - simplejson.loads(data)) + params) Model = request.session.model(model) - ids = ids or Model.search(domain, 0, False, False, request.context) + context = dict(req.context or {}, **params.get('context', {})) + ids = ids or Model.search(domain, 0, False, False, context) field_names = map(operator.itemgetter('name'), fields) - import_data = Model.export_data(ids, field_names, request.context).get('datas',[]) + import_data = Model.export_data(ids, field_names, context).get('datas',[]) if import_compat: columns_headers = field_names diff --git a/addons/web/static/src/js/data_export.js b/addons/web/static/src/js/data_export.js index 252a5a378cc..e85e99eeca8 100644 --- a/addons/web/static/src/js/data_export.js +++ b/addons/web/static/src/js/data_export.js @@ -407,6 +407,7 @@ instance.web.DataExport = instance.web.Dialog.extend({ fields: exported_fields, ids: this.ids_to_export, domain: this.domain, + context: this.dataset.context, import_compat: !!this.$el.find("#import_compat").val(), })}, complete: instance.web.unblockUI, diff --git a/openerp/addons/base/ir/ir_cron.py b/openerp/addons/base/ir/ir_cron.py index 7dfe209d465..8f85beb820c 100644 --- a/openerp/addons/base/ir/ir_cron.py +++ b/openerp/addons/base/ir/ir_cron.py @@ -159,8 +159,8 @@ class ir_cron(osv.osv): must not be committed/rolled back! """ try: - now = fields.datetime.context_timestamp(job_cr, SUPERUSER_ID, datetime.now()) - nextcall = fields.datetime.context_timestamp(job_cr, SUPERUSER_ID, datetime.strptime(job['nextcall'], DEFAULT_SERVER_DATETIME_FORMAT)) + now = fields.datetime.context_timestamp(job_cr, job['user_id'], datetime.now()) + nextcall = fields.datetime.context_timestamp(job_cr, job['user_id'], datetime.strptime(job['nextcall'], DEFAULT_SERVER_DATETIME_FORMAT)) numbercall = job['numbercall'] ok = False diff --git a/openerp/addons/base/res/res_partner_view.xml b/openerp/addons/base/res/res_partner_view.xml index 3c3509b8712..d6eba17d0f4 100644 --- a/openerp/addons/base/res/res_partner_view.xml +++ b/openerp/addons/base/res/res_partner_view.xml @@ -31,7 +31,6 @@ - @@ -184,8 +183,7 @@ - - + diff --git a/openerp/osv/fields.py b/openerp/osv/fields.py index aad59fd2916..5f6ab74f517 100644 --- a/openerp/osv/fields.py +++ b/openerp/osv/fields.py @@ -396,17 +396,16 @@ class datetime(_column): else: registry = openerp.modules.registry.RegistryManager.get(cr.dbname) tz_name = registry.get('res.users').read(cr, SUPERUSER_ID, uid, ['tz'])['tz'] + utc_timestamp = pytz.utc.localize(timestamp, is_dst=False) # UTC = no DST if tz_name: try: - utc = pytz.timezone('UTC') context_tz = pytz.timezone(tz_name) - utc_timestamp = utc.localize(timestamp, is_dst=False) # UTC = no DST return utc_timestamp.astimezone(context_tz) except Exception: _logger.debug("failed to compute context/client-specific timestamp, " "using the UTC value", exc_info=True) - return timestamp + return utc_timestamp class binary(_column): _type = 'binary'