Skip to content

Commit

Permalink
[REF] stock_account, mrp_account: valuation layer and not admin user
Browse files Browse the repository at this point in the history
missing bit from rev[0] and [1]

[0] 7ef11e3
[1] d6c8c34

closes odoo#42563

Signed-off-by: Simon Lejeune (sle) <[email protected]>
  • Loading branch information
sle-odoo committed Jan 2, 2020
1 parent 7f11416 commit 5096e72
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion addons/mrp_account/models/mrp_production.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ def _cal_price(self, consumed_moves):
if finished_move.product_id.cost_method in ('fifo', 'average'):
qty_done = finished_move.product_uom._compute_quantity(finished_move.quantity_done, finished_move.product_id.uom_id)
extra_cost = self.extra_cost * qty_done
finished_move.price_unit = (sum([-m.stock_valuation_layer_ids.value for m in consumed_moves]) + work_center_cost + extra_cost) / qty_done
finished_move.price_unit = (sum([-m.stock_valuation_layer_ids.value for m in consumed_moves.sudo()]) + work_center_cost + extra_cost) / qty_done
return True

def _prepare_wc_analytic_line(self, wc_line):
Expand Down
2 changes: 1 addition & 1 deletion addons/stock_account/models/product.py
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ def _run_fifo(self, quantity, company):

# Find back incoming stock valuation layers (called candidates here) to value `quantity`.
qty_to_take_on_candidates = quantity
candidates = self.env['stock.valuation.layer'].search([
candidates = self.env['stock.valuation.layer'].sudo().search([
('product_id', '=', self.id),
('remaining_qty', '>', 0),
('company_id', '=', company.id),
Expand Down

0 comments on commit 5096e72

Please sign in to comment.