[FIX] purchase: Error when updating dropship order
Steps to reproduce the issue: - change the demo user settings -> use Sales: User: All Documents only - create a stockable product with dropship feature on and a supplier - connect as the demo user - create a sales order with this product - confirm the order - as the admin user, confirm the purchase order generated through dropship - connect as the demo user - open the confirmed SO - add a line with this product - save the SO Bug: An access rights error was raised. opw:1866015
This commit is contained in:
@@ -138,8 +138,8 @@ class PurchaseOrder(models.Model):
|
||||
('invoiced', 'No Bill to Receive'),
|
||||
], string='Billing Status', compute='_get_invoiced', store=True, readonly=True, copy=False, default='no')
|
||||
|
||||
picking_count = fields.Integer(compute='_compute_picking', string='Receptions', default=0, store=True)
|
||||
picking_ids = fields.Many2many('stock.picking', compute='_compute_picking', string='Receptions', copy=False, store=True)
|
||||
picking_count = fields.Integer(compute='_compute_picking', string='Receptions', default=0, store=True, compute_sudo=True)
|
||||
picking_ids = fields.Many2many('stock.picking', compute='_compute_picking', string='Receptions', copy=False, store=True, compute_sudo=True)
|
||||
|
||||
# There is no inverse function on purpose since the date may be different on each line
|
||||
date_planned = fields.Datetime(string='Scheduled Date', compute='_compute_date_planned', store=True, index=True)
|
||||
@@ -636,7 +636,7 @@ class PurchaseOrderLine(models.Model):
|
||||
|
||||
# Replace by invoiced Qty
|
||||
qty_invoiced = fields.Float(compute='_compute_qty_invoiced', string="Billed Qty", digits=dp.get_precision('Product Unit of Measure'), store=True)
|
||||
qty_received = fields.Float(compute='_compute_qty_received', string="Received Qty", digits=dp.get_precision('Product Unit of Measure'), store=True)
|
||||
qty_received = fields.Float(compute='_compute_qty_received', string="Received Qty", digits=dp.get_precision('Product Unit of Measure'), store=True, compute_sudo=True)
|
||||
|
||||
partner_id = fields.Many2one('res.partner', related='order_id.partner_id', string='Partner', readonly=True, store=True)
|
||||
currency_id = fields.Many2one(related='order_id.currency_id', store=True, string='Currency', readonly=True)
|
||||
|
||||
@@ -8,7 +8,7 @@ from odoo.tools import float_compare
|
||||
class PurchaseOrderLine(models.Model):
|
||||
_inherit = 'purchase.order.line'
|
||||
|
||||
qty_received = fields.Float(compute='_compute_qty_received', string="Received Qty", store=True)
|
||||
qty_received = fields.Float(compute='_compute_qty_received', string="Received Qty", store=True, compute_sudo=True)
|
||||
|
||||
def _compute_qty_received(self):
|
||||
super(PurchaseOrderLine, self)._compute_qty_received()
|
||||
|
||||
Reference in New Issue
Block a user