diff --git a/addons/calendar/i18n/calendar.pot b/addons/calendar/i18n/calendar.pot index 28c48a2b77c..3190ec2b1d0 100644 --- a/addons/calendar/i18n/calendar.pot +++ b/addons/calendar/i18n/calendar.pot @@ -1464,11 +1464,6 @@ msgstr "" msgid "count cannot be negative or 0." msgstr "" -#. module: calendar -#: field:calendar.alarm,duration_minutes:0 -msgid "Duration in minutes" -msgstr "" - #. module: calendar #: code:addons/calendar/calendar.py:1245 #, python-format diff --git a/addons/product_visible_discount/product_visible_discount.py b/addons/product_visible_discount/product_visible_discount.py index d5f53197e0b..549be580530 100644 --- a/addons/product_visible_discount/product_visible_discount.py +++ b/addons/product_visible_discount/product_visible_discount.py @@ -20,6 +20,7 @@ # ############################################################################## +from openerp import SUPERUSER_ID from openerp.osv import fields, osv from openerp.tools.translate import _ @@ -80,6 +81,7 @@ class sale_order_line(osv.osv): result=res['value'] pricelist_obj=self.pool.get('product.pricelist') product_obj = self.pool.get('product.product') + account_tax_obj = self.pool.get('account.tax') if product and pricelist and self.pool.get('res.users').has_group(cr, uid, 'sale.group_discount_per_so_line'): if result.get('price_unit',False): price=result['price_unit'] @@ -94,6 +96,16 @@ class sale_order_line(osv.osv): so_pricelist = pricelist_obj.browse(cr, uid, pricelist, context=context) new_list_price, currency_id = get_real_price_curency(list_price, product.id, qty, uom, pricelist) + + # The superuser is used by website_sale in order to create a sale order. We need to make + # sure we only select the taxes related to the company of the partner. This should only + # apply if the partner is linked to a company. + if uid == SUPERUSER_ID and context.get('company_id'): + taxes = product.taxes_id.filtered(lambda r: r.company_id.id == context['company_id']) + else: + taxes = product.taxes_id + new_list_price = account_tax_obj._fix_tax_included_price(cr, uid, new_list_price, taxes, result.get('tax_id', [])) + if so_pricelist.visible_discount and list_price[pricelist][0] != 0 and new_list_price != 0: if product.company_id and so_pricelist.currency_id.id != product.company_id.currency_id.id: # new_list_price is in company's currency while price in pricelist currency diff --git a/addons/sale_layout/models/sale_layout.py b/addons/sale_layout/models/sale_layout.py index ed42fabb991..d2b5777c059 100644 --- a/addons/sale_layout/models/sale_layout.py +++ b/addons/sale_layout/models/sale_layout.py @@ -84,10 +84,6 @@ class AccountInvoiceLine(osv.Model): sale_layout_cat_id = openerp.fields.Many2one('sale_layout.category', string='Section') categ_sequence = openerp.fields.Integer(related='sale_layout_cat_id.sequence', string='Layout Sequence', store=True) - _defaults = { - 'categ_sequence': 0 - } - class SaleOrder(osv.Model): _inherit = 'sale.order' @@ -117,10 +113,6 @@ class SaleOrderLine(osv.Model): # Store is intentionally set in order to keep the "historic" order. } - _defaults = { - 'categ_sequence': 0 - } - _order = 'order_id, categ_sequence, sale_layout_cat_id, sequence, id' def _prepare_order_line_invoice_line(self, cr, uid, line, account_id=False, context=None): diff --git a/addons/website/controllers/main.py b/addons/website/controllers/main.py index e99d443f54c..dbb94c4067a 100644 --- a/addons/website/controllers/main.py +++ b/addons/website/controllers/main.py @@ -40,9 +40,9 @@ class Website(openerp.addons.web.controllers.main.Home): else: first_menu = main_menu.child_id and main_menu.child_id[0] if first_menu: - if not (first_menu.url.startswith(('/page/', '/?', '/#')) or (first_menu.url=='/')): + if first_menu.url and (not (first_menu.url.startswith(('/page/', '/?', '/#')) or (first_menu.url == '/'))): return request.redirect(first_menu.url) - if first_menu.url.startswith('/page/'): + if first_menu.url and first_menu.url.startswith('/page/'): return request.registry['ir.http'].reroute(first_menu.url) return self.page(page) diff --git a/openerp/cli/server.py b/openerp/cli/server.py index ef9503da3fe..0cd815ae510 100644 --- a/openerp/cli/server.py +++ b/openerp/cli/server.py @@ -79,9 +79,9 @@ def report_configuration(): else: _logger.info('database: %s@unix-socket', config['db_user']) -def rm_pid_file(): +def rm_pid_file(main_pid): config = openerp.tools.config - if not openerp.evented and config['pidfile']: + if config['pidfile'] and main_pid == os.getpid(): try: os.unlink(config['pidfile']) except OSError: @@ -94,10 +94,10 @@ def setup_pid_file(): """ config = openerp.tools.config if not openerp.evented and config['pidfile']: + pid = os.getpid() with open(config['pidfile'], 'w') as fd: - pidtext = "%d" % (os.getpid()) - fd.write(pidtext) - atexit.register(rm_pid_file) + fd.write(str(pid)) + atexit.register(rm_pid_file, pid) def export_translation(): config = openerp.tools.config