[MERGE] forward port branch 9.0 up to 73d6f9023a
This commit is contained in:
@@ -275,12 +275,12 @@ class AccountBankStatement(models.Model):
|
||||
""" Changes statement state to Running."""
|
||||
for statement in self:
|
||||
if not statement.name:
|
||||
context = {'ir_sequence_date', statement.date}
|
||||
context = {'ir_sequence_date': statement.date}
|
||||
if statement.journal_id.sequence_id:
|
||||
st_number = statement.journal_id.sequence_id.with_context(context).next_by_id()
|
||||
st_number = statement.journal_id.sequence_id.with_context(**context).next_by_id()
|
||||
else:
|
||||
SequenceObj = self.env['ir.sequence']
|
||||
st_number = SequenceObj.with_context(context).next_by_code('account.bank.statement')
|
||||
st_number = SequenceObj.with_context(**context).next_by_code('account.bank.statement')
|
||||
statement.name = st_number
|
||||
statement.state = 'open'
|
||||
|
||||
|
||||
@@ -474,7 +474,8 @@ class AccountInvoice(models.Model):
|
||||
else:
|
||||
account_id = pay_account.id
|
||||
payment_term_id = p.property_supplier_payment_term_id.id
|
||||
fiscal_position = p.property_account_position_id.id
|
||||
addr = p.address_get(['delivery'])
|
||||
fiscal_position = self.env['account.fiscal.position'].get_fiscal_position(p.id, delivery_id=addr['delivery'])
|
||||
|
||||
|
||||
# If partner has no warning, check its company
|
||||
|
||||
@@ -181,6 +181,8 @@ var DashBoard = form_common.FormWidget.extend({
|
||||
action = result,
|
||||
view_mode = action_attrs.view_mode;
|
||||
|
||||
if (!action) { return; }
|
||||
|
||||
// evaluate action_attrs context and domain
|
||||
action_attrs.context_string = action_attrs.context;
|
||||
action_attrs.context = pyeval.eval(
|
||||
|
||||
@@ -177,6 +177,7 @@ class fleet_vehicle(osv.Model):
|
||||
if context is None:
|
||||
context = {}
|
||||
if context.get('xml_id'):
|
||||
context.pop('group_by', False)
|
||||
res = self.pool.get('ir.actions.act_window').for_xml_id(cr, uid ,'fleet', context['xml_id'], context=context)
|
||||
res['context'] = context
|
||||
res['context'].update({'default_vehicle_id': ids[0]})
|
||||
|
||||
@@ -59,8 +59,9 @@ function _parse_and_transform(nodes, transform_function) {
|
||||
}).join("");
|
||||
}
|
||||
|
||||
// suggested regexp (gruber url matching regexp, adapted to js, see https://gist.github.com/gruber/8891611)
|
||||
var url_regexp = /\b((?:https?:\/\/|www\d{0,3}[.]|[a-z0-9.\-]+[.][a-z]{2,4}\/)(?:[^\s()<>]+|\(([^\s()<>]+|(\([^\s()<>]+\)))*\))+(?:\(([^\s()<>]+|(\([^\s()<>]+\)))*\)|[^\s`!()\[\]{};:'".,<>?«»“”‘’]))/gi;
|
||||
// Suggested URL Javascript regex of http://stackoverflow.com/questions/3809401/what-is-a-good-regular-expression-to-match-a-url
|
||||
// Adapted to make http(s):// not required if (and only if) www. is given. So `should.notmatch` does not match.
|
||||
var url_regexp = /\b(?:https?:\/\/|(www\.))[-a-zA-Z0-9@:%._\+~#=]{2,256}\.[a-z]{2,13}\b([-a-zA-Z0-9@:%_\+.~#?&//=]*)/gi;
|
||||
function add_link (node, transform_children) {
|
||||
if (node.nodeType === 3) { // text node
|
||||
return node.data.replace(url_regexp, function (url) {
|
||||
|
||||
@@ -25,16 +25,16 @@
|
||||
</t>
|
||||
</t>
|
||||
<t t-jquery="tbody tr.paymentline.selected">
|
||||
this.removeAttr("class");
|
||||
this.attr('t-attf-class', 'paymentline selected #{line.mercury_swipe_pending ? "o_pos_mercury_swipe_pending" : ""}');
|
||||
this.removeAttr('class');
|
||||
this.attr('t-attf-class', 'paymentline selected #{line.mercury_swipe_pending ? \'o_pos_mercury_swipe_pending\' : \'\'}');
|
||||
</t>
|
||||
<t t-jquery="tbody tr.paymentline[t-att-data-cid*='line.cid']">
|
||||
this.removeAttr("class");
|
||||
this.attr('t-attf-class', 'paymentline #{line.mercury_swipe_pending ? "o_pos_mercury_swipe_pending" : ""}');
|
||||
this.removeAttr('class');
|
||||
this.attr('t-attf-class', 'paymentline #{line.mercury_swipe_pending ? \'o_pos_mercury_swipe_pending\' : \'\'}');
|
||||
</t>
|
||||
<t t-jquery="tbody tr td.col-tendered.edit">
|
||||
this.removeAttr("class");
|
||||
this.attr('t-attf-class', 'col-tendered edit #{line.mercury_swipe_pending ? "o_pos_mercury_swipe_pending" : ""}');
|
||||
this.removeAttr('class');
|
||||
this.attr('t-attf-class', 'col-tendered edit #{line.mercury_swipe_pending ? \'o_pos_mercury_swipe_pending\' : \'\'}');
|
||||
</t>
|
||||
</t>
|
||||
|
||||
|
||||
+1
-1
@@ -652,7 +652,7 @@ class SaleOrderLine(models.Model):
|
||||
|
||||
vals = line._prepare_order_line_procurement(group_id=line.order_id.procurement_group_id.id)
|
||||
vals['product_qty'] = line.product_uom_qty - qty
|
||||
new_proc = self.env["procurement.order"].create(vals)
|
||||
new_proc = self.env["procurement.order"].with_context(procurement_autorun_defer=True).create(vals)
|
||||
new_procs += new_proc
|
||||
new_procs.run()
|
||||
return new_procs
|
||||
|
||||
@@ -121,8 +121,9 @@ class SaleOrderLine(models.Model):
|
||||
def _compute_qty_delivered_updateable(self):
|
||||
for line in self:
|
||||
if line.product_id.type not in ('consu', 'product'):
|
||||
return super(SaleOrderLine, self)._compute_qty_delivered_updateable()
|
||||
line.qty_delivered_updateable = False
|
||||
super(SaleOrderLine, line)._compute_qty_delivered_updateable()
|
||||
else:
|
||||
line.qty_delivered_updateable = False
|
||||
|
||||
@api.onchange('product_id')
|
||||
def _onchange_product_id_set_customer_lead(self):
|
||||
|
||||
@@ -645,11 +645,11 @@ var FormView = View.extend(common.FieldManagerMixin, {
|
||||
}
|
||||
},
|
||||
disable_button: function () {
|
||||
this.$('.oe_form_buttons').add(this.$buttons).find('button').addClass('o_disabled').prop('disabled', true);
|
||||
this.$('.oe_form_buttons,.o_statusbar_buttons').add(this.$buttons).find('button').addClass('o_disabled').prop('disabled', true);
|
||||
this.is_disabled = true;
|
||||
},
|
||||
enable_button: function () {
|
||||
this.$('.oe_form_buttons').add(this.$buttons).find('button.o_disabled').removeClass('o_disabled').prop('disabled', false);
|
||||
this.$('.oe_form_buttons,.o_statusbar_buttons').add(this.$buttons).find('button.o_disabled').removeClass('o_disabled').prop('disabled', false);
|
||||
this.is_disabled = false;
|
||||
},
|
||||
on_button_save: function() {
|
||||
@@ -664,8 +664,10 @@ var FormView = View.extend(common.FieldManagerMixin, {
|
||||
self.to_view_mode();
|
||||
core.bus.trigger('do_reload_needaction');
|
||||
core.bus.trigger('form_view_saved', self);
|
||||
}).always(function() {
|
||||
self.enable_button();
|
||||
});
|
||||
}).always(function(){
|
||||
}).fail(function(){
|
||||
self.enable_button();
|
||||
});
|
||||
},
|
||||
|
||||
@@ -38,7 +38,7 @@ class WebsiteEventTrackController(http.Controller):
|
||||
for loc in locations.keys():
|
||||
if locations[loc] and (locations[loc][-1][2] > start_date):
|
||||
locations[loc][-1][3] += 1
|
||||
elif not locations[loc] or locations[loc][-1][2] < start_date:
|
||||
elif not locations[loc] or locations[loc][-1][2] <= start_date:
|
||||
locations[loc].append([False, locations[loc] and locations[loc][-1][2] or dates[0][0], start_date, 1])
|
||||
dates[-1][1][loc] = locations[loc][-1]
|
||||
forcetr = not bool(location)
|
||||
|
||||
@@ -300,6 +300,13 @@ actual arch.
|
||||
raise ValidationError(_('Invalid view definition'))
|
||||
return True
|
||||
|
||||
@api.constrains('inherit_id')
|
||||
def _check_000_inheritance(self):
|
||||
# NOTE: constraints methods are check alphabetically. Always ensure this method will be
|
||||
# called before other constraint metheods to avoid infinite loop in `read_combined`.
|
||||
if not self._check_recursion(parent='inherit_id'):
|
||||
raise ValidationError(_('You cannot create recursive inherited views.'))
|
||||
|
||||
_sql_constraints = [
|
||||
('inheritance_mode',
|
||||
"CHECK (mode != 'extension' OR inherit_id IS NOT NULL)",
|
||||
|
||||
@@ -9,6 +9,7 @@ from lxml.builder import E
|
||||
|
||||
from psycopg2 import IntegrityError
|
||||
|
||||
from openerp.exceptions import ValidationError
|
||||
from openerp.tests import common
|
||||
import openerp.tools
|
||||
|
||||
@@ -251,6 +252,25 @@ class TestViewInheritance(ViewCase):
|
||||
self.View.default_view(
|
||||
self.cr, self.uid, model=self.model, view_type='graph'))
|
||||
|
||||
def test_no_recursion(self):
|
||||
r1 = self.makeView('R1')
|
||||
with self.assertRaises(ValidationError), self.cr.savepoint():
|
||||
self.View.write(self.cr, self.uid, r1, {'inherit_id': r1})
|
||||
|
||||
r2 = self.makeView('R2', r1)
|
||||
r3 = self.makeView('R3', r2)
|
||||
with self.assertRaises(ValidationError), self.cr.savepoint():
|
||||
self.View.write(self.cr, self.uid, r2, {'inherit_id': r3})
|
||||
|
||||
with self.assertRaises(ValidationError), self.cr.savepoint():
|
||||
self.View.write(self.cr, self.uid, r1, {'inherit_id': r3})
|
||||
|
||||
with self.assertRaises(ValidationError), self.cr.savepoint():
|
||||
self.View.write(self.cr, self.uid, r1, {
|
||||
'inherit_id': r1,
|
||||
'arch': self.arch_for('itself', parent=True),
|
||||
})
|
||||
|
||||
class TestApplyInheritanceSpecs(ViewCase):
|
||||
""" Applies a sequence of inheritance specification nodes to a base
|
||||
architecture. IO state parameters (cr, uid, model, context) are used for
|
||||
|
||||
Reference in New Issue
Block a user