diff --git a/addons/account/static/src/js/reconciliation/reconciliation_model.js b/addons/account/static/src/js/reconciliation/reconciliation_model.js index 26e8fa3827e..15b44716d3a 100644 --- a/addons/account/static/src/js/reconciliation/reconciliation_model.js +++ b/addons/account/static/src/js/reconciliation/reconciliation_model.js @@ -394,9 +394,17 @@ var StatementModel = BasicModel.extend({ }; }); }); + var domainReconcile = []; + if (context && context.company_ids) { + domainReconcile.push(['company_id', 'in', context.company_ids]); + } + if (context && context.active_model === 'account.journal' && context.active_ids) { + domainReconcile.push(['journal_id', 'in', [false].concat(context.active_ids)]); + } var def_reconcileModel = this._rpc({ model: 'account.reconcile.model', method: 'search_read', + domain: domainReconcile, }) .then(function (reconcileModels) { self.reconcileModels = reconcileModels; @@ -1193,9 +1201,14 @@ var ManualModel = StatementModel.extend({ self.accounts = _.object(self.account_ids, _.pluck(accounts, 'code')); }); + var domainReconcile = []; + if (context && context.company_ids) { + domainReconcile.push(['company_id', 'in', context.company_ids]); + } var def_reconcileModel = this._rpc({ model: 'account.reconcile.model', method: 'search_read', + domain: domainReconcile, }) .then(function (reconcileModels) { self.reconcileModels = reconcileModels; diff --git a/addons/account/tests/test_payment.py b/addons/account/tests/test_payment.py index 67350534347..86d526622e3 100644 --- a/addons/account/tests/test_payment.py +++ b/addons/account/tests/test_payment.py @@ -420,6 +420,32 @@ class TestPayment(AccountingTestCase): self.assertTrue(payment.move_line_ids.filtered(lambda l: l.account_id == invoice.account_id)[0].full_reconcile_id) self.assertEqual(invoice.state, 'paid') + def test_payment_and_writeoff_out_refund(self): + # Use case: + # Company is in EUR, create a credit note for 100 EUR and register payment of 90. + # Mark invoice as fully paid with a write_off + # Check that all the aml are correctly created. + invoice = self.create_invoice(amount=100, type='out_refund', currency_id=self.currency_eur_id, partner=self.partner_agrolait.id) + # register payment on invoice + payment = self.payment_model.create({'payment_type': 'outbound', + 'payment_method_id': self.env.ref('account.account_payment_method_manual_in').id, + 'partner_type': 'customer', + 'partner_id': self.partner_agrolait.id, + 'amount': 90, + 'payment_date': time.strftime('%Y') + '-07-15', + 'payment_difference_handling': 'reconcile', + 'writeoff_account_id': self.account_payable.id, + 'journal_id': self.bank_journal_euro.id, + 'invoice_ids': [(4, invoice.id, None)] + }) + payment.post() + self.check_journal_items(payment.move_line_ids, [ + {'account_id': self.account_eur.id, 'debit': 0.0, 'credit': 90.0, 'amount_currency': 0.0, 'currency_id': False}, + {'account_id': self.account_payable.id, 'debit': 0.0, 'credit': 10.0, 'amount_currency': 0.0, 'currency_id': False}, + {'account_id': self.account_receivable.id, 'debit': 100.0, 'credit': 0.0, 'amount_currency': 0.0, 'currency_id': False}, + ]) + self.assertEqual(invoice.state, 'paid') + def test_payment_and_writeoff_in_other_currency_2(self): # Use case: # Company is in EUR, create a supplier bill of 5325.6 USD and register payment of 5325 USD, at a different rate diff --git a/addons/l10n_uk/data/l10n_uk_chart_data.xml b/addons/l10n_uk/data/l10n_uk_chart_data.xml index 70a81b228a2..4125fd23b98 100644 --- a/addons/l10n_uk/data/l10n_uk_chart_data.xml +++ b/addons/l10n_uk/data/l10n_uk_chart_data.xml @@ -1,6 +1,6 @@ - + diff --git a/addons/l10n_uk/i18n/l10n_uk.pot b/addons/l10n_uk/i18n/l10n_uk.pot index 61971d8a391..788aeef258d 100644 --- a/addons/l10n_uk/i18n/l10n_uk.pot +++ b/addons/l10n_uk/i18n/l10n_uk.pot @@ -17,7 +17,7 @@ msgstr "" #. module: l10n_uk #: model:ir.ui.menu,name:l10n_uk.account_reports_uk_statements_menu -msgid "British Statements" +msgid "United Kindom" msgstr "" #. module: l10n_uk diff --git a/addons/mail/static/src/js/followers.js b/addons/mail/static/src/js/followers.js index 5859d632fea..53ceacbde71 100644 --- a/addons/mail/static/src/js/followers.js +++ b/addons/mail/static/src/js/followers.js @@ -28,7 +28,9 @@ var Followers = AbstractField.extend({ 'click .o_remove_follower': '_onRemoveFollower', 'click .o_mail_redirect': '_onRedirect', }, - supportedFieldTypes: ['one2many'], + // this widget only supports one2many but is not generic enough to claim + // that it supports all one2many fields + // supportedFieldTypes: ['one2many'], // inherited init: function(parent, name, record, options) { diff --git a/addons/web/controllers/main.py b/addons/web/controllers/main.py index 19c6ed0b4b2..88374985b11 100644 --- a/addons/web/controllers/main.py +++ b/addons/web/controllers/main.py @@ -1073,7 +1073,12 @@ class Binary(http.Controller): if content: image_base64 = base64.b64decode(content) else: - image_base64 = self.placeholder(image='placeholder.png') # could return (contenttype, content) in master + suffix = field.split('_')[-1] + if suffix in ('small', 'medium', 'big'): + encoded_placeholder = base64.b64encode(self.placeholder(image='placeholder.png')) + image_base64 = base64.b64decode(getattr(odoo.tools, 'image_resize_image_%s' % suffix)(encoded_placeholder)) + else: + image_base64 = self.placeholder(image='placeholder.png') # could return (contenttype, content) in master headers = self.force_contenttype(headers, contenttype='image/png') headers.append(('Content-Length', len(image_base64))) diff --git a/addons/website_sale/models/website.py b/addons/website_sale/models/website.py index 5f0848750e8..5a454284902 100644 --- a/addons/website_sale/models/website.py +++ b/addons/website_sale/models/website.py @@ -161,8 +161,10 @@ class Website(models.Model): affiliate_id = request.session.get('affiliate_id') salesperson_id = affiliate_id if self.env['res.users'].sudo().browse(affiliate_id).exists() else request.website.salesperson_id.id addr = partner.address_get(['delivery', 'invoice']) - if len(partner.sale_order_ids): # first = me - addr['delivery'] = partner.sale_order_ids[0].partner_shipping_id.id + if not request.website.is_public_user(): + last_sale_order = self.env['sale.order'].search([('partner_id', '=', partner.id)], limit=1, order="date_order desc, id desc") + if last_sale_order: # first = me + addr['delivery'] = last_sale_order.partner_shipping_id.id default_user_id = partner.parent_id.user_id.id or partner.user_id.id values = { 'partner_id': partner.id, diff --git a/odoo/addons/base/tests/test_orm.py b/odoo/addons/base/tests/test_orm.py index bbb52f8c80a..3facd2c4570 100644 --- a/odoo/addons/base/tests/test_orm.py +++ b/odoo/addons/base/tests/test_orm.py @@ -315,6 +315,17 @@ class TestInherits(TransactionCase): self.assertEqual(user_bar.name, 'Bar', "name is given from specific partner") self.assertEqual(user_bar.signature, user_foo.signature, "signature should be copied") + @mute_logger('odoo.models') + def test_write_date(self): + """ modifying inherited fields must update write_date """ + user = self.env.user + write_date_before = user.write_date + + # write base64 image + user.write({'image': 'R0lGODlhAQABAIAAAP///////yH5BAEKAAEALAAAAAABAAEAAAICTAEAOw=='}) + write_date_after = user.write_date + self.assertNotEqual(write_date_before, write_date_after) + CREATE = lambda values: (0, False, values) UPDATE = lambda id, values: (1, id, values) diff --git a/odoo/addons/base/wizard/base_module_uninstall.py b/odoo/addons/base/wizard/base_module_uninstall.py index 60585fc7a73..d8e6846fc07 100644 --- a/odoo/addons/base/wizard/base_module_uninstall.py +++ b/odoo/addons/base/wizard/base_module_uninstall.py @@ -40,10 +40,12 @@ class BaseModuleUninstall(models.TransientModel): for wizard in self: if wizard.module_id: module_names = set(wizard._get_modules().mapped('name')) - # find the models that have all their XIDs in the given modules + def lost(model): - return all(xid.split('.')[0] in module_names - for xid in ir_models_xids.get(model.id, ())) + xids = ir_models_xids.get(model.id, ()) + return xids and all(xid.split('.')[0] in module_names for xid in xids) + + # find the models that have all their XIDs in the given modules self.model_ids = ir_models.filtered(lost).sorted('name') @api.onchange('module_id') diff --git a/odoo/models.py b/odoo/models.py index 85748a04832..5627d43ad6a 100644 --- a/odoo/models.py +++ b/odoo/models.py @@ -3116,7 +3116,7 @@ class BaseModel(MetaModel('DummyModel', (object,), {'_register': False})): with self.env.protecting(protected_fields, self): # write stored fields with (low-level) method _write - if store_vals: + if store_vals or inverse_vals or inherited_vals: self._write(store_vals) # update parent records (after possibly updating parent fields)