[MERGE] forward port branch 11.0 up to b793e23ae5

This commit is contained in:
Christophe Simonis
2018-05-09 13:55:27 +02:00
6 changed files with 14 additions and 5 deletions
+1 -1
View File
@@ -77,7 +77,7 @@ class ProcurementRule(models.Model):
data = self._get_stock_move_values(product_id, product_qty, product_uom, location_id, name, origin, values, group_id)
# Since action_confirm launch following procurement_group we should activate it.
move = self.env['stock.move'].sudo().create(data)
move = self.env['stock.move'].sudo().with_context(force_company=data.get('company_id', False)).create(data)
move._action_confirm()
return True
+2 -1
View File
@@ -885,9 +885,10 @@ class Menu(models.Model):
for menu in data['data']:
menu_id = self.browse(menu['id'])
# if the url match a website.page, set the m2o relation
page = self.env['website.page'].search([('url', '=', menu['url'])], limit=1)
page = self.env['website.page'].search(['|', ('url', '=', menu['url']), ('url', '=', '/' + menu['url'])], limit=1)
if page:
menu['page_id'] = page.id
menu['url'] = page.url
elif menu_id.page_id:
menu_id.page_id.write({'url': menu['url']})
menu_id.write(menu)
+1 -1
View File
@@ -74,7 +74,7 @@
<span t-field="submenu.name"/>
</a>
</li>
<li t-if="submenu.is_visible and submenu.child_id.filtered(lambda menu: menu.is_visible)" t-attf-class="dropdown #{
<li t-if="submenu.child_id.filtered(lambda menu: menu.is_visible)" t-attf-class="dropdown #{
(submenu.clean_url() and submenu.clean_url() != '/' and any([request.httprequest.path == child.url for child in submenu.child_id if child.url]) or
(submenu.clean_url() and request.httprequest.path == submenu.clean_url())) and 'active'
}">
+1
View File
@@ -34,6 +34,7 @@ class IrActions(models.Model):
binding_model_id = fields.Many2one('ir.model', ondelete='cascade',
help="Setting a value makes this action available in the sidebar for the given model.")
binding_type = fields.Selection([('action', 'Action'),
('action_form_only', "Form-only"),
('report', 'Report')],
required=True, default='action')
+4
View File
@@ -1392,6 +1392,9 @@ class BaseModel(MetaModel('DummyModel', (object,), {'_register': False})):
resaction = [action
for action in bindings['action']
if view_type == 'tree' or not action.get('multi')]
resrelate = []
if view_type == 'form':
resrelate = bindings['action_form_only']
for res in itertools.chain(resreport, resaction):
res['string'] = res['name']
@@ -1399,6 +1402,7 @@ class BaseModel(MetaModel('DummyModel', (object,), {'_register': False})):
result['toolbar'] = {
'print': resreport,
'action': resaction,
'relate': resrelate,
}
return result
+5 -2
View File
@@ -426,11 +426,14 @@ form: module.record_id""" % (xml_id,)
if rec.get('target'):
res['target'] = rec.get('target','')
if rec.get('multi'):
res['multi'] = safe_eval(rec.get('multi', 'False'))
if src_model:
res['binding_model_id'] = self.env['ir.model']._get(src_model).id
res['binding_type'] = 'report' if rec.get('key2') == 'client_print_multi' else 'action'
if rec.get('multi'):
res['multi'] = safe_eval(rec.get('multi', 'False'))
if rec.get('key2') in (None, 'client_action_relate'):
if not res.get('multi'):
res['binding_type'] = 'action_form_only'
id = self.env['ir.model.data']._update('ir.actions.act_window', self.module, res, xml_id, noupdate=self.isnoupdate(data_node), mode=self.mode)
self.idref[xml_id] = int(id)