[MERGE] forward port of branch saas-3 up to a66f3dd
This commit is contained in:
commit
f68c83545a
|
@ -139,6 +139,13 @@
|
||||||
<field name="domain_force">['|',('company_id','=',False),('company_id','child_of',[user.company_id.id])]</field>
|
<field name="domain_force">['|',('company_id','=',False),('company_id','child_of',[user.company_id.id])]</field>
|
||||||
</record>
|
</record>
|
||||||
|
|
||||||
|
<record id="account_subscription_line_comp_rule" model="ir.rule">
|
||||||
|
<field name="name">Account subscription line company rule</field>
|
||||||
|
<field name="model_id" ref="model_account_subscription_line"/>
|
||||||
|
<field name="global" eval="True"/>
|
||||||
|
<field name="domain_force">['|',('subscription_id.model_id.company_id','=',False),('subscription_id.model_id.company_id','child_of',[user.company_id.id])]</field>
|
||||||
|
</record>
|
||||||
|
|
||||||
<record model="ir.rule" id="account_invoice_line_comp_rule">
|
<record model="ir.rule" id="account_invoice_line_comp_rule">
|
||||||
<field name="name">Invoice Line company rule</field>
|
<field name="name">Invoice Line company rule</field>
|
||||||
<field name="model_id" ref="model_account_invoice_line"/>
|
<field name="model_id" ref="model_account_invoice_line"/>
|
||||||
|
|
|
@ -36,11 +36,11 @@ class account_subscription_generate(osv.osv_memory):
|
||||||
def action_generate(self, cr, uid, ids, context=None):
|
def action_generate(self, cr, uid, ids, context=None):
|
||||||
mod_obj = self.pool.get('ir.model.data')
|
mod_obj = self.pool.get('ir.model.data')
|
||||||
act_obj = self.pool.get('ir.actions.act_window')
|
act_obj = self.pool.get('ir.actions.act_window')
|
||||||
|
sub_line_obj = self.pool.get('account.subscription.line')
|
||||||
moves_created=[]
|
moves_created=[]
|
||||||
for data in self.read(cr, uid, ids, context=context):
|
for data in self.read(cr, uid, ids, context=context):
|
||||||
cr.execute('select id from account_subscription_line where date<%s and move_id is null', (data['date'],))
|
line_ids = sub_line_obj.search(cr, uid, [('date', '<', data['date']), ('move_id', '=', False)], context=context)
|
||||||
line_ids = map(lambda x: x[0], cr.fetchall())
|
moves = sub_line_obj.move_create(cr, uid, line_ids, context=context)
|
||||||
moves = self.pool.get('account.subscription.line').move_create(cr, uid, line_ids, context=context)
|
|
||||||
moves_created.extend(moves)
|
moves_created.extend(moves)
|
||||||
result = mod_obj.get_object_reference(cr, uid, 'account', 'action_move_line_form')
|
result = mod_obj.get_object_reference(cr, uid, 'account', 'action_move_line_form')
|
||||||
id = result and result[1] or False
|
id = result and result[1] or False
|
||||||
|
|
|
@ -164,6 +164,13 @@ class crm_claim(osv.osv):
|
||||||
# context: no_log, because subtype already handle this
|
# context: no_log, because subtype already handle this
|
||||||
return super(crm_claim, self).create(cr, uid, vals, context=context)
|
return super(crm_claim, self).create(cr, uid, vals, context=context)
|
||||||
|
|
||||||
|
def copy(self, cr, uid, id, default=None, context=None):
|
||||||
|
claim = self.browse(cr, uid, id, context=context)
|
||||||
|
default = dict(default or {},
|
||||||
|
stage_id = self._get_default_stage_id(cr, uid, context=context),
|
||||||
|
name = _('%s (copy)') % claim.name)
|
||||||
|
return super(crm_claim, self).copy(cr, uid, id, default, context=context)
|
||||||
|
|
||||||
# -------------------------------------------------------
|
# -------------------------------------------------------
|
||||||
# Mail gateway
|
# Mail gateway
|
||||||
# -------------------------------------------------------
|
# -------------------------------------------------------
|
||||||
|
|
|
@ -224,7 +224,7 @@ class partner_vat_intra(osv.osv_memory):
|
||||||
data_head = """<?xml version="1.0" encoding="ISO-8859-1"?>
|
data_head = """<?xml version="1.0" encoding="ISO-8859-1"?>
|
||||||
<ns2:IntraConsignment xmlns="http://www.minfin.fgov.be/InputCommon" xmlns:ns2="http://www.minfin.fgov.be/IntraConsignment" IntraListingsNbr="1">
|
<ns2:IntraConsignment xmlns="http://www.minfin.fgov.be/InputCommon" xmlns:ns2="http://www.minfin.fgov.be/IntraConsignment" IntraListingsNbr="1">
|
||||||
<ns2:Representative>
|
<ns2:Representative>
|
||||||
<RepresentativeID identificationType="NVAT" issuedBy="%(issued_by)s">%(company_vat)s</RepresentativeID>
|
<RepresentativeID identificationType="NVAT" issuedBy="%(issued_by)s">%(vatnum)s</RepresentativeID>
|
||||||
<Name>%(company_name)s</Name>
|
<Name>%(company_name)s</Name>
|
||||||
<Street>%(street)s</Street>
|
<Street>%(street)s</Street>
|
||||||
<PostCode>%(post_code)s</PostCode>
|
<PostCode>%(post_code)s</PostCode>
|
||||||
|
|
|
@ -71,6 +71,8 @@ class purchase_requisition(osv.osv):
|
||||||
for purchase_id in purchase.purchase_ids:
|
for purchase_id in purchase.purchase_ids:
|
||||||
if str(purchase_id.state) in('draft'):
|
if str(purchase_id.state) in('draft'):
|
||||||
purchase_order_obj.action_cancel(cr,uid,[purchase_id.id])
|
purchase_order_obj.action_cancel(cr,uid,[purchase_id.id])
|
||||||
|
procurement_ids = self.pool['procurement.order'].search(cr, uid, [('requisition_id', 'in', ids)], context=context)
|
||||||
|
self.pool['procurement.order'].action_done(cr, uid, procurement_ids)
|
||||||
return self.write(cr, uid, ids, {'state': 'cancel'})
|
return self.write(cr, uid, ids, {'state': 'cancel'})
|
||||||
|
|
||||||
def tender_in_progress(self, cr, uid, ids, context=None):
|
def tender_in_progress(self, cr, uid, ids, context=None):
|
||||||
|
@ -80,6 +82,8 @@ class purchase_requisition(osv.osv):
|
||||||
return self.write(cr, uid, ids, {'state': 'draft'})
|
return self.write(cr, uid, ids, {'state': 'draft'})
|
||||||
|
|
||||||
def tender_done(self, cr, uid, ids, context=None):
|
def tender_done(self, cr, uid, ids, context=None):
|
||||||
|
procurement_ids = self.pool['procurement.order'].search(cr, uid, [('requisition_id', 'in', ids)], context=context)
|
||||||
|
self.pool['procurement.order'].action_done(cr, uid, procurement_ids)
|
||||||
return self.write(cr, uid, ids, {'state':'done', 'date_end':time.strftime('%Y-%m-%d %H:%M:%S')}, context=context)
|
return self.write(cr, uid, ids, {'state':'done', 'date_end':time.strftime('%Y-%m-%d %H:%M:%S')}, context=context)
|
||||||
|
|
||||||
def _planned_date(self, requisition, delay=0.0):
|
def _planned_date(self, requisition, delay=0.0):
|
||||||
|
@ -212,6 +216,10 @@ class purchase_order(osv.osv):
|
||||||
proc_obj.write(cr, uid, proc_ids, {'purchase_id': po.id})
|
proc_obj.write(cr, uid, proc_ids, {'purchase_id': po.id})
|
||||||
self.signal_purchase_cancel(cr, uid, [order.id])
|
self.signal_purchase_cancel(cr, uid, [order.id])
|
||||||
po.requisition_id.tender_done(context=context)
|
po.requisition_id.tender_done(context=context)
|
||||||
|
if po.requisition_id and all(purchase_id.state in ['draft', 'cancel'] for purchase_id in po.requisition_id.purchase_ids if purchase_id.id != po.id):
|
||||||
|
procurement_ids = self.pool['procurement.order'].search(cr, uid, [('requisition_id', '=', po.requisition_id.id)], context=context)
|
||||||
|
for procurement in proc_obj.browse(cr, uid, procurement_ids, context=context):
|
||||||
|
procurement.move_id.write({'location_id': procurement.move_id.location_dest_id.id})
|
||||||
return res
|
return res
|
||||||
|
|
||||||
|
|
||||||
|
@ -268,7 +276,7 @@ class procurement_order(osv.osv):
|
||||||
for procurement in self.browse(cr, uid, ids, context=context):
|
for procurement in self.browse(cr, uid, ids, context=context):
|
||||||
if procurement.product_id.purchase_requisition:
|
if procurement.product_id.purchase_requisition:
|
||||||
user_company = self.pool['res.users'].browse(cr, uid, uid, context=context).company_id
|
user_company = self.pool['res.users'].browse(cr, uid, uid, context=context).company_id
|
||||||
req = res[procurement.id] = requisition_obj.create(cr, uid, {
|
req = requisition_obj.create(cr, uid, {
|
||||||
'origin': procurement.origin,
|
'origin': procurement.origin,
|
||||||
'date_end': procurement.date_planned,
|
'date_end': procurement.date_planned,
|
||||||
'warehouse_id': self._get_warehouse(procurement, user_company),
|
'warehouse_id': self._get_warehouse(procurement, user_company),
|
||||||
|
@ -284,6 +292,7 @@ class procurement_order(osv.osv):
|
||||||
'state': 'running',
|
'state': 'running',
|
||||||
'requisition_id': req
|
'requisition_id': req
|
||||||
})
|
})
|
||||||
|
res[procurement.id] = 0
|
||||||
else:
|
else:
|
||||||
non_requisition.append(procurement.id)
|
non_requisition.append(procurement.id)
|
||||||
|
|
||||||
|
|
|
@ -271,7 +271,7 @@ instance.web.parse_value = function (value, descriptor, value_if_empty) {
|
||||||
value, (date_pattern + ' ' + time_pattern));
|
value, (date_pattern + ' ' + time_pattern));
|
||||||
if (datetime !== null)
|
if (datetime !== null)
|
||||||
return instance.web.datetime_to_str(datetime);
|
return instance.web.datetime_to_str(datetime);
|
||||||
datetime = Date.parseExact(value.replace(/\d+/g, function(m){
|
datetime = Date.parseExact(value.toString().replace(/\d+/g, function(m){
|
||||||
return m.length === 1 ? "0" + m : m ;
|
return m.length === 1 ? "0" + m : m ;
|
||||||
}), (date_pattern + ' ' + time_pattern));
|
}), (date_pattern + ' ' + time_pattern));
|
||||||
if (datetime !== null)
|
if (datetime !== null)
|
||||||
|
@ -284,7 +284,7 @@ instance.web.parse_value = function (value, descriptor, value_if_empty) {
|
||||||
var date = Date.parseExact(value, date_pattern);
|
var date = Date.parseExact(value, date_pattern);
|
||||||
if (date !== null)
|
if (date !== null)
|
||||||
return instance.web.date_to_str(date);
|
return instance.web.date_to_str(date);
|
||||||
date = Date.parseExact(value.replace(/\d+/g, function(m){
|
date = Date.parseExact(value.toString().replace(/\d+/g, function(m){
|
||||||
return m.length === 1 ? "0" + m : m ;
|
return m.length === 1 ? "0" + m : m ;
|
||||||
}), date_pattern);
|
}), date_pattern);
|
||||||
if (date !== null)
|
if (date !== null)
|
||||||
|
|
|
@ -1108,7 +1108,7 @@ instance.web.ListView.List = instance.web.Class.extend( /** @lends instance.web.
|
||||||
ids = value;
|
ids = value;
|
||||||
}
|
}
|
||||||
new instance.web.Model(column.relation)
|
new instance.web.Model(column.relation)
|
||||||
.call('name_get', [ids]).done(function (names) {
|
.call('name_get', [ids, this.dataset.context]).done(function (names) {
|
||||||
// FIXME: nth horrible hack in this poor listview
|
// FIXME: nth horrible hack in this poor listview
|
||||||
record.set(column.id + '__display',
|
record.set(column.id + '__display',
|
||||||
_(names).pluck(1).join(', '));
|
_(names).pluck(1).join(', '));
|
||||||
|
|
|
@ -664,17 +664,13 @@ openerp.web_calendar = function(instance) {
|
||||||
date_start_day = new Date(event.start.getFullYear(),event.start.getMonth(),event.start.getDate(),7);
|
date_start_day = new Date(event.start.getFullYear(),event.start.getMonth(),event.start.getDate(),7);
|
||||||
date_stop_day = new Date(event_end.getFullYear(),event_end.getMonth(),event_end.getDate(),19);
|
date_stop_day = new Date(event_end.getFullYear(),event_end.getMonth(),event_end.getDate(),19);
|
||||||
}
|
}
|
||||||
data[this.date_start] = instance.web.parse_value(date_start_day, this.fields[this.date_start]);
|
|
||||||
if (this.date_stop) {
|
|
||||||
data[this.date_stop] = instance.web.parse_value(date_stop_day, this.fields[this.date_stop]);
|
|
||||||
}
|
|
||||||
diff_seconds = Math.round((date_stop_day.getTime() - date_start_day.getTime()) / 1000);
|
diff_seconds = Math.round((date_stop_day.getTime() - date_start_day.getTime()) / 1000);
|
||||||
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
data[this.date_start] = instance.web.parse_value(event.start, this.fields[this.date_start]);
|
data[this.date_start] = event.start;
|
||||||
if (this.date_stop) {
|
if (this.date_stop) {
|
||||||
data[this.date_stop] = instance.web.parse_value(event_end, this.fields[this.date_stop]);
|
data[this.date_stop] = event_end;
|
||||||
}
|
}
|
||||||
diff_seconds = Math.round((event_end.getTime() - event.start.getTime()) / 1000);
|
diff_seconds = Math.round((event_end.getTime() - event.start.getTime()) / 1000);
|
||||||
}
|
}
|
||||||
|
|
|
@ -373,7 +373,7 @@ class view(osv.osv):
|
||||||
node.getparent().remove(node)
|
node.getparent().remove(node)
|
||||||
elif pos == 'attributes':
|
elif pos == 'attributes':
|
||||||
for child in spec.getiterator('attribute'):
|
for child in spec.getiterator('attribute'):
|
||||||
attribute = (child.get('name'), child.text and child.text.encode('utf8') or None)
|
attribute = (child.get('name'), child.text or None)
|
||||||
if attribute[1]:
|
if attribute[1]:
|
||||||
node.set(attribute[0], attribute[1])
|
node.set(attribute[0], attribute[1])
|
||||||
elif attribute[0] in node.attrib:
|
elif attribute[0] in node.attrib:
|
||||||
|
|
|
@ -103,17 +103,7 @@ class base_module_upgrade(osv.osv_memory):
|
||||||
|
|
||||||
openerp.modules.registry.RegistryManager.new(cr.dbname, update_module=True)
|
openerp.modules.registry.RegistryManager.new(cr.dbname, update_module=True)
|
||||||
|
|
||||||
ir_model_data = self.pool.get('ir.model.data')
|
return {'type': 'ir.actions.act_window_close'}
|
||||||
__, res_id = ir_model_data.get_object_reference(cr, uid, 'base', 'view_base_module_upgrade_install')
|
|
||||||
return {
|
|
||||||
'view_type': 'form',
|
|
||||||
'view_mode': 'form',
|
|
||||||
'res_model': 'base.module.upgrade',
|
|
||||||
'views': [(res_id, 'form')],
|
|
||||||
'view_id': False,
|
|
||||||
'type': 'ir.actions.act_window',
|
|
||||||
'target': 'new',
|
|
||||||
}
|
|
||||||
|
|
||||||
def config(self, cr, uid, ids, context=None):
|
def config(self, cr, uid, ids, context=None):
|
||||||
return self.pool.get('res.config').next(cr, uid, [], context=context)
|
return self.pool.get('res.config').next(cr, uid, [], context=context)
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
<separator string="Impacted Modules"/>
|
<separator string="Impacted Modules"/>
|
||||||
<field name="module_info"/>
|
<field name="module_info"/>
|
||||||
<footer>
|
<footer>
|
||||||
<button name="upgrade_module" string="Update" type="object" class="oe_highlight"/>
|
<button name="upgrade_module" string="Confirm" type="object" class="oe_highlight"/>
|
||||||
or
|
or
|
||||||
<button string="Cancel" class="oe_link" name="upgrade_module_cancel" type="object"/>
|
<button string="Cancel" class="oe_link" name="upgrade_module_cancel" type="object"/>
|
||||||
</footer>
|
</footer>
|
||||||
|
|
|
@ -1036,34 +1036,30 @@ class expression(object):
|
||||||
|
|
||||||
unaccent = self._unaccent if sql_operator.endswith('like') else lambda x: x
|
unaccent = self._unaccent if sql_operator.endswith('like') else lambda x: x
|
||||||
|
|
||||||
trans_left = unaccent('value')
|
|
||||||
quote_left = unaccent(_quote(left))
|
|
||||||
instr = unaccent('%s')
|
instr = unaccent('%s')
|
||||||
|
|
||||||
if sql_operator == 'in':
|
if sql_operator == 'in':
|
||||||
# params will be flatten by to_sql() => expand the placeholders
|
# params will be flatten by to_sql() => expand the placeholders
|
||||||
instr = '(%s)' % ', '.join(['%s'] * len(right))
|
instr = '(%s)' % ', '.join(['%s'] * len(right))
|
||||||
|
|
||||||
subselect = """(SELECT res_id
|
subselect = """WITH temp_irt_current (id, name) as (
|
||||||
FROM ir_translation
|
SELECT ct.id, coalesce(it.value,ct.{quote_left})
|
||||||
WHERE name = %s
|
FROM {current_table} ct
|
||||||
AND lang = %s
|
LEFT JOIN ir_translation it ON (it.name = %s and
|
||||||
AND type = %s
|
it.lang = %s and
|
||||||
AND {trans_left} {operator} {right}
|
it.type = %s and
|
||||||
) UNION (
|
it.res_id = ct.id and
|
||||||
SELECT id
|
it.value != '')
|
||||||
FROM "{table}"
|
|
||||||
WHERE {left} {operator} {right}
|
|
||||||
)
|
)
|
||||||
""".format(trans_left=trans_left, operator=sql_operator,
|
SELECT id FROM temp_irt_current WHERE {name} {operator} {right} order by name
|
||||||
right=instr, table=working_model._table, left=quote_left)
|
""".format(current_table=working_model._table, quote_left=_quote(left), name=unaccent('name'),
|
||||||
|
operator=sql_operator, right=instr)
|
||||||
|
|
||||||
params = (
|
params = (
|
||||||
working_model._name + ',' + left,
|
working_model._name + ',' + left,
|
||||||
context.get('lang') or 'en_US',
|
context.get('lang') or 'en_US',
|
||||||
'model',
|
'model',
|
||||||
right,
|
right,
|
||||||
right,
|
|
||||||
)
|
)
|
||||||
push(create_substitution_leaf(leaf, ('id', inselect_operator, (subselect, params)), working_model))
|
push(create_substitution_leaf(leaf, ('id', inselect_operator, (subselect, params)), working_model))
|
||||||
|
|
||||||
|
|
|
@ -1556,7 +1556,8 @@ class property(function):
|
||||||
default_val = self._get_default(obj, cr, uid, prop_name, context)
|
default_val = self._get_default(obj, cr, uid, prop_name, context)
|
||||||
|
|
||||||
property_create = False
|
property_create = False
|
||||||
if isinstance(default_val, openerp.osv.orm.browse_record):
|
if isinstance(default_val, (openerp.osv.orm.browse_record,
|
||||||
|
openerp.osv.orm.browse_null)):
|
||||||
if default_val.id != id_val:
|
if default_val.id != id_val:
|
||||||
property_create = True
|
property_create = True
|
||||||
elif default_val != id_val:
|
elif default_val != id_val:
|
||||||
|
|
Loading…
Reference in New Issue