diff --git a/addons/point_of_sale/models/pos_order.py b/addons/point_of_sale/models/pos_order.py index 18c7875cb61..1474af3fe4e 100644 --- a/addons/point_of_sale/models/pos_order.py +++ b/addons/point_of_sale/models/pos_order.py @@ -592,7 +592,7 @@ class PosOrder(models.Model): }) else: - self.env['account.move.line'].with_context(skip_invoice_sync=True).create({ + self.env['account.move.line'].sudo().with_context(skip_invoice_sync=True).create({ 'balance': -rounding_applied, 'quantity': 1.0, 'partner_id': new_move.partner_id.id, @@ -984,7 +984,7 @@ class PosOrder(models.Model): def _create_order_picking(self): self.ensure_one() if self.shipping_date: - self.lines._launch_stock_rule_from_pos_order_lines() + self.sudo().lines._launch_stock_rule_from_pos_order_lines() else: if self._should_create_picking_real_time(): picking_type = self.config_id.picking_type_id diff --git a/addons/point_of_sale/security/ir.model.access.csv b/addons/point_of_sale/security/ir.model.access.csv index 9dbd50ab155..fb23776194f 100644 --- a/addons/point_of_sale/security/ir.model.access.csv +++ b/addons/point_of_sale/security/ir.model.access.csv @@ -57,3 +57,4 @@ access_pos_close_session_wizard,access.pos.close.session.wizard,model_pos_close_ access_account_cash_rounding_pos_user,account.cash.rounding pos_user,account.model_account_cash_rounding,group_pos_user,1,0,0,0 access_pos_bill,pos.bill pos_user,model_pos_bill,group_pos_user,1,1,1,1 access_pos_daily_sales_reports_wizard,access.pos.daily.sales.reports.wizard,model_pos_daily_sales_reports_wizard,group_pos_manager,1,1,1,0 +access_account_journal_entry,account.move,model_account_move,group_pos_user,1,0,0,0 diff --git a/addons/point_of_sale/security/point_of_sale_security.xml b/addons/point_of_sale/security/point_of_sale_security.xml index 1aad8ac0620..ed6bc25c22b 100644 --- a/addons/point_of_sale/security/point_of_sale_security.xml +++ b/addons/point_of_sale/security/point_of_sale_security.xml @@ -66,6 +66,12 @@ [('company_id', 'in', company_ids)] + + Invoice POS User + + + [('pos_order_ids', '!=', False)] + diff --git a/addons/point_of_sale/static/tests/tours/PaymentScreen.tour.js b/addons/point_of_sale/static/tests/tours/PaymentScreen.tour.js index ac7052a67d6..4f1f5bc3a2d 100644 --- a/addons/point_of_sale/static/tests/tours/PaymentScreen.tour.js +++ b/addons/point_of_sale/static/tests/tours/PaymentScreen.tour.js @@ -275,3 +275,21 @@ registry.category("web_tour.tours").add("PaymentScreenTotalDueWithOverPayment", PaymentScreen.totalDueIs("1.95"), ].flat(), }); + +registry.category("web_tour.tours").add("InvoiceShipLaterAccessRight", { + test: true, + url: "/pos/ui", + steps: () => + [ + ProductScreen.confirmOpeningPopup(), + ProductScreen.clickHomeCategory(), + ProductScreen.addOrderline("Whiteboard Pen", "1"), + ProductScreen.clickPartnerButton(), + ProductScreen.clickCustomer("Deco Addict"), + ProductScreen.clickPayButton(), + + PaymentScreen.clickPaymentMethod("Cash"), + PaymentScreen.clickShipLaterButton(), + PaymentScreen.clickValidate(), + ].flat(), +}); diff --git a/addons/point_of_sale/static/tests/tours/helpers/PaymentScreenTourMethods.js b/addons/point_of_sale/static/tests/tours/helpers/PaymentScreenTourMethods.js index e5ae5b147dc..3f5572a0326 100644 --- a/addons/point_of_sale/static/tests/tours/helpers/PaymentScreenTourMethods.js +++ b/addons/point_of_sale/static/tests/tours/helpers/PaymentScreenTourMethods.js @@ -264,3 +264,16 @@ export function isInvoiceButtonChecked() { } ] } + +export function clickShipLaterButton() { + return [ + { + content: 'click ship later button', + trigger: '.button:contains("Ship Later")', + }, + { + content: 'click confirm button', + trigger: '.button.confirm', + }, + ] +} diff --git a/addons/point_of_sale/tests/test_frontend.py b/addons/point_of_sale/tests/test_frontend.py index 08ba2db7a96..8c76fdcf82f 100644 --- a/addons/point_of_sale/tests/test_frontend.py +++ b/addons/point_of_sale/tests/test_frontend.py @@ -48,7 +48,6 @@ class TestPointOfSaleHttpCommon(AccountTestInvoicingHttpCommon): 'groups_id': [ (4, cls.env.ref('base.group_user').id), (4, cls.env.ref('point_of_sale.group_pos_user').id), - (4, cls.env.ref('account.group_account_invoice').id), ], }) cls.pos_admin = cls.env['res.users'].create({