diff --git a/addons/account/account.py b/addons/account/account.py index 71b1be3574e..4ee9da0ae30 100644 --- a/addons/account/account.py +++ b/addons/account/account.py @@ -3414,6 +3414,8 @@ class wizard_multi_charts_accounts(osv.osv_memory): all the provided information to create the accounts, the banks, the journals, the taxes, the tax codes, the accounting properties... accordingly for the chosen company. ''' + if uid != SUPERUSER_ID and not self.pool['res.users'].has_group(cr, uid, 'base.group_erp_manager'): + raise openerp.exceptions.AccessError(_("Only administrators can change the settings")) obj_data = self.pool.get('ir.model.data') ir_values_obj = self.pool.get('ir.values') obj_wizard = self.browse(cr, uid, ids[0]) @@ -3430,7 +3432,7 @@ class wizard_multi_charts_accounts(osv.osv_memory): self.pool[tmp2[0]].write(cr, uid, tmp2[1], { 'currency_id': obj_wizard.currency_id.id }) - except ValueError, e: + except ValueError: pass # If the floats for sale/purchase rates have been filled, create templates from them diff --git a/addons/account/res_config.py b/addons/account/res_config.py index 09df82e38fd..bf28e900378 100644 --- a/addons/account/res_config.py +++ b/addons/account/res_config.py @@ -22,13 +22,12 @@ import time import datetime from dateutil.relativedelta import relativedelta -from operator import itemgetter -from os.path import join as opj +import openerp +from openerp import SUPERUSER_ID from openerp.tools import DEFAULT_SERVER_DATE_FORMAT as DF from openerp.tools.translate import _ from openerp.osv import fields, osv -from openerp import tools class account_config_settings(osv.osv_memory): _name = 'account.config.settings' @@ -276,11 +275,13 @@ class account_config_settings(osv.osv_memory): def set_default_taxes(self, cr, uid, ids, context=None): """ set default sale and purchase taxes for products """ + if uid != SUPERUSER_ID and not self.pool['res.users'].has_group(cr, uid, 'base.group_erp_manager'): + raise openerp.exceptions.AccessError(_("Only administrators can change the settings")) ir_values = self.pool.get('ir.values') config = self.browse(cr, uid, ids[0], context) - ir_values.set_default(cr, uid, 'product.product', 'taxes_id', + ir_values.set_default(cr, SUPERUSER_ID, 'product.product', 'taxes_id', config.default_sale_tax and [config.default_sale_tax.id] or False, company_id=config.company_id.id) - ir_values.set_default(cr, uid, 'product.product', 'supplier_taxes_id', + ir_values.set_default(cr, SUPERUSER_ID, 'product.product', 'supplier_taxes_id', config.default_purchase_tax and [config.default_purchase_tax.id] or False, company_id=config.company_id.id) def set_chart_of_accounts(self, cr, uid, ids, context=None): diff --git a/addons/crm/wizard/crm_lead_to_opportunity.py b/addons/crm/wizard/crm_lead_to_opportunity.py index f239ad739c1..8ce2aa1c6c7 100644 --- a/addons/crm/wizard/crm_lead_to_opportunity.py +++ b/addons/crm/wizard/crm_lead_to_opportunity.py @@ -38,6 +38,9 @@ class crm_lead2opportunity_partner(osv.osv_memory): 'section_id': fields.many2one('crm.case.section', 'Sales Team', select=True), } + def onchange_action(self, cr, uid, ids, action, context=None): + return {'value': {'partner_id': False if action != 'exist' else self._find_matching_partner(cr, uid, context=context)}} + def default_get(self, cr, uid, fields, context=None): """ Default get for name, opportunity_ids. diff --git a/addons/crm/wizard/crm_lead_to_opportunity_view.xml b/addons/crm/wizard/crm_lead_to_opportunity_view.xml index 4f6522c27de..09506c3ed81 100644 --- a/addons/crm/wizard/crm_lead_to_opportunity_view.xml +++ b/addons/crm/wizard/crm_lead_to_opportunity_view.xml @@ -31,7 +31,7 @@ - + diff --git a/addons/crm_claim/report/crm_claim_report_view.xml b/addons/crm_claim/report/crm_claim_report_view.xml index 2d0787ca527..965c4b5bffc 100644 --- a/addons/crm_claim/report/crm_claim_report_view.xml +++ b/addons/crm_claim/report/crm_claim_report_view.xml @@ -51,7 +51,9 @@ - + + diff --git a/addons/document/document.py b/addons/document/document.py index 91af97246b8..5fc62578b1d 100644 --- a/addons/document/document.py +++ b/addons/document/document.py @@ -69,7 +69,11 @@ class document_file(osv.osv): def check(self, cr, uid, ids, mode, context=None, values=None): """Overwrite check to verify access on directory to validate specifications of doc/access_permissions.rst""" + if not isinstance(ids, list): + ids = [ids] + super(document_file, self).check(cr, uid, ids, mode, context=context, values=values) + if ids: self.pool.get('ir.model.access').check(cr, uid, 'document.directory', mode) diff --git a/addons/mail/static/src/css/mail.css b/addons/mail/static/src/css/mail.css index e4b7f9247e3..c0d3bb9855e 100644 --- a/addons/mail/static/src/css/mail.css +++ b/addons/mail/static/src/css/mail.css @@ -634,7 +634,7 @@ margin-bottom: 4px; } .openerp .oe_followers .oe_invite{ - float: right; + padding-left: 5px; } .openerp .oe_followers .oe_partner { height: 32px; diff --git a/addons/pad/static/src/css/etherpad.css b/addons/pad/static/src/css/etherpad.css index a0002ebe97c..facf15b28de 100644 --- a/addons/pad/static/src/css/etherpad.css +++ b/addons/pad/static/src/css/etherpad.css @@ -92,6 +92,7 @@ font-family: arial, sans-serif; font-size: 15px; line-height: 19px; + word-wrap: break-word; } .openerp .oe_form_nomargin .etherpad_readonly{ diff --git a/addons/purchase/purchase.py b/addons/purchase/purchase.py index 6fe2df11133..75f6856709b 100644 --- a/addons/purchase/purchase.py +++ b/addons/purchase/purchase.py @@ -860,6 +860,14 @@ class purchase_order_line(osv.osv): res[line.id] = cur_obj.round(cr, uid, cur, taxes['total']) return res + def _get_uom_id(self, cr, uid, context=None): + try: + proxy = self.pool.get('ir.model.data') + result = proxy.get_object_reference(cr, uid, 'product', 'product_uom_unit') + return result[1] + except Exception, ex: + return False + _columns = { 'name': fields.text('Description', required=True), 'product_qty': fields.float('Quantity', digits_compute=dp.get_precision('Product Unit of Measure'), required=True), @@ -886,6 +894,7 @@ class purchase_order_line(osv.osv): } _defaults = { + 'product_uom' : _get_uom_id, 'product_qty': lambda *a: 1.0, 'state': lambda *args: 'draft', 'invoiced': lambda *a: 0, diff --git a/addons/purchase/purchase_view.xml b/addons/purchase/purchase_view.xml index 4a301d3fa7b..d58d561a122 100644 --- a/addons/purchase/purchase_view.xml +++ b/addons/purchase/purchase_view.xml @@ -199,7 +199,7 @@ - + diff --git a/addons/sale/wizard/sale_line_invoice.py b/addons/sale/wizard/sale_line_invoice.py index e7c854b84aa..cd199760e9e 100644 --- a/addons/sale/wizard/sale_line_invoice.py +++ b/addons/sale/wizard/sale_line_invoice.py @@ -61,7 +61,7 @@ class sale_order_line_make_invoice(osv.osv_memory): else: pay_term = False inv = { - 'name': order.name, + 'name': order.client_order_ref or '', 'origin': order.name, 'type': 'out_invoice', 'reference': "P%dSO%d" % (order.partner_id.id, order.id), diff --git a/addons/sale_stock/res_config.py b/addons/sale_stock/res_config.py index f52dcf89659..5023d3b8eea 100644 --- a/addons/sale_stock/res_config.py +++ b/addons/sale_stock/res_config.py @@ -19,6 +19,8 @@ # ############################################################################## +import openerp +from openerp import SUPERUSER_ID from openerp.osv import fields, osv from openerp.tools.translate import _ @@ -72,12 +74,13 @@ class sale_configuration(osv.osv_memory): } def set_sale_defaults(self, cr, uid, ids, context=None): + if uid != SUPERUSER_ID and not self.pool['res.users'].has_group(cr, uid, 'base.group_erp_manager'): + raise openerp.exceptions.AccessError(_("Only administrators can change the settings")) ir_values = self.pool.get('ir.values') - ir_model_data = self.pool.get('ir.model.data') wizard = self.browse(cr, uid, ids)[0] default_picking_policy = 'one' if wizard.default_picking_policy else 'direct' - ir_values.set_default(cr, uid, 'sale.order', 'picking_policy', default_picking_policy) + ir_values.set_default(cr, SUPERUSER_ID, 'sale.order', 'picking_policy', default_picking_policy) res = super(sale_configuration, self).set_sale_defaults(cr, uid, ids, context) return res diff --git a/addons/sale_stock/sale_stock.py b/addons/sale_stock/sale_stock.py index 3f7ac28c900..341aaef8ca8 100644 --- a/addons/sale_stock/sale_stock.py +++ b/addons/sale_stock/sale_stock.py @@ -604,7 +604,7 @@ class sale_order_line(osv.osv): #check if product is available, and if not: raise an error uom2 = False if uom: - uom2 = product_uom_obj.browse(cr, uid, uom) + uom2 = product_uom_obj.browse(cr, uid, uom, context=context) if product_obj.uom_id.category_id.id != uom2.category_id.id: uom = False if not uom2: diff --git a/addons/stock/stock.py b/addons/stock/stock.py index c6637163d87..69d2c6e4791 100644 --- a/addons/stock/stock.py +++ b/addons/stock/stock.py @@ -1361,9 +1361,9 @@ class stock_picking(osv.osv): self.action_move(cr, uid, [new_picking], context=context) self.signal_button_done(cr, uid, [new_picking]) workflow.trg_write(uid, 'stock.picking', pick.id, cr) - delivered_pack_id = new_picking + delivered_pack_id = pick.id back_order_name = self.browse(cr, uid, delivered_pack_id, context=context).name - self.message_post(cr, uid, ids, body=_("Back order %s has been created.") % (back_order_name), context=context) + self.message_post(cr, uid, new_picking, body=_("Back order %s has been created.") % (back_order_name), context=context) else: self.action_move(cr, uid, [pick.id], context=context) self.signal_button_done(cr, uid, [pick.id])