From 6c623b59b50ebfab781016c2b6449a439b6bbd32 Mon Sep 17 00:00:00 2001 From: JoshuaJan Date: Sun, 6 Jul 2014 17:41:07 +0800 Subject: [PATCH 01/15] skip the inactivate employee in leaves summary --- addons/hr_holidays/report/holidays_summary_report.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/addons/hr_holidays/report/holidays_summary_report.py b/addons/hr_holidays/report/holidays_summary_report.py index 36087a57325..3f3a93d21a6 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)]) if emp_ids==[]: continue dept_done=0 From 9da1214de3a36f6909fe4dad0074f6fbd87efaea Mon Sep 17 00:00:00 2001 From: JoshuaJan Date: Mon, 7 Jul 2014 17:30:25 +0800 Subject: [PATCH 02/15] Update holidays_summary_report.py Add context to search method --- addons/hr_holidays/report/holidays_summary_report.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/hr_holidays/report/holidays_summary_report.py b/addons/hr_holidays/report/holidays_summary_report.py index 3f3a93d21a6..cf29e3abd01 100644 --- a/addons/hr_holidays/report/holidays_summary_report.py +++ b/addons/hr_holidays/report/holidays_summary_report.py @@ -223,7 +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) - emp_ids = obj_emp.search(cr, uid, [('department_id', '=', id)]) + emp_ids = obj_emp.search(cr, uid, [('department_id', '=', id)], context) if emp_ids==[]: continue dept_done=0 From 6c776d54068ccfb2282925f7b513ba1f5191fd99 Mon Sep 17 00:00:00 2001 From: JoshuaJan Date: Mon, 7 Jul 2014 18:17:20 +0800 Subject: [PATCH 03/15] Update holidays_summary_report.py --- addons/hr_holidays/report/holidays_summary_report.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/hr_holidays/report/holidays_summary_report.py b/addons/hr_holidays/report/holidays_summary_report.py index cf29e3abd01..2aee179b13d 100644 --- a/addons/hr_holidays/report/holidays_summary_report.py +++ b/addons/hr_holidays/report/holidays_summary_report.py @@ -223,7 +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) - emp_ids = obj_emp.search(cr, uid, [('department_id', '=', id)], context) + emp_ids = obj_emp.search(cr, uid, [('department_id', '=', id)], context=context) if emp_ids==[]: continue dept_done=0 From 90f7eaa0941b016b544cf1873c0ab55380264c27 Mon Sep 17 00:00:00 2001 From: Martin Trigaux Date: Mon, 7 Jul 2014 17:12:27 +0200 Subject: [PATCH 04/15] [FIX] portal: avoid errors during autovacuum When the cron for autovacuum runs, the osv_memory objects are deleted. The portal.wizard.user object has a required field (wizard_id) linked to another osv_memory object (portal.user) which causes a traceback when the cron tries to delete portal.user object before the portal.wizard.user. opw 609918 --- addons/portal/wizard/portal_wizard.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/portal/wizard/portal_wizard.py b/addons/portal/wizard/portal_wizard.py index fb46533b559..0f9ad7a7073 100644 --- a/addons/portal/wizard/portal_wizard.py +++ b/addons/portal/wizard/portal_wizard.py @@ -116,7 +116,7 @@ class wizard_user(osv.osv_memory): _description = 'Portal User Config' _columns = { - 'wizard_id': fields.many2one('portal.wizard', string='Wizard', required=True), + 'wizard_id': fields.many2one('portal.wizard', string='Wizard', required=True, ondelete="cascade"), 'partner_id': fields.many2one('res.partner', string='Contact', required=True, readonly=True), 'email': fields.char(size=240, string='Email'), 'in_portal': fields.boolean('In Portal'), From c0aa86b9ab46068553b0bc6117da715743d7851f Mon Sep 17 00:00:00 2001 From: Fabien Meghazi Date: Thu, 8 May 2014 09:50:25 +0200 Subject: [PATCH 05/15] [FIX] configuration file dbfilter's option has no effect lp bug: https://launchpad.net/bugs/940439 fixed bzr revid: fme@openerp.com-20140508075025-yszqmzie1z4n7l4j --- openerp/tools/config.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openerp/tools/config.py b/openerp/tools/config.py index 71d1d015d91..3e7fc331e2c 100644 --- a/openerp/tools/config.py +++ b/openerp/tools/config.py @@ -154,7 +154,7 @@ class configmanager(object): # WEB # TODO move to web addons after MetaOption merge 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) From 6af3193d17021108f7501cfda824e7a1aecc8a85 Mon Sep 17 00:00:00 2001 From: Martin Trigaux Date: Tue, 8 Jul 2014 13:55:48 +0200 Subject: [PATCH 06/15] [FIX] ir.model.fields: better unlink When droping a column, remove also the relation table in case of custom m2m field. The relation table needs to be dropped otherwise an unremovable constraint to the targetted table is kept (and anyway is not needed anymore). --- openerp/addons/base/ir/ir_model.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/openerp/addons/base/ir/ir_model.py b/openerp/addons/base/ir/ir_model.py index e7775b8ecbc..966f5e29077 100644 --- a/openerp/addons/base/ir/ir_model.py +++ b/openerp/addons/base/ir/ir_model.py @@ -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): From 8b3d19921a825191fd71d9f41dc5b0d131116dea Mon Sep 17 00:00:00 2001 From: Jeremy Kersten Date: Tue, 8 Jul 2014 15:54:00 +0200 Subject: [PATCH 07/15] [FIX] Crm partner assign: Sort the partners by grade / published implemented. else the display are not explicit on website, because old order takes all the implemented partner but on website we display the number of reference published --- addons/website_crm_partner_assign/controllers/main.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/website_crm_partner_assign/controllers/main.py b/addons/website_crm_partner_assign/controllers/main.py index a880a83ad54..975914ad8ac 100644 --- a/addons/website_crm_partner_assign/controllers/main.py +++ b/addons/website_crm_partner_assign/controllers/main.py @@ -124,7 +124,7 @@ class WebsiteCrmPartnerAssign(http.Controller): context=request.context) # todo in trunk: order="grade_id DESC, implemented_count DESC", offset=pager['offset'], limit=self._references_per_page partners = partner_obj.browse(request.cr, SUPERUSER_ID, partner_ids, request.context) # remove me in trunk - partners.sort(key=lambda x: (-1 * (x.grade_id and x.grade_id.id or 0), len(x.implemented_partner_ids)), reverse=True) + partners.sort(key=lambda x: (x.grade_id.sequence if x.grade_id else 0, len([i for i in x.implemented_partner_ids if i.website_published])), reverse=True) partners = partners[pager['offset']:pager['offset'] + self._references_per_page] google_map_partner_ids = ','.join(map(str, [p.id for p in partners])) From 84e9a67cdf78db94cb7a09543c1b7ac4ad19d8b4 Mon Sep 17 00:00:00 2001 From: Martin Trigaux Date: Tue, 8 Jul 2014 15:56:24 +0200 Subject: [PATCH 08/15] [FIX] orm: better removal of custom m2m fields orm: do not try to create ir.model.relation for custom m2m as self._module is either empty (for custom models), either the one of the last inheriting module (which is wrong). The field should be removed manually and should not be impacted by the uninstallation of modules. The removal of the relation table can be done when removing manually the custom field (see rev 6af3193). ir.model: when removing a model, drop the table with the CASCADE instruction. This will remove left constraints from remaining m2m tables. This means that dropping a table (either manually removing a custom model or uninstalling a module) will not drop the relation table for a custom m2m field. This is not ideal but better than the previous behaviour (which was to fail the DROP TABLE instruction and keep the table with a few columns and unconsistent data). --- openerp/addons/base/ir/ir_model.py | 2 +- openerp/osv/orm.py | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/openerp/addons/base/ir/ir_model.py b/openerp/addons/base/ir/ir_model.py index 966f5e29077..8796f892960 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): diff --git a/openerp/osv/orm.py b/openerp/osv/orm.py index fc381695fef..1f2823b7919 100644 --- a/openerp/osv/orm.py +++ b/openerp/osv/orm.py @@ -3385,7 +3385,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 not self.pool.get(f._obj): From 1ddb3439be06460243cf87bab0b691cd81276c9d Mon Sep 17 00:00:00 2001 From: Olivier Dony Date: Tue, 8 Jul 2014 17:44:40 +0200 Subject: [PATCH 09/15] [FIX] account_analytic_account: handle partners without fiscal position gracefully --- addons/account_analytic_analysis/account_analytic_analysis.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/addons/account_analytic_analysis/account_analytic_analysis.py b/addons/account_analytic_analysis/account_analytic_analysis.py index af8f77b9566..973206bfef6 100644 --- a/addons/account_analytic_analysis/account_analytic_analysis.py +++ b/addons/account_analytic_analysis/account_analytic_analysis.py @@ -697,7 +697,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: From 44bf56c77cbffcb166190dc274232ba1acff0ed4 Mon Sep 17 00:00:00 2001 From: FalcoBolger Date: Thu, 10 Jul 2014 11:26:19 +0200 Subject: [PATCH 10/15] [FIX] event_sale: do not crash when empty field product in ticket types lines --- addons/event_sale/event_sale.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/addons/event_sale/event_sale.py b/addons/event_sale/event_sale.py index 90cac8168ec..ff924eb4ddc 100644 --- a/addons/event_sale/event_sale.py +++ b/addons/event_sale/event_sale.py @@ -224,6 +224,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}} From e6b6392f3acc5e5d6dd4622dbd9870b0ba01bac1 Mon Sep 17 00:00:00 2001 From: FalcoBolger Date: Wed, 9 Jul 2014 10:33:01 +0200 Subject: [PATCH 11/15] FIX email_template: Update help from lang field leading to confusion while creating a template --- addons/email_template/email_template.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/addons/email_template/email_template.py b/addons/email_template/email_template.py index 30417acb70a..335b67fcfb1 100644 --- a/addons/email_template/email_template.py +++ b/addons/email_template/email_template.py @@ -135,9 +135,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"), From a0a17fa46e16b0005b13894b7af6093d1de57fa6 Mon Sep 17 00:00:00 2001 From: Richard Mathot Date: Thu, 10 Jul 2014 14:11:01 +0200 Subject: [PATCH 12/15] [TYPO] in event, event_sale --- addons/event/event.py | 2 +- addons/event_sale/event_sale.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/addons/event/event.py b/addons/event/event.py index d13d455bc73..d76c57ef075 100644 --- a/addons/event/event.py +++ b/addons/event/event.py @@ -140,7 +140,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'), 'seats_available': fields.function(_get_seats, oldname='register_avail', string='Available Seats', type='integer', multi='seats_reserved'), diff --git a/addons/event_sale/event_sale.py b/addons/event_sale/event_sale.py index ff924eb4ddc..c578715f73c 100644 --- a/addons/event_sale/event_sale.py +++ b/addons/event_sale/event_sale.py @@ -194,7 +194,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'), @@ -244,4 +244,4 @@ class event_registration(osv.osv): _constraints = [ (_check_ticket_seats_limit, 'No more available tickets.', ['event_ticket_id','nb_register','state']), - ] \ No newline at end of file + ] From f6bf77c2b5d20c9511b942f6c04ad7a803a05fa5 Mon Sep 17 00:00:00 2001 From: Richard Mathot Date: Thu, 10 Jul 2014 15:22:03 +0200 Subject: [PATCH 13/15] [FIX] mail: bad display of aliases on user forms (Partial backport of commit 1f8615699105e75ccbe9dc36c8ff9266868bbfb0) Closes #800. --- addons/mail/mail_alias.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/addons/mail/mail_alias.py b/addons/mail/mail_alias.py index 1eacb902e0f..ad680bddb43 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): From 6e96ffd44c4f10e2ac926b42e6fba8d1902bfe24 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Bellier?= Date: Thu, 10 Jul 2014 13:20:00 +0200 Subject: [PATCH 14/15] [FIX] stock: remove permission to create locations for partner managers There's a big risk of mistake with the fast-create feature and they don't need it (Rebase of PR #1073) --- addons/stock/security/ir.model.access.csv | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 From 4d6b89105b482e55b146d6de419a0bd89e0ef599 Mon Sep 17 00:00:00 2001 From: Richard Mathot Date: Thu, 10 Jul 2014 20:28:21 +0200 Subject: [PATCH 15/15] [TYPO] in website_partner --- addons/website_partner/models/res_partner.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/website_partner/models/res_partner.py b/addons/website_partner/models/res_partner.py index aa9a7cc02a3..57bb2edb881 100644 --- a/addons/website_partner/models/res_partner.py +++ b/addons/website_partner/models/res_partner.py @@ -14,7 +14,7 @@ class WebsiteResPartner(osv.Model): 'Website Partner Full Description' ), 'website_short_description': fields.text( - 'Website artner Short Description' + 'Website Partner Short Description' ), } _defaults = {