Browse Source

May 03: [FIX] Bug Fixed 'product_profit_report'

pull/278/merge
RisvanaCybro 12 months ago
parent
commit
c5f9c5e931
  1. 5
      product_profit_report/doc/RELEASE_NOTES.md
  2. 12
      product_profit_report/report/product_profit_report.py

5
product_profit_report/doc/RELEASE_NOTES.md

@ -4,3 +4,8 @@
#### Version 16.0.1.0.0 #### Version 16.0.1.0.0
##### ADD ##### ADD
- Initial commit for Product Profit Report - Initial commit for Product Profit Report
#### 03.05.2024
#### Version 16.0.1.0.0
##### Bug Fix
- Bug fix- Multi Currency

12
product_profit_report/report/product_profit_report.py

@ -20,7 +20,7 @@
# #
################################################################################ ################################################################################
import datetime import datetime
from odoo import api, models, _ from odoo import api, fields, models, _
from odoo.exceptions import ValidationError from odoo.exceptions import ValidationError
@ -53,6 +53,16 @@ class ProductProfitReport(models.AbstractModel):
dic_name = str(order.product_id.id) dic_name = str(order.product_id.id)
quantity = order.quantity quantity = order.quantity
price = quantity * (order.price_unit - order.discount) price = quantity * (order.price_unit - order.discount)
if order.currency_id != order.company_currency_id:
currency_rate = self.env[
'res.currency']._get_conversion_rate(
from_currency=order.currency_id,
to_currency=order.company_currency_id,
company=order.company_id,
date=order.move_id.invoice_date or order.move_id.date or fields.Date.context_today(
order))
price = order.company_currency_id.round(
price * currency_rate)
expense = order.product_id.get_history_price( expense = order.product_id.get_history_price(
order.company_id.id, order.company_id.id,
date=order.move_id.invoice_date) * quantity date=order.move_id.invoice_date) * quantity

Loading…
Cancel
Save