[FIX] point_of_sale: invoice validation

- Create a user with rights 'Billing' only
- Create an invoice, post

An `AccessError` is raised.

This is because the user has no access to the pos order.

opw-2089587

closes odoo/odoo#39333

X-original-commit: d9d1f8099067e4de4891acbd6553c34eafff20a1
Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
This commit is contained in:
Nicolas Martinelli
2019-10-24 12:02:00 +00:00
committed by fw-bot
parent 9405a1b6e3
commit 4fad947c9f
+2 -2
View File
@@ -12,9 +12,9 @@ class AccountMove(models.Model):
def _stock_account_get_last_step_stock_moves(self):
stock_moves = super(AccountMove, self)._stock_account_get_last_step_stock_moves()
for invoice in self.filtered(lambda x: x.type == 'out_invoice'):
stock_moves += invoice.mapped('pos_order_ids.picking_id.move_lines').filtered(lambda x: x.state == 'done' and x.location_dest_id.usage == 'customer')
stock_moves += invoice.sudo().mapped('pos_order_ids.picking_id.move_lines').filtered(lambda x: x.state == 'done' and x.location_dest_id.usage == 'customer')
for invoice in self.filtered(lambda x: x.type == 'out_refund'):
stock_moves += invoice.mapped('pos_order_ids.picking_id.move_lines').filtered(lambda x: x.state == 'done' and x.location_id.usage == 'customer')
stock_moves += invoice.sudo().mapped('pos_order_ids.picking_id.move_lines').filtered(lambda x: x.state == 'done' and x.location_id.usage == 'customer')
return stock_moves
class AccountMoveLine(models.Model):