Skip to content

Commit

Permalink
[FIX]stock_picking_report_valued: Fix OCA#305. Take currency field fr…
Browse files Browse the repository at this point in the history
…om company if not sale line related
  • Loading branch information
javierjcf committed Jun 27, 2024
1 parent a625484 commit 6b22909
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion stock_picking_report_valued/models/stock_move_line.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,10 @@ class StockMoveLine(models.Model):
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"
comodel_name='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 +47,15 @@ class StockMoveLine(models.Model):
compute="_compute_sale_order_line_fields", string="Total", compute_sudo=True
)

@api.depends("sale_line", "company_id")
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 6b22909

Please sign in to comment.