diff --git a/addons/event/models/event.py b/addons/event/models/event.py index 1157d941e8b..4f7a3a4b917 100644 --- a/addons/event/models/event.py +++ b/addons/event/models/event.py @@ -438,9 +438,14 @@ class EventRegistration(models.Model): @api.multi def message_get_suggested_recipients(self): recipients = super(EventRegistration, self).message_get_suggested_recipients() + public_users = self.env['res.users'].sudo() + public_groups = self.env.ref("base.group_public", raise_if_not_found=False) + if public_groups: + public_users = public_groups.sudo().with_context(active_test=False).mapped("users") try: for attendee in self: - if attendee.partner_id: + is_public = attendee.sudo().with_context(active_test=False).partner_id.user_ids in public_users if public_users else False + if attendee.partner_id and not is_public: attendee._message_add_suggested_recipient(recipients, partner=attendee.partner_id, reason=_('Customer')) elif attendee.email: attendee._message_add_suggested_recipient(recipients, email=attendee.email, reason=_('Customer Email')) diff --git a/addons/l10n_nl/data/account_tax_template.xml b/addons/l10n_nl/data/account_tax_template.xml index c26dc9a8345..e9b937b98f5 100644 --- a/addons/l10n_nl/data/account_tax_template.xml +++ b/addons/l10n_nl/data/account_tax_template.xml @@ -593,7 +593,7 @@ none - + @@ -735,7 +735,7 @@ none - + diff --git a/addons/payment_ogone/controllers/main.py b/addons/payment_ogone/controllers/main.py index 1d03a688630..409e09b8a9e 100644 --- a/addons/payment_ogone/controllers/main.py +++ b/addons/payment_ogone/controllers/main.py @@ -110,7 +110,7 @@ class OgoneController(http.Controller): def feedback(self, **kwargs): try: tx = request.env['payment.transaction'].sudo()._ogone_form_get_tx_from_data(kwargs) - tx._ogone_s2s_validate() + tx._ogone_s2s_validate_tree(kwargs) except ValidationError: return 'ko' return 'ok' diff --git a/addons/stock/tests/__init__.py b/addons/stock/tests/__init__.py index a9a18e270e4..39efa507b3b 100644 --- a/addons/stock/tests/__init__.py +++ b/addons/stock/tests/__init__.py @@ -4,6 +4,7 @@ from . import test_stock_flow from . import test_product from . import test_warehouse from . import test_shipment +from . import test_stock_scrap from . import test_stock_location_search from . import test_quant from . import test_inventory diff --git a/addons/stock/tests/test_stock_scrap.py b/addons/stock/tests/test_stock_scrap.py new file mode 100644 index 00000000000..91bcf966ec5 --- /dev/null +++ b/addons/stock/tests/test_stock_scrap.py @@ -0,0 +1,107 @@ +# -*- coding: utf-8 -*- + +from odoo.tests.common import TransactionCase +from odoo.exceptions import UserError + + +class TestStockScrap(TransactionCase): + + def setUp(self): + super(TestStockScrap, self).setUp() + self.user_demo = self.env.ref('base.user_demo') + self.scrap_obj = self.env['stock.scrap'] + self.picking_obj = self.env['stock.picking'] + self.stock_loc = self.browse_ref('stock.stock_location_stock') + self.customer_loc = self.browse_ref('stock.stock_location_customers') + + # Stockable product + self.product_stockable = self.env['product.product'].create({ + 'type': 'product', + 'name': 'Stockable Product', + 'uom_id': self.env.ref('product.product_uom_unit').id, + 'uom_po_id': self.env.ref('product.product_uom_unit').id, + }) + + # Consumable product + self.product_consumable = self.env['product.product'].create({ + 'type': 'consu', + 'name': 'Consumable Product', + 'uom_id': self.env.ref('product.product_uom_unit').id, + 'uom_po_id': self.env.ref('product.product_uom_unit').id, + }) + + self._update_product_qty(self.product_stockable) + + def _update_product_qty(self, product): + product_qty = self.env['stock.change.product.qty'].create({ + 'location_id': self.stock_loc.id, + 'product_id': product.id, + 'new_quantity': 100.0, + }) + product_qty.change_product_qty() + return product_qty + + def _prepare_picking(self, product): + picking = self.picking_obj.create({ + 'name': 'picking - test', + 'location_id': self.stock_loc.id, + 'location_dest_id': self.customer_loc.id, + 'picking_type_id': self.ref('stock.picking_type_out'), + 'move_lines': [(0, 0, { + 'name': product.name, + 'product_id': product.id, + 'product_uom_qty': 20.0, + 'product_uom': product.uom_id.id, + })] + }) + return picking + + def test_stock_scrap_01(self): + """ Standalone scrap a stockable product """ + with self.assertRaises(UserError): + self.scrap_obj.create({ + 'name': 'scrap - grand test', + 'product_id': self.product_stockable.id, + 'product_uom_id': self.ref('product.product_uom_unit'), + 'scrap_qty': 120, + }) + self.assertEquals(self.product_stockable.qty_available, 100.0) + + def test_stock_scrap_02(self): + """ Scrap a stockable product from a picking """ + picking = self._prepare_picking(self.product_stockable) + scrap = self.scrap_obj.create({ + 'name': 'scrap - grand test', + 'product_id': self.product_stockable.id, + 'product_uom_id': self.ref('product.product_uom_unit'), + 'picking_id': picking.id, + 'scrap_qty': 80, + }) + self.assertEquals(scrap.state, 'done') + self.assertEquals(self.product_stockable.qty_available, 20.0) + + def test_stock_scrap_03(self): + """ Standalone scrap a consumable product """ + scrap = self.scrap_obj.create({ + 'name': 'scrap - grand test', + 'product_id': self.product_consumable.id, + 'product_uom_id': self.ref('product.product_uom_unit'), + 'scrap_qty': 100, + }) + self.assertEquals(scrap.state, 'done') + self.assertEquals(self.product_consumable.qty_available, -100.0) + with self.assertRaises(UserError): + scrap.sudo(self.user_demo).unlink() + + def test_stock_scrap_04(self): + """ Scrap a consumable product from a picking """ + picking = self._prepare_picking(self.product_consumable) + scrap = self.scrap_obj.create({ + 'name': 'scrap - grand test', + 'product_id': self.product_consumable.id, + 'product_uom_id': self.ref('product.product_uom_unit'), + 'picking_id': picking.id, + 'scrap_qty': 100, + }) + self.assertEquals(scrap.state, 'done') + self.assertEquals(self.product_consumable.qty_available, -100.0) diff --git a/addons/web/static/lib/qweb/qweb-test-widgets.xml b/addons/web/static/lib/qweb/qweb-test-widgets.xml new file mode 100644 index 00000000000..503880bcc34 --- /dev/null +++ b/addons/web/static/lib/qweb/qweb-test-widgets.xml @@ -0,0 +1,26 @@ + + + {"value": "1988-09-16"} + 1988-09-16 + + + {"value": "1988-09-16 14:00:00"} + 1988-09-16 14:00:00 + + + {"value": "1988-09-16 14:00:00"} + 09/16/1988 16:00:00 + + + {"value": "1988-09-16 14:00:00"} + 09/16/1988 + + + {"value": "1988-09-16 01:00:00"} + 09/16/1988 + + + {"value": "1988-09-16 23:00:00"} + 09/17/1988 + + diff --git a/doc/cla/corporate/eficent.md b/doc/cla/corporate/eficent.md index 284e2b7b691..70184f115c8 100644 --- a/doc/cla/corporate/eficent.md +++ b/doc/cla/corporate/eficent.md @@ -14,7 +14,6 @@ List of contributors: Aarón Henríquez ahenriquez@eficent.com https://github.com/aheficent Lois Rilo lois.rilo@eficent.com https://github.com/lreficent -Roser Garcia roser.garcia@eficent.com https://github.com/rgarnau Miquel Raich miquel.raich@eficent.com https://github.com/mreficent Jordi Ballester jordi.ballester@eficent.com https://github.com/jbeficent Hector Villarreal hector.villarreal@eficent.com https://github.com/hveficent diff --git a/doc/howtos/themes.rst b/doc/howtos/themes.rst index 5252ed5b776..f9158631282 100644 --- a/doc/howtos/themes.rst +++ b/doc/howtos/themes.rst @@ -686,7 +686,7 @@ The previous code will create the snippet’s content, but we still need to plac .. code-block:: xml