Skip to content

Commit

Permalink
[FIX]stock_picking_report_valued: Fix #305. Take currency field from …
Browse files Browse the repository at this point in the history
…company if not sale line related
  • Loading branch information
javierjcf committed Jun 27, 2024
1 parent a625484 commit 7c99c75
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions stock_picking_report_valued/models/stock_move_line.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ class StockMoveLine(models.Model):
sale_line = fields.Many2one(
related="move_id.sale_line_id", readonly=True, string="Related order line"
)
currency_id = fields.Many2one(
related="sale_line.currency_id", readonly=True, string="Sale Currency"
currency_id = fields.Many2one('res.currency',
compute="_compute_sale_currency_id", readonly=True, string="Sale Currency"
)
sale_tax_id = fields.Many2many(
related="sale_line.tax_id", readonly=True, string="Sale Tax"
Expand Down Expand Up @@ -44,6 +44,11 @@ class StockMoveLine(models.Model):
compute="_compute_sale_order_line_fields", string="Total", compute_sudo=True
)

def _compute_sale_currency_id(self):
for line in self:
line.currency_id = line.sale_line.currency_id.id if line.sale_line \
else line.company_id.currency_id.id

def _get_report_valued_quantity(self):
return self.qty_done or self.reserved_qty

Expand Down

0 comments on commit 7c99c75

Please sign in to comment.