diff --git a/addons/account/models/account_invoice.py b/addons/account/models/account_invoice.py index a233c2947b0..d3aad9da4a9 100644 --- a/addons/account/models/account_invoice.py +++ b/addons/account/models/account_invoice.py @@ -70,7 +70,7 @@ class AccountInvoice(models.Model): @api.onchange('amount_total') def _onchange_amount_total(self): for inv in self: - if inv.amount_total < 0: + if float_compare(inv.amount_total, 0.0, precision_rounding=inv.currency_id.rounding) == -1: raise Warning(_('You cannot validate an invoice with a negative total amount. You should create a credit note instead.')) @api.model @@ -784,7 +784,7 @@ class AccountInvoice(models.Model): to_open_invoices = self.filtered(lambda inv: inv.state != 'open') if to_open_invoices.filtered(lambda inv: inv.state != 'draft'): raise UserError(_("Invoice must be in draft state in order to validate it.")) - if to_open_invoices.filtered(lambda inv: inv.amount_total < 0): + if to_open_invoices.filtered(lambda inv: float_compare(inv.amount_total, 0.0, precision_rounding=inv.currency_id.rounding) == -1): raise UserError(_("You cannot validate an invoice with a negative total amount. You should create a credit note instead.")) to_open_invoices.action_date_assign() to_open_invoices.action_move_create() diff --git a/addons/account/static/src/js/reconciliation/reconciliation_model.js b/addons/account/static/src/js/reconciliation/reconciliation_model.js index cdd3cc154ea..a61c5e2908f 100644 --- a/addons/account/static/src/js/reconciliation/reconciliation_model.js +++ b/addons/account/static/src/js/reconciliation/reconciliation_model.js @@ -868,7 +868,7 @@ var StatementModel = BasicModel.extend({ }) : false, account_code: self.accounts[line.st_line.open_balance_account_id], }; - line.balance.type = line.balance.amount_currency ? (line.balance.amount_currency > 0 && line.st_line.partner_id ? 0 : -1) : 1; + line.balance.type = line.balance.amount_currency ? (line.st_line.partner_id ? 0 : -1) : 1; }); }, /** diff --git a/addons/account/static/src/xml/account_reconciliation.xml b/addons/account/static/src/xml/account_reconciliation.xml index cf2db7e9eab..a4ef42a1ea2 100644 --- a/addons/account/static/src/xml/account_reconciliation.xml +++ b/addons/account/static/src/xml/account_reconciliation.xml @@ -128,7 +128,7 @@ - Create Write-offOpen balanceChoose counterpart + Open balanceChoose counterpart or Create Write-off diff --git a/addons/account/static/tests/reconciliation_tests.js b/addons/account/static/tests/reconciliation_tests.js index dc5ec8d95aa..991ebac12e6 100644 --- a/addons/account/static/tests/reconciliation_tests.js +++ b/addons/account/static/tests/reconciliation_tests.js @@ -1028,8 +1028,8 @@ QUnit.module('account', { widget.$('.create .create_label input').val('test1').trigger('input'); assert.strictEqual(widget.$('.accounting_view tbody .cell_right:last').text(), "$ 200.00", "should display the value 200.00 in left column"); - assert.strictEqual(widget.$('.accounting_view tfoot .cell_label').text(), "Create Write-off", "should display 'Create Write-off'"); - assert.strictEqual(widget.$('.accounting_view tfoot .cell_left').text(), "$ 25.00", "should display 'Create Write-off' with 25.00 in left column"); + assert.strictEqual(widget.$('.accounting_view tfoot .cell_label').text(), "Open balance", "should display 'Open balance'"); + assert.strictEqual(widget.$('.accounting_view tfoot .cell_left').text(), "$ 25.00", "should display 'Open balance' with 25.00 in left column"); assert.strictEqual(widget.$('.accounting_view tbody tr').length, 3, "should have 3 created reconcile lines"); clientAction.destroy(); @@ -1135,8 +1135,8 @@ QUnit.module('account', { $('.ui-autocomplete .ui-menu-item a:contains(20.00%)').trigger('mouseenter').trigger('click'); assert.strictEqual(widget.$('.accounting_view tbody .cell_right').text().replace('$_', ''), "$\u00a01100.00$\u00a0220.00", "should have 2 created reconcile lines with right column values"); - assert.strictEqual(widget.$('.accounting_view tfoot .cell_label').text(), "Create Write-off", "should display 'Create Write-off'"); - assert.strictEqual(widget.$('.accounting_view tfoot .cell_left').text(), "$\u00a0145.00", "should display 'Create Write-off' with 145.00 in right column"); + assert.strictEqual(widget.$('.accounting_view tfoot .cell_label').text(), "Open balance", "should display 'Open balance'"); + assert.strictEqual(widget.$('.accounting_view tfoot .cell_left').text(), "$\u00a0145.00", "should display 'Open balance' with 145.00 in right column"); assert.strictEqual(widget.$('.accounting_view tbody tr').length, 2, "should have 2 created reconcile lines"); clientAction.destroy(); @@ -1160,7 +1160,7 @@ QUnit.module('account', { assert.strictEqual(widget.$('.accounting_view tbody .cell_label, .accounting_view tbody .cell_right').text().replace(/[\n\r\s$,]+/g, ' '), " ATOS Banque 1145.62 Tax 20.00% 229.12 ATOS Frais 26.71 Tax 10.00% include 2.67", "should display 4 lines"); assert.strictEqual(widget.$('.accounting_view tfoot .cell_label, .accounting_view tfoot .cell_left').text().replace(/[\n\r\s$,]+/g, ' '), - "Create Write-off229.12", "should display the 'Create Write-off' line with value in left column"); + "Open balance229.12", "should display the 'Open balance' line with value in left column"); widget.$('.create .create_amount input').val('100').trigger('input'); @@ -1168,7 +1168,7 @@ QUnit.module('account', { " 101120 ATOS Banque 1075.00 101120 Tax 20.00% 215.00 101130 ATOS Frais 90.91 101300 Tax 10.00% include 9.09 ", "should update the value of the 4 lines (because the line must have 100% of the value)"); assert.strictEqual(widget.$('.accounting_view tfoot .cell_label, .accounting_view tfoot .cell_left').text().replace(/[\n\r\s$,]+/g, ' '), - "Create Write-off215.00", "should change the 'Create Write-off' line because the 20.00% tax is not an include tax"); + "Open balance215.00", "should change the 'Open balance' line because the 20.00% tax is not an include tax"); widget.$('.accounting_view tbody .cell_account_code:first').trigger('click'); widget.$('.accounting_view tbody .cell_label:first').trigger('click'); diff --git a/addons/barcodes/doc/index.rst b/addons/barcodes/README.rst similarity index 89% rename from addons/barcodes/doc/index.rst rename to addons/barcodes/README.rst index 6c93b1f0283..696ab62fbc5 100644 --- a/addons/barcodes/doc/index.rst +++ b/addons/barcodes/README.rst @@ -11,10 +11,10 @@ Barcodes encoding The Barcodes module defines barcode nomenclatures whose rules identify specific type of items e.g. products, locations. It contains the following features: -- Barcode patterns to identify barcodes containing a numerical value (e.g. weight, price) +- Patterns to identify barcodes containing a numerical value (e.g. weight, price) - Definitin of barcode aliases that allow to identify the same product with different barcodes - Unlimited barcode patterns and definitions, -- Barcode EAN13 encoding supported. +- Support for encodings EAN-13, EAN-8 and UPC-A Barcode encodings ----------------- @@ -65,7 +65,7 @@ We now want to write a barcode for 2.75kg of oranges. This barcode should be '21 numerical content of this barcode is '02750', and the correct checksum is '6'). When scanned, this barcode matches the Weighted Product rule (since is starts with '21'). The numerical content is extracted, and replaced by a sequence of '0's. The correct checksum is then computed for the obtained barcode -('2100001000004') and the corresponding product (oranges) qgit is retrieved from product table. +('2100001000004') and the corresponding product (oranges) is retrieved from product table. Note: the special characters '{' and '}' in patterns are used to identify numerical content. To explicitely specify '{' or '}' in a pattern, they must be escaped. @@ -86,6 +86,17 @@ matching the original, 12-digit long, barcode. Barcodes scanning ============================== +Scanning +-------- + +Use a USB scanner (that mimics keyboard inputs) in order to work with barcodes in Odoo. +The scanner must be configured to use no prefix and a carriage return or tab as suffix. +The delay between each character input must be less than or equal to 50 milliseconds. +Most barcode scanners will work out of the box. +However, make sure the scanner uses the same keyboard layout as the device it's plugged in. +Either by setting the device's keyboard layout to US QWERTY (default value for most readers) +or by changing the scanner's keyboard layout (check the manual). + Barcode events ------------------------------ diff --git a/addons/barcodes/__manifest__.py b/addons/barcodes/__manifest__.py index bb7b3cf4276..579e28e4ee2 100644 --- a/addons/barcodes/__manifest__.py +++ b/addons/barcodes/__manifest__.py @@ -3,27 +3,6 @@ 'version': '2.0', 'category': 'Extra Tools', 'summary': 'Barcodes Scanning and Parsing', - 'description': """ -This module adds support for barcode scanning and parsing. - -Scanning --------- -Use a USB scanner (that mimics keyboard inputs) in order to work with barcodes in Odoo. -The scanner must be configured to use no prefix and a carriage return or tab as suffix. -The delay between each character input must be less than or equal to 50 milliseconds. -Most barcode scanners will work out of the box. -However, make sure the scanner uses the same keyboard layout as the device it's plugged in. -Either by setting the device's keyboard layout to US QWERTY (default value for most readers) -or by changing the scanner's keyboard layout (check the manual). - -Parsing -------- -The barcodes are interpreted using the rules defined by a nomenclature. -It provides the following features: -- Patterns to identify barcodes containing a numerical value (e.g. weight, price) -- Definition of barcode aliases that allow to identify the same product with different barcodes -- Support for encodings EAN-13, EAN-8 and UPC-A -""", 'depends': ['web'], 'data': [ 'data/barcodes_data.xml', diff --git a/addons/mail/models/mail_activity.py b/addons/mail/models/mail_activity.py index 209a05999be..30e0dd7ea3d 100644 --- a/addons/mail/models/mail_activity.py +++ b/addons/mail/models/mail_activity.py @@ -123,9 +123,10 @@ class MailActivity(models.Model): for record in self.filtered(lambda activity: activity.date_deadline): today = today_default - if record.user_id.tz: + tz = record.user_id.sudo().tz + if tz: today_utc = pytz.UTC.localize(datetime.utcnow()) - today_tz = today_utc.astimezone(pytz.timezone(record.user_id.tz)) + today_tz = today_utc.astimezone(pytz.timezone(tz)) today = date(year=today_tz.year, month=today_tz.month, day=today_tz.day) date_deadline = fields.Date.from_string(record.date_deadline) diff --git a/addons/mrp/views/stock_move_views.xml b/addons/mrp/views/stock_move_views.xml index ff2cfec238c..323a8421287 100644 --- a/addons/mrp/views/stock_move_views.xml +++ b/addons/mrp/views/stock_move_views.xml @@ -22,7 +22,7 @@