From d81000d0a6b74cc9814b67fda6a02930c0a9fe46 Mon Sep 17 00:00:00 2001 From: Nicolas Martinelli Date: Tue, 5 Dec 2017 11:33:29 +0100 Subject: [PATCH 01/10] [FIX] point_of_sale: virtual keyboard Several issues arise with the virtual keyboard. Issue 1 - Go in client list - Go back to product list The keyboard is still connected to the client search field. Issue 2 - Go in client list - Add a new client - Click on any field The keyboard is still connected to the client search field, it's impossible to fill in any client data. opw-784613 --- addons/point_of_sale/static/src/js/screens.js | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/addons/point_of_sale/static/src/js/screens.js b/addons/point_of_sale/static/src/js/screens.js index d9fe56cd5e5..1dcbf9d90fb 100644 --- a/addons/point_of_sale/static/src/js/screens.js +++ b/addons/point_of_sale/static/src/js/screens.js @@ -980,6 +980,9 @@ var ProductScreenWidget = ScreenWidget.extend({ this.product_categories_widget.reset_category(); this.numpad.state.reset(); } + if (this.pos.config.iface_vkeyboard && this.chrome.widget.keyboard) { + this.chrome.widget.keyboard.connect($(this.el.querySelector('.searchbox input'))); + } }, close: function(){ @@ -1326,6 +1329,7 @@ var ClientListScreenWidget = ScreenWidget.extend({ // to maintain consistent scroll. display_client_details: function(visibility,partner,clickpos){ var self = this; + var searchbox = this.$('.searchbox input'); var contents = this.$('.client-details-contents'); var parent = this.$('.client-list').parent(); var scroll = parent.scrollTop(); @@ -1362,6 +1366,19 @@ var ClientListScreenWidget = ScreenWidget.extend({ this.details_visible = true; this.toggle_save_button(); } else if (visibility === 'edit') { + // Connect the keyboard to the edited field + if (this.pos.config.iface_vkeyboard && this.chrome.widget.keyboard) { + contents.off('click', '.detail'); + searchbox.off('click'); + contents.on('click', '.detail', function(ev){ + self.chrome.widget.keyboard.connect(ev.target); + self.chrome.widget.keyboard.show(); + }); + searchbox.on('click', function() { + self.chrome.widget.keyboard.connect($(this)); + }); + } + this.editing_client = true; contents.empty(); contents.append($(QWeb.render('ClientDetailsEdit',{widget:this,partner:partner}))); @@ -1404,6 +1421,9 @@ var ClientListScreenWidget = ScreenWidget.extend({ }, close: function(){ this._super(); + if (this.pos.config.iface_vkeyboard && this.chrome.widget.keyboard) { + this.chrome.widget.keyboard.hide(); + } }, }); gui.define_screen({name:'clientlist', widget: ClientListScreenWidget}); From 9d0b4d0c2d9e970f614ebe8ce7cabe35275ebfc9 Mon Sep 17 00:00:00 2001 From: Nicolas Martinelli Date: Wed, 6 Dec 2017 09:32:05 +0100 Subject: [PATCH 02/10] [FIX] base: deactivate lang - Install a new language - Set it as default for several users - Open the language and click on "Deactivate" Traceback. Fixes #21418 opw-786342 --- odoo/addons/base/res/res_lang.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/odoo/addons/base/res/res_lang.py b/odoo/addons/base/res/res_lang.py index 6320f9d822d..072345ae057 100644 --- a/odoo/addons/base/res/res_lang.py +++ b/odoo/addons/base/res/res_lang.py @@ -220,12 +220,11 @@ class Lang(models.Model): if self.env['res.users'].search([('lang', 'in', lang_codes)]): raise UserError(_("Cannot unactivate a language that is currently used by users.")) # delete linked ir.value specifying default partner's language - default_lang = self.env['ir.values'].search([ + self.env['ir.values'].search([ ('key', '=', 'default'), ('name', '=', 'lang'), - ('model', '=', 'res.partner')]) - if default_lang and default_lang.value_unpickle in lang_codes: - default_lang.unlink() + ('model', '=', 'res.partner') + ]).filtered(lambda l: l.value_unpickle in lang_codes).unlink() self.clear_caches() return super(Lang, self).write(vals) From af8908b03c73f8bb5b6ff3a60171caedaf017e82 Mon Sep 17 00:00:00 2001 From: "Lucas Perais (lpe)" Date: Tue, 5 Dec 2017 15:00:07 +0100 Subject: [PATCH 03/10] [FIX] stock: do not propagate date when negative delta In Pick - Ship: - validate a sale order which scheduled date is an hour in the future. - validate the WH/PICK picking Before this commit the WH/OUT picking 's scheduled date was set a day in the **past** This was due to the implementation of datetime substraction and timedelta, which, in case of a negative value, would take -1 day and some complementary values (hours, minutes etc...) (the difference is complementary) After this commit, the WH/OUT picking 's scheduled date stays what it was in that particular use case. OPW 784452 --- addons/stock/models/stock_move.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/stock/models/stock_move.py b/addons/stock/models/stock_move.py index 26db3fa010f..a5b97bc7938 100644 --- a/addons/stock/models/stock_move.py +++ b/addons/stock/models/stock_move.py @@ -283,7 +283,7 @@ class StockMove(models.Model): if propagated_date_field: current_date = datetime.strptime(move.date_expected, DEFAULT_SERVER_DATETIME_FORMAT) new_date = datetime.strptime(vals.get(propagated_date_field), DEFAULT_SERVER_DATETIME_FORMAT) - delta = new_date - current_date + delta = relativedelta.relativedelta(new_date, current_date) if abs(delta.days) >= move.company_id.propagation_minimum_delta: old_move_date = datetime.strptime(move.move_dest_id.date_expected, DEFAULT_SERVER_DATETIME_FORMAT) new_move_date = (old_move_date + relativedelta.relativedelta(days=delta.days or 0)).strftime(DEFAULT_SERVER_DATETIME_FORMAT) From 0a90393da36e1037327f9aa794dbb3f2c30bd66a Mon Sep 17 00:00:00 2001 From: jat-odoo Date: Wed, 6 Dec 2017 15:14:19 +0100 Subject: [PATCH 04/10] [FIX] web_editor: show proper video on existing video edition See https://github.com/odoo/odoo/commit/5e38bef5a5ededb28707af44a19caaec2af2d682 and especially https://github.com/odoo/odoo/commit/45e0cd564afdae71e9525193250744e88076da71 Closes #19673 --- addons/web_editor/static/src/js/widgets.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/web_editor/static/src/js/widgets.js b/addons/web_editor/static/src/js/widgets.js index 91025773cb4..233163a91f1 100644 --- a/addons/web_editor/static/src/js/widgets.js +++ b/addons/web_editor/static/src/js/widgets.js @@ -876,7 +876,7 @@ var VideoDialog = Widget.extend({ this.$iframe = this.$("iframe"); var $media = $(this.media); if ($media.hasClass("media_iframe_video")) { - var src = $media.data('src'); + var src = $media.data('oe-expression') || $media.data('src'); this.$("input#urlvideo").val(src); this.$("input#autoplay").prop("checked", (src || "").indexOf("autoplay") >= 0); this.get_video(); From f6321ab94c157a00d58bd17991f864fdd3fd64d3 Mon Sep 17 00:00:00 2001 From: "Pedro M. Baeza" Date: Tue, 5 Dec 2017 13:09:11 +0100 Subject: [PATCH 05/10] [FIX] hr_attendance: Make department related field readonly Related fields that are not readonly are rewritten each time you save the associated record, provoking performance problems. Moreover, we don't want to allow an employee to change its department through an attendance record. Closes #21441 --- addons/hr_attendance/models/hr_attendance.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/addons/hr_attendance/models/hr_attendance.py b/addons/hr_attendance/models/hr_attendance.py index 4230cee751e..e8772aeba10 100644 --- a/addons/hr_attendance/models/hr_attendance.py +++ b/addons/hr_attendance/models/hr_attendance.py @@ -16,7 +16,8 @@ class HrAttendance(models.Model): return self.env['hr.employee'].search([('user_id', '=', self.env.uid)], limit=1) employee_id = fields.Many2one('hr.employee', string="Employee", default=_default_employee, required=True, ondelete='cascade', index=True) - department_id = fields.Many2one('hr.department', string="Department", related="employee_id.department_id") + department_id = fields.Many2one('hr.department', string="Department", related="employee_id.department_id", + readonly=True) check_in = fields.Datetime(string="Check In", default=fields.Datetime.now, required=True) check_out = fields.Datetime(string="Check Out") worked_hours = fields.Float(string='Worked Hours', compute='_compute_worked_hours', store=True, readonly=True) From fd560917abfd647535797462e59cbb155bc98ea0 Mon Sep 17 00:00:00 2001 From: "Lucas Perais (lpe)" Date: Wed, 6 Dec 2017 15:25:45 +0100 Subject: [PATCH 06/10] [FIX] point_of_sale: sale details report correctly renders float Before this commit, when printing all orders from the POS interface, the ticket sometimes showed weird amounts (like 128.25000000001). This was due to the usual problem of representing a float and has nothing to do with Odoo. After this commit, the templates correctly display the amounts, rounded according to the currency We do this by applying the relevant qweb widget (or calling the right format function in JS) OPW 784626 --- addons/point_of_sale/models/pos_order.py | 1 + addons/point_of_sale/static/src/js/devices.js | 2 ++ addons/point_of_sale/static/src/xml/pos.xml | 6 +++--- addons/point_of_sale/views/report_saledetails.xml | 6 +++--- 4 files changed, 9 insertions(+), 6 deletions(-) diff --git a/addons/point_of_sale/models/pos_order.py b/addons/point_of_sale/models/pos_order.py index 044a98bb721..1f1cdcc328d 100644 --- a/addons/point_of_sale/models/pos_order.py +++ b/addons/point_of_sale/models/pos_order.py @@ -981,6 +981,7 @@ class ReportSaleDetails(models.AbstractModel): payments = [] return { + 'currency_precision': user_currency.digits, 'total_paid': user_currency.round(total), 'payments': payments, 'company_name': self.env.user.company_id.name, diff --git a/addons/point_of_sale/static/src/js/devices.js b/addons/point_of_sale/static/src/js/devices.js index 5d272bbfda8..e8bd95bc117 100644 --- a/addons/point_of_sale/static/src/js/devices.js +++ b/addons/point_of_sale/static/src/js/devices.js @@ -4,6 +4,7 @@ odoo.define('point_of_sale.devices', function (require) { var core = require('web.core'); var Model = require('web.DataModel'); var Session = require('web.Session'); +var PosBaseWidget = require('point_of_sale.BaseWidget'); var QWeb = core.qweb; var _t = core._t; @@ -440,6 +441,7 @@ var ProxyDevice = core.Class.extend(core.mixins.PropertiesMixin,{ var self = this; new Model('report.point_of_sale.report_saledetails').call('get_sale_details').then(function(result){ var env = { + widget: new PosBaseWidget(self), company: self.pos.company, pos: self.pos, products: result.products, diff --git a/addons/point_of_sale/static/src/xml/pos.xml b/addons/point_of_sale/static/src/xml/pos.xml index ee5bef3456d..c6627159262 100644 --- a/addons/point_of_sale/static/src/xml/pos.xml +++ b/addons/point_of_sale/static/src/xml/pos.xml @@ -900,7 +900,7 @@ - + @@ -914,7 +914,7 @@ - + @@ -925,7 +925,7 @@ Total: - + diff --git a/addons/point_of_sale/views/report_saledetails.xml b/addons/point_of_sale/views/report_saledetails.xml index c7cb58c6c4f..805f5808dd8 100644 --- a/addons/point_of_sale/views/report_saledetails.xml +++ b/addons/point_of_sale/views/report_saledetails.xml @@ -50,7 +50,7 @@ - + @@ -66,7 +66,7 @@ - + @@ -74,7 +74,7 @@

