[MERGE] forward port branch saas-11 up to 51b79a7ee1
This commit is contained in:
@@ -278,13 +278,19 @@ var DebugWidget = PosBaseWidget.extend({
|
||||
});
|
||||
|
||||
this.$('.button.export_unpaid_orders').click(function(){
|
||||
self.gui.download_file(self.pos.export_unpaid_orders(),
|
||||
"unpaid_orders_" + (new Date()).toUTCString().replace(/\ /g,'_') + '.json');
|
||||
self.gui.prepare_download_link(
|
||||
self.pos.export_unpaid_orders(),
|
||||
_t("unpaid orders") + ' ' + moment().format('YYYY-MM-DD-HH-mm-ss') + '.json',
|
||||
".export_unpaid_orders", ".download_unpaid_orders"
|
||||
);
|
||||
});
|
||||
|
||||
this.$('.button.export_paid_orders').click(function() {
|
||||
self.gui.download_file(self.pos.export_paid_orders(),
|
||||
"paid_orders_" + (new Date()).toUTCString().replace(/\ /g,'_') + '.json');
|
||||
self.gui.prepare_download_link(
|
||||
self.pos.export_paid_orders(),
|
||||
_t("paid orders") + ' ' + moment().format('YYYY-MM-DD-HH-mm-ss') + '.json',
|
||||
".export_paid_orders", ".download_paid_orders"
|
||||
);
|
||||
});
|
||||
|
||||
this.$('.button.import_orders input').on('change', function(event) {
|
||||
|
||||
@@ -362,7 +362,34 @@ var Gui = core.Class.extend({
|
||||
// if 'contents' is not a string, it is converted into
|
||||
// a JSON representation of the contents.
|
||||
|
||||
|
||||
// TODO: remove me in master: deprecated in favor of prepare_download_link
|
||||
// this method is kept for backward compatibility but is likely not going
|
||||
// to work as many browsers do to not accept fake click events on links
|
||||
download_file: function(contents, name) {
|
||||
href_params = this.prepare_file_blob(contents,name);
|
||||
var evt = document.createEvent("HTMLEvents");
|
||||
evt.initEvent("click");
|
||||
|
||||
$("<a>",href_params).get(0).dispatchEvent(evt);
|
||||
|
||||
},
|
||||
|
||||
prepare_download_link: function(contents, filename, src, target) {
|
||||
var href_params = this.prepare_file_blob(contents, filename);
|
||||
|
||||
$(target).parent().attr(href_params);
|
||||
$(src).addClass('oe_hidden');
|
||||
$(target).removeClass('oe_hidden');
|
||||
|
||||
// hide again after click
|
||||
$(target).click(function() {
|
||||
$(src).removeClass('oe_hidden');
|
||||
$(this).addClass('oe_hidden');
|
||||
});
|
||||
},
|
||||
|
||||
prepare_file_blob: function(contents, name) {
|
||||
var URL = window.URL || window.webkitURL;
|
||||
|
||||
if (typeof contents !== 'string') {
|
||||
@@ -371,13 +398,8 @@ var Gui = core.Class.extend({
|
||||
|
||||
var blob = new Blob([contents]);
|
||||
|
||||
var evt = document.createEvent("HTMLEvents");
|
||||
evt.initEvent("click");
|
||||
|
||||
$("<a>",{
|
||||
download: name || 'document.txt',
|
||||
href: URL.createObjectURL(blob),
|
||||
}).get(0).dispatchEvent(evt);
|
||||
return {download: name || 'document.txt',
|
||||
href: URL.createObjectURL(blob),}
|
||||
},
|
||||
|
||||
/* ---- Gui: EMAILS ---- */
|
||||
|
||||
@@ -105,7 +105,9 @@ var ErrorTracebackPopupWidget = ErrorPopupWidget.extend({
|
||||
this._super(opts);
|
||||
|
||||
this.$('.download').off('click').click(function(){
|
||||
self.gui.download_file(self.options.body,'traceback.txt');
|
||||
self.gui.prepare_download_link(self.options.body,
|
||||
_t('error') + ' ' + moment().format('YYYY-MM-DD-HH-mm-ss') + '.txt',
|
||||
'.download', '.download_error_file');
|
||||
});
|
||||
|
||||
this.$('.email').off('click').click(function(){
|
||||
|
||||
@@ -975,6 +975,9 @@
|
||||
<div class="button cancel">
|
||||
Ok
|
||||
</div>
|
||||
<a><div class="button icon download_error_file oe_hidden">
|
||||
<i class="fa fa-arrow-down"></i>
|
||||
</div></a>
|
||||
<div class="button icon download">
|
||||
<i class="fa fa-download"></i>
|
||||
</div>
|
||||
@@ -1308,7 +1311,9 @@
|
||||
<li class="button delete_orders">Delete Paid Orders</li>
|
||||
<li class="button delete_unpaid_orders">Delete Unpaid Orders</li>
|
||||
<li class="button export_paid_orders">Export Paid Orders</li>
|
||||
<a><li class="button download_paid_orders oe_hidden">Download Paid Orders</li></a>
|
||||
<li class="button export_unpaid_orders">Export Unpaid Orders</li>
|
||||
<a><li class="button download_unpaid_orders oe_hidden">Download Unpaid Orders</li></a>
|
||||
<li class="button import_orders" style="position:relative">
|
||||
Import Orders
|
||||
<input type="file" style="opacity:0;position:absolute;top:0;left:0;right:0;bottom:0;margin:0;cursor:pointer"/>
|
||||
|
||||
@@ -453,6 +453,7 @@ class PurchaseOrder(models.Model):
|
||||
result = action.read()[0]
|
||||
|
||||
#override the context to get rid of the default filtering on picking type
|
||||
result.pop('id', None)
|
||||
result['context'] = {}
|
||||
pick_ids = sum([order.picking_ids.ids for order in self], [])
|
||||
#choose the view_mode accordingly
|
||||
|
||||
@@ -34,8 +34,7 @@ class PackOperation(models.Model):
|
||||
product_qty = fields.Float('To Do', default=0.0, digits=dp.get_precision('Product Unit of Measure'), required=True)
|
||||
ordered_qty = fields.Float('Ordered Quantity', digits=dp.get_precision('Product Unit of Measure'))
|
||||
qty_done = fields.Float('Done', default=0.0, digits=dp.get_precision('Product Unit of Measure'))
|
||||
# TDE FIXME: what what what what ??
|
||||
is_done = fields.Boolean(compute='_compute_is_done', inverse='_set_is_done', string='Done', oldname='processed_boolean')
|
||||
is_done = fields.Boolean(compute='_compute_is_done', string='Done', readonly=False, oldname='processed_boolean')
|
||||
package_id = fields.Many2one('stock.quant.package', 'Source Package')
|
||||
pack_lot_ids = fields.One2many('stock.pack.operation.lot', 'operation_id', 'Lots/Serial Numbers Used')
|
||||
result_package_id = fields.Many2one(
|
||||
@@ -73,9 +72,8 @@ class PackOperation(models.Model):
|
||||
def _compute_is_done(self):
|
||||
self.is_done = self.qty_done > 0.0
|
||||
|
||||
@api.one
|
||||
def _set_is_done(self):
|
||||
# TDE FIXME: whuuuut ???
|
||||
@api.onchange('is_done')
|
||||
def on_change_is_done(self):
|
||||
if not self.product_id:
|
||||
if self.is_done and self.qty_done == 0:
|
||||
self.qty_done = 1.0
|
||||
|
||||
@@ -1366,7 +1366,8 @@ class TestStockFlow(TestStockCommon):
|
||||
|
||||
# set the pack in pack operation to 'done'
|
||||
for pack in picking_pack.pack_operation_pack_ids:
|
||||
pack.qty_done = 1.0
|
||||
pack.is_done = True
|
||||
pack.on_change_is_done()
|
||||
|
||||
# Put in a pack
|
||||
picking_pack.put_in_pack()
|
||||
@@ -1384,7 +1385,8 @@ class TestStockFlow(TestStockCommon):
|
||||
|
||||
# set the pack in pack operation to 'done'
|
||||
for pack in picking_out.pack_operation_pack_ids:
|
||||
pack.qty_done = 1.0
|
||||
pack.is_done = True
|
||||
pack.on_change_is_done()
|
||||
|
||||
# Validate picking
|
||||
picking_out.do_new_transfer()
|
||||
|
||||
@@ -1499,7 +1499,7 @@ ListView.Groups = Class.extend({
|
||||
// drag and drop enabled if list is not sorted (unless it is sorted by
|
||||
// its sequence field (ASC)), and there is a visible column with
|
||||
// @widget=handle or "sequence" column in the view.
|
||||
if ((dataset.sort && [seqname, seqname + 'ASC', ''].indexOf(dataset.sort()) === -1)
|
||||
if ((dataset.sort && [seqname, seqname + ' ASC', ''].indexOf(dataset.sort()) === -1)
|
||||
|| !_(this.columns).findWhere({'name': seqname})) {
|
||||
return;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user