diff --git a/addons/account_analytic_analysis/account_analytic_analysis.py b/addons/account_analytic_analysis/account_analytic_analysis.py index f1dc842ecee..e6cec60f3ce 100644 --- a/addons/account_analytic_analysis/account_analytic_analysis.py +++ b/addons/account_analytic_analysis/account_analytic_analysis.py @@ -702,7 +702,9 @@ class account_analytic_account(osv.osv): def _prepare_invoice_lines(self, cr, uid, contract, fiscal_position_id, context=None): fpos_obj = self.pool.get('account.fiscal.position') - fiscal_position = fpos_obj.browse(cr, uid, fiscal_position_id, context=context) + fiscal_position = None + if fiscal_position_id: + fiscal_position = fpos_obj.browse(cr, uid, fiscal_position_id, context=context) invoice_lines = [] for line in contract.recurring_invoice_line_ids: diff --git a/addons/email_template/email_template.py b/addons/email_template/email_template.py index 51ebf96e81b..c787516111f 100644 --- a/addons/email_template/email_template.py +++ b/addons/email_template/email_template.py @@ -221,9 +221,9 @@ class email_template(osv.osv): help="Optional translation language (ISO code) to select when sending out an email. " "If not set, the english version will be used. " "This should usually be a placeholder expression " - "that provides the appropriate language code, e.g. " - "${object.partner_id.lang.code}.", - placeholder="${object.partner_id.lang.code}"), + "that provides the appropriate language, e.g. " + "${object.partner_id.lang}.", + placeholder="${object.partner_id.lang}"), 'user_signature': fields.boolean('Add Signature', help="If checked, the user's signature will be appended to the text version " "of the message"), diff --git a/addons/event/event.py b/addons/event/event.py index 8021cce19ae..a80312ea0e8 100644 --- a/addons/event/event.py +++ b/addons/event/event.py @@ -171,7 +171,7 @@ class event_event(osv.osv): 'name': fields.char('Event Name', size=64, required=True, translate=True, readonly=False, states={'done': [('readonly', True)]}), 'user_id': fields.many2one('res.users', 'Responsible User', readonly=False, states={'done': [('readonly', True)]}), 'type': fields.many2one('event.type', 'Type of Event', readonly=False, states={'done': [('readonly', True)]}), - 'seats_max': fields.integer('Maximum Avalaible Seats', oldname='register_max', help="You can for each event define a maximum registration level. If you have too much registrations you are not able to confirm your event. (put 0 to ignore this rule )", readonly=True, states={'draft': [('readonly', False)]}), + 'seats_max': fields.integer('Maximum Available Seats', oldname='register_max', help="You can for each event define a maximum registration level. If you have too much registrations you are not able to confirm your event. (put 0 to ignore this rule )", readonly=True, states={'draft': [('readonly', False)]}), 'seats_min': fields.integer('Minimum Reserved Seats', oldname='register_min', help="You can for each event define a minimum registration level. If you do not enough registrations you are not able to confirm your event. (put 0 to ignore this rule )", readonly=True, states={'draft': [('readonly', False)]}), 'seats_reserved': fields.function(_get_seats, oldname='register_current', string='Reserved Seats', type='integer', multi='seats_reserved', store={'event.registration': (_get_events_from_registrations, ['state'], 10), diff --git a/addons/event_sale/event_sale.py b/addons/event_sale/event_sale.py index 276362d566f..1d38498796e 100644 --- a/addons/event_sale/event_sale.py +++ b/addons/event_sale/event_sale.py @@ -212,7 +212,7 @@ class event_ticket(osv.osv): 'deadline': fields.date("Sales End"), 'is_expired': fields.function(_is_expired, type='boolean', string='Is Expired'), 'price': fields.float('Price'), - 'seats_max': fields.integer('Maximum Avalaible Seats', oldname='register_max', help="You can for each event define a maximum registration level. If you have too much registrations you are not able to confirm your event. (put 0 to ignore this rule )"), + 'seats_max': fields.integer('Maximum Available Seats', oldname='register_max', help="You can for each event define a maximum registration level. If you have too much registrations you are not able to confirm your event. (put 0 to ignore this rule )"), 'seats_reserved': fields.function(_get_seats, string='Reserved Seats', type='integer', multi='seats_reserved'), 'seats_available': fields.function(_get_seats, string='Available Seats', type='integer', multi='seats_reserved'), 'seats_unconfirmed': fields.function(_get_seats, string='Unconfirmed Seat Reservations', type='integer', multi='seats_reserved'), @@ -242,6 +242,8 @@ class event_ticket(osv.osv): ] def onchange_product_id(self, cr, uid, ids, product_id=False, context=None): + if not product_id: + return {'value': {}} return {'value': {'price': self.pool.get("product.product").browse(cr, uid, product_id).list_price or 0}} diff --git a/addons/hr_holidays/report/holidays_summary_report.py b/addons/hr_holidays/report/holidays_summary_report.py index adf09a63c85..39b2ba5c3ef 100644 --- a/addons/hr_holidays/report/holidays_summary_report.py +++ b/addons/hr_holidays/report/holidays_summary_report.py @@ -223,9 +223,7 @@ class report_custom(report_rml): elif data['model']=='ir.ui.menu': for id in data['form']['depts']: dept = obj_dept.browse(cr, uid, id, context=context) - cr.execute("""SELECT id FROM hr_employee \ - WHERE department_id = %s""", (id,)) - emp_ids = [x[0] for x in cr.fetchall()] + emp_ids = obj_emp.search(cr, uid, [('department_id', '=', id)], context=context) if emp_ids==[]: continue dept_done=0 diff --git a/addons/mail/mail_alias.py b/addons/mail/mail_alias.py index d8a79dd98e0..7226daf57ed 100644 --- a/addons/mail/mail_alias.py +++ b/addons/mail/mail_alias.py @@ -27,6 +27,7 @@ from openerp.osv import fields, osv from openerp.tools import ustr from openerp.modules.registry import RegistryManager from openerp import SUPERUSER_ID +from openerp.tools.translate import _ _logger = logging.getLogger(__name__) @@ -129,16 +130,18 @@ class mail_alias(osv.Model): ] def name_get(self, cr, uid, ids, context=None): - """Return the mail alias display alias_name, inclusing the implicit - mail catchall domain from config. - e.g. `jobs@openerp.my.openerp.com` or `sales@openerp.my.openerp.com` + """Return the mail alias display alias_name, including the implicit + mail catchall domain if exists from config otherwise "New Alias". + e.g. `jobs@openerp.my.openerp.com` or `jobs` or 'New Alias' """ res = [] for record in self.browse(cr, uid, ids, context=context): if record.alias_name and record.alias_domain: res.append((record['id'], "%s@%s" % (record.alias_name, record.alias_domain))) + elif record.alias_name: + res.append((record['id'], "%s" % (record.alias_name))) else: - res.append((record['id'], False)) + res.append((record['id'], _("Inactive Alias"))) return res def _find_unique(self, cr, uid, name, context=None): diff --git a/addons/stock/security/ir.model.access.csv b/addons/stock/security/ir.model.access.csv index d89354c5be3..a3bd5eb33cb 100644 --- a/addons/stock/security/ir.model.access.csv +++ b/addons/stock/security/ir.model.access.csv @@ -3,7 +3,7 @@ access_stock_incoterms_all,stock.incoterms all,model_stock_incoterms,,1,0,0,0 access_stock_incoterms_manager,stock.incoterms manager,model_stock_incoterms,stock.group_stock_manager,1,1,1,1 access_stock_warehouse_manager,stock.warehouse.manager,model_stock_warehouse,stock.group_stock_manager,1,1,1,1 access_stock_warehouse_user,stock.warehouse.user,model_stock_warehouse,base.group_user,1,0,0,0 -access_stock_location__partner_manager,stock.location.partner.manager,model_stock_location,base.group_partner_manager,1,1,1,1 +access_stock_location__partner_manager,stock.location.partner.manager,model_stock_location,base.group_partner_manager,1,0,0,0 access_stock_location_manager,stock.location.manager,model_stock_location,stock.group_stock_manager,1,1,1,1 access_stock_location_user,stock.location.user,model_stock_location,base.group_user,1,0,0,0 access_stock_journal_user,stock.journal.user,model_stock_journal,base.group_user,1,0,0,0 diff --git a/addons/website_partner/models/res_partner.py b/addons/website_partner/models/res_partner.py index e762455debe..c165a50ab06 100644 --- a/addons/website_partner/models/res_partner.py +++ b/addons/website_partner/models/res_partner.py @@ -17,7 +17,7 @@ class WebsiteResPartner(osv.Model): 'Website Partner Full Description' ), 'website_short_description': fields.text( - 'Website artner Short Description' + 'Website Partner Short Description' ), # hack to allow using plain browse record in qweb views 'self': fields.function(_get_ids, type='many2one', relation=_name), diff --git a/openerp/addons/base/ir/ir_model.py b/openerp/addons/base/ir/ir_model.py index 3101f52f2e0..7b6e1bb9165 100644 --- a/openerp/addons/base/ir/ir_model.py +++ b/openerp/addons/base/ir/ir_model.py @@ -151,7 +151,7 @@ class ir_model(osv.osv): if result and result[0] == 'v': cr.execute('DROP view %s' % (model_pool._table,)) elif result and result[0] == 'r': - cr.execute('DROP TABLE %s' % (model_pool._table,)) + cr.execute('DROP TABLE %s CASCADE' % (model_pool._table,)) return True def unlink(self, cr, user, ids, context=None): @@ -312,6 +312,14 @@ class ir_model_fields(osv.osv): if column_name and (result and result[0] == 'r'): cr.execute('ALTER table "%s" DROP column "%s" cascade' % (model._table, field.name)) model._columns.pop(field.name, None) + + # remove m2m relation table for custom fields + # we consider the m2m relation is only one way as it's not possible + # to specify the relation table in the interface for custom fields + # TODO master: maybe use ir.model.relations for custom fields + if field.state == 'manual' and field.ttype == 'many2many': + rel_name = self.pool[field.model]._all_columns[field.name].column._rel + cr.execute('DROP table "%s"' % (rel_name)) return True def unlink(self, cr, user, ids, context=None): diff --git a/openerp/osv/orm.py b/openerp/osv/orm.py index 2976d644718..a1fb5a2e611 100644 --- a/openerp/osv/orm.py +++ b/openerp/osv/orm.py @@ -3082,7 +3082,10 @@ class BaseModel(object): def _m2m_raise_or_create_relation(self, cr, f): m2m_tbl, col1, col2 = f._sql_names(self) - self._save_relation_table(cr, m2m_tbl) + # do not create relations for custom fields as they do not belong to a module + # they will be automatically removed when dropping the corresponding ir.model.field + if not f.string.startswith('x_'): + self._save_relation_table(cr, m2m_tbl) cr.execute("SELECT relname FROM pg_class WHERE relkind IN ('r','v') AND relname=%s", (m2m_tbl,)) if not cr.dictfetchall(): if f._obj not in self.pool: diff --git a/openerp/tools/config.py b/openerp/tools/config.py index 6b21bda8b4f..588c2dedf9f 100644 --- a/openerp/tools/config.py +++ b/openerp/tools/config.py @@ -153,7 +153,7 @@ class configmanager(object): # WEB group = optparse.OptionGroup(parser, "Web interface Configuration") - group.add_option("--db-filter", dest="dbfilter", default='.*', + group.add_option("--db-filter", dest="dbfilter", my_default='.*', help="Filter listed database", metavar="REGEXP") parser.add_option_group(group)