- Total: + Total:
From bde7030c598386afa9f9dd78b4d139fe1a90e6a7 Mon Sep 17 00:00:00 2001 From: auyeung112002 Date: Tue, 28 Nov 2017 18:56:23 +0800 Subject: [PATCH 07/10] [CLA] auyeung112002 signs the CLA Backport of ecbf7aa4714 to 10.0 Asked at #21284 --- doc/cla/individual/auyeung112002.md | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 doc/cla/individual/auyeung112002.md diff --git a/doc/cla/individual/auyeung112002.md b/doc/cla/individual/auyeung112002.md new file mode 100644 index 00000000000..c56eb068b3e --- /dev/null +++ b/doc/cla/individual/auyeung112002.md @@ -0,0 +1,11 @@ +Hong Kong, 2017-6-9 + +I hereby agree to the terms of the Odoo Individual Contributor License +Agreement v1.0. + +I declare that I am authorized and able to make this agreement and sign this +declaration. + +Signed, + +Jason auyeung112002@gmail.com https://github.com/auyeung112002 From bf119dcff6bc265cfb1f6dde56ce0e004b539cdd Mon Sep 17 00:00:00 2001 From: "Lucas Perais (lpe)" Date: Wed, 6 Dec 2017 10:51:57 +0100 Subject: [PATCH 08/10] [FIX] account: predicting receivable/payable on partner in tests Before this commit, when a localization defined default payable or receivable accounts on partners (like l10n_do does) The reconciliation tests that involve an invoice on the one hand and a payment on the other hand broke just because the accounts of the payment and the one of the invoice did not match After this commit, we force the receivable or payable account to be the partner's (if available) and the tests do not break --- addons/account/tests/test_reconciliation.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/addons/account/tests/test_reconciliation.py b/addons/account/tests/test_reconciliation.py index c0430d720c9..3b0198b3f09 100644 --- a/addons/account/tests/test_reconciliation.py +++ b/addons/account/tests/test_reconciliation.py @@ -19,13 +19,14 @@ class TestReconciliation(AccountingTestCase): self.res_currency_model = self.registry('res.currency') self.res_currency_rate_model = self.registry('res.currency.rate') - self.partner_agrolait_id = self.env.ref("base.res_partner_2").id + partner_agrolait = self.env.ref("base.res_partner_2") + self.partner_agrolait_id = partner_agrolait.id self.currency_swiss_id = self.env.ref("base.CHF").id self.currency_usd_id = self.env.ref("base.USD").id self.currency_euro_id = self.env.ref("base.EUR").id self.env.ref('base.main_company').write({'currency_id': self.currency_euro_id}) - self.account_rcv = self.env['account.account'].search([('user_type_id', '=', self.env.ref('account.data_account_type_receivable').id)], limit=1) - self.account_rsa = self.env['account.account'].search([('user_type_id', '=', self.env.ref('account.data_account_type_payable').id)], limit=1) + self.account_rcv = partner_agrolait.property_account_receivable_id or self.env['account.account'].search([('user_type_id', '=', self.env.ref('account.data_account_type_receivable').id)], limit=1) + self.account_rsa = partner_agrolait.property_account_payable_id or self.env['account.account'].search([('user_type_id', '=', self.env.ref('account.data_account_type_payable').id)], limit=1) self.product = self.env.ref("product.product_product_4") self.bank_journal_euro = self.env['account.journal'].create({'name': 'Bank', 'type': 'bank', 'code': 'BNK67'}) From cd31e82689c52c7001d209304f22e671bc36f16b Mon Sep 17 00:00:00 2001 From: "Pedro M. Baeza" Date: Wed, 8 Nov 2017 19:22:14 +0100 Subject: [PATCH 09/10] [FIX] account: Allow to duplicate supplier invoices As there's a check for unique supplier reference numbers, you can't duplicate them as the field is copied on the duplicated record. This patch removes the copy for emptying the error. @Tecnativa --- addons/account/models/account_invoice.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/account/models/account_invoice.py b/addons/account/models/account_invoice.py index 967bcc485c5..93951e68904 100644 --- a/addons/account/models/account_invoice.py +++ b/addons/account/models/account_invoice.py @@ -213,7 +213,7 @@ class AccountInvoice(models.Model): move_name = fields.Char(string='Journal Entry Name', readonly=False, default=False, copy=False, help="Technical field holding the number given to the invoice, automatically set when the invoice is validated then stored to set the same number again if the invoice is cancelled, set to draft and re-validated.") - reference = fields.Char(string='Vendor Reference', + reference = fields.Char(string='Vendor Reference', copy=False, help="The partner reference of this invoice.", readonly=True, states={'draft': [('readonly', False)]}) reference_type = fields.Selection('_get_reference_type', string='Payment Reference', required=True, readonly=True, states={'draft': [('readonly', False)]}, From 6b27d9f91a050ce5a8484fd53ba0bfcafe6d28c8 Mon Sep 17 00:00:00 2001 From: Pierre Masereel Date: Fri, 8 Dec 2017 16:03:08 +0100 Subject: [PATCH 10/10] [FIX] point_of_sale: digits field doesn't exist on currency As the field digit doesn't exist on currency, we use decimal_places instead which is the field containing the number of digits of the corresponding rounding field --- addons/point_of_sale/models/pos_order.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/point_of_sale/models/pos_order.py b/addons/point_of_sale/models/pos_order.py index 1f1cdcc328d..94d198c0f3d 100644 --- a/addons/point_of_sale/models/pos_order.py +++ b/addons/point_of_sale/models/pos_order.py @@ -981,7 +981,7 @@ class ReportSaleDetails(models.AbstractModel): payments = [] return { - 'currency_precision': user_currency.digits, + 'currency_precision': user_currency.decimal_places, 'total_paid': user_currency.round(total), 'payments': payments, 'company_name': self.env.user.company_id.name,