[MERGE] forward port of branch 8.0 up to 7780004

This commit is contained in:
Christophe Simonis
2015-03-19 18:48:41 +01:00
10 changed files with 29 additions and 30 deletions
+7 -4
View File
@@ -28,9 +28,12 @@ class account_move_line(osv.osv):
_inherit = "account.move.line"
# delegate to parent, used for local fields.function redefinition
def _amount_residual(self, cr, uid, ids, field_names, args, context=None):
return super(account_move_line, self)._amount_residual(
cr, uid, ids, field_names, args, context=context)
def _amount_to_pay(self, cr, uid, ids, field_names, args, context=None):
return {
id: value['amount_residual']
for id, value in self._amount_residual(cr, uid, ids, field_names, args,
context=context).items()
}
def _to_pay_search(self, cr, uid, obj, name, args, context=None):
if not args:
@@ -96,6 +99,6 @@ class account_move_line(osv.osv):
return line2bank
_columns = {
'amount_to_pay': fields.function(_amount_residual,
'amount_to_pay': fields.function(_amount_to_pay,
type='float', string='Amount to pay', fnct_search=_to_pay_search),
}
@@ -60,6 +60,10 @@
assert invoice.partner_id == payment_line.partner_id, "Partner is not correct."
assert invoice.date_due == payment_line.ml_maturity_date, "Due date is not correct."
assert invoice.amount_total == payment_line.amount, "Payment amount is not correct."
assert payment_line.move_line_id.amount_to_pay > 0, "Move line paid"
assert len(self.pool("account.move.line").search(cr, uid,
[('amount_to_pay', '>', 0), ('id', '=', payment_line.move_line_id.id)])) == 0, \
"No payment order found for this move line"
-
After making all payments, I finish the payment order.
-
@@ -75,7 +75,7 @@
</t>
<t t-extend="CalendarView.sidebar.responsible">
<t t-jquery="span#color_filter" t-operation="after">
<t t-jquery="span[t-attf-class*='color_filter']" t-operation="after">
<t t-if="(filters_value.value != -1) &amp;&amp; (filters_value.is_remove != false)">
<i class="oe_remove_follower fa fa-close hidden" title="Remove this favorite from the list" t-att-data-id="filters_value.value"/>
</t>
-1
View File
@@ -22,7 +22,6 @@
import math
import re
import time
from collections import OrderedDict
from _common import ceiling
+1 -4
View File
@@ -1748,10 +1748,7 @@ class stock_move(osv.osv):
'date': fields.datetime('Date', required=True, select=True, help="Move date: scheduled date until move is done, then date of actual move processing", states={'done': [('readonly', True)]}),
'date_expected': fields.datetime('Expected Date', states={'done': [('readonly', True)]}, required=True, select=True, help="Scheduled date for the processing of this move"),
'product_id': fields.many2one('product.product', 'Product', required=True, select=True, domain=[('type', '<>', 'service')], states={'done': [('readonly', True)]}),
'product_qty': fields.function(_quantity_normalize, fnct_inv=_set_product_qty, type='float', digits=0, store={
'stock.move': (lambda self, cr, uid, ids, ctx: ids, ['product_id', 'product_uom_qty', 'product_uom'], 20),
'product.product': (_get_moves_from_prod, ['uom_id'], 20), #Needed to allow to change UoM on the product when no done moves
}, string='Quantity',
'product_qty': fields.function(_quantity_normalize, fnct_inv=_set_product_qty, type='float', digits=0, store=True, string='Quantity',
help='Quantity in the default UoM of the product'),
'product_uom_qty': fields.float('Quantity', digits_compute=dp.get_precision('Product Unit of Measure'),
required=True, states={'done': [('readonly', True)]},
-14
View File
@@ -941,20 +941,6 @@ class DataSet(http.Controller):
return self._call_kw(model, method, args, {})
def _call_kw(self, model, method, args, kwargs):
# Temporary implements future display_name special field for model#read()
if method in ('read', 'search_read') and kwargs.get('context', {}).get('future_display_name'):
if 'display_name' in args[1]:
if method == 'read':
names = dict(request.session.model(model).name_get(args[0], **kwargs))
else:
names = dict(request.session.model(model).name_search('', args[0], **kwargs))
args[1].remove('display_name')
records = getattr(request.session.model(model), method)(*args, **kwargs)
for record in records:
record['display_name'] = \
names.get(record['id']) or "{0}#{1}".format(model, (record['id']))
return records
if method.startswith('_'):
raise AccessError(_("Underscore prefixed methods cannot be remotely called"))
+3 -3
View File
@@ -290,7 +290,7 @@ instance.web.FormView = instance.web.View.extend(instance.web.form.FieldManagerM
var fields = _.keys(self.fields_view.fields);
fields.push('display_name');
return self.dataset.read_index(fields, {
context: { 'bin_size': true, 'future_display_name' : true }
context: { 'bin_size': true }
}).then(function(r) {
self.trigger('load_record', r);
});
@@ -3744,9 +3744,9 @@ instance.web.form.FieldMany2One = instance.web.form.AbstractField.extend(instanc
minLength: 0,
delay: 200,
});
var appendTo = this.$input.parents('.oe-view-manager-content, .modal-dialog').last();
var appendTo = this.$input.parents('.oe-view-manager-content:visible, .modal-dialog:visible').last();
if (appendTo.length === 0) {
appendTo = '.oe_application > *';
appendTo = '.oe_application > *:visible:last';
}
this.$input.autocomplete({
appendTo: appendTo
+4
View File
@@ -990,6 +990,10 @@ class ir_model_data(osv.osv):
if record:
id = record.id
self.loads[(module,xml_id)] = (model,id)
for table, inherit_field in self.pool[model]._inherits.iteritems():
parent_id = record[inherit_field].id
parent_xid = '%s_%s' % (xml_id, table.replace('.', '_'))
self.loads[(module, parent_xid)] = (table, parent_id)
except Exception:
pass
return id
+2 -2
View File
@@ -195,10 +195,10 @@ def dump_db(db_name, stream, backup_format='zip'):
cmd.insert(-1, '--file=' + os.path.join(dump_dir, 'dump.sql'))
openerp.tools.exec_pg_command(*cmd)
if stream:
openerp.tools.osutil.zip_dir(dump_dir, stream, include_dir=False)
openerp.tools.osutil.zip_dir(dump_dir, stream, include_dir=False, fnct_sort=lambda file_name: file_name != 'dump.sql')
else:
t=tempfile.TemporaryFile()
openerp.tools.osutil.zip_dir(dump_dir, t, include_dir=False)
openerp.tools.osutil.zip_dir(dump_dir, t, include_dir=False, fnct_sort=lambda file_name: file_name != 'dump.sql')
t.seek(0)
return t
else:
+7 -1
View File
@@ -73,7 +73,12 @@ def tempdir():
finally:
shutil.rmtree(tmpdir)
def zip_dir(path, stream, include_dir=True): # TODO add ignore list
def zip_dir(path, stream, include_dir=True, fnct_sort=None): # TODO add ignore list
"""
: param fnct_sort : Function to be passed to "key" parameter of built-in
python sorted() to provide flexibility of sorting files
inside ZIP archive according to specific requirements.
"""
path = os.path.normpath(path)
len_prefix = len(os.path.dirname(path)) if include_dir else len(path)
if len_prefix:
@@ -81,6 +86,7 @@ def zip_dir(path, stream, include_dir=True): # TODO add ignore list
with zipfile.ZipFile(stream, 'w', compression=zipfile.ZIP_DEFLATED, allowZip64=True) as zipf:
for dirpath, dirnames, filenames in os.walk(path):
filenames = sorted(filenames, key=fnct_sort)
for fname in filenames:
bname, ext = os.path.splitext(fname)
ext = ext or bname