Browse Source

Mar 5 [UPDT] : Updated 'exchange_currency_rate'

pull/358/merge
AjmalCybro 2 months ago
parent
commit
c30f071bd1
  1. 4
      exchange_currency_rate/__manifest__.py
  2. 4
      exchange_currency_rate/doc/RELEASE_NOTES.md
  3. 106
      exchange_currency_rate/models/account_move.py
  4. 35
      exchange_currency_rate/models/purchase_order.py
  5. 34
      exchange_currency_rate/models/sale_order.py
  6. BIN
      exchange_currency_rate/static/description/assets/icons/hero.gif
  7. BIN
      exchange_currency_rate/static/description/assets/screenshots/1.png
  8. BIN
      exchange_currency_rate/static/description/assets/screenshots/2.png
  9. BIN
      exchange_currency_rate/static/description/assets/screenshots/3.png
  10. BIN
      exchange_currency_rate/static/description/assets/screenshots/4.png
  11. BIN
      exchange_currency_rate/static/description/assets/screenshots/5.png
  12. BIN
      exchange_currency_rate/static/description/assets/screenshots/6.png
  13. BIN
      exchange_currency_rate/static/description/assets/screenshots/7.png
  14. BIN
      exchange_currency_rate/static/description/assets/screenshots/8.png
  15. BIN
      exchange_currency_rate/static/description/banner.png
  16. 128
      exchange_currency_rate/static/description/index.html
  17. 10
      exchange_currency_rate/views/account_move_views.xml
  18. 11
      exchange_currency_rate/views/purchase_order_views.xml
  19. 12
      exchange_currency_rate/views/sale_order_views.xml

4
exchange_currency_rate/__manifest__.py

@ -21,7 +21,7 @@
################################################################################
{
'name': "Manual Currency Exchange Rate",
'version': '18.0.1.0.0',
'version': '18.0.1.1.0',
'category': 'Accounting',
'summary': """By using this module ,we can change the currency rate manually
in sale ,purchase and invoice. """,
@ -40,7 +40,7 @@
'views/purchase_order_views.xml',
'views/sale_order_views.xml'
],
'images': ['static/description/banner.gif'],
'images': ['static/description/banner.png'],
'license': 'AGPL-3',
'installable': True,
'auto_install': False,

4
exchange_currency_rate/doc/RELEASE_NOTES.md

@ -1,7 +1,7 @@
## Module <exchange_currency_rate>
#### 26.06.2024
#### Version 18.0.1.0.0
#### 03.03.2025
#### Version 18.0.1.1.0
#### ADD
- Initial commit for Manual Currency Exchange Rate

106
exchange_currency_rate/models/account_move.py

@ -29,23 +29,91 @@ class AccountMove(models.Model):
the exchange rate through the 'rate' field."""
_inherit = 'account.move'
is_exchange = fields.Boolean(string='Apply Manual Exchange',
help='Check this box if you want to manually '
'apply an exchange rate for this '
'transaction.')
rate = fields.Float(string='Rate', help='specify the rate',
compute='_compute_rate', readonly=False, store=True,
default=1)
@api.depends('invoice_line_ids.product_id')
is_exchange = fields.Boolean(string="Apply Manual Exchange", compute="_compute_is_exchange",
inverse="_inverse_is_exchange",
store=True, help='Check this box if you want to manually '
'apply an exchange rate for this '
'transaction.')
rate = fields.Float(string="Exchange Rate", compute="_compute_rate", inverse="_inverse_rate", store=True,
help='specify the rate')
sale_order_id = fields.Many2one('sale.order', string="Sale Order", compute="_compute_sale_order",
store=True,help="Linking corresponding Sale Order")
purchase_order_id = fields.Many2one('purchase.order', string="Purchase Order",
compute="_compute_purchase_order", store=True,help="Linking Purchase Order")
@api.constrains('company_currency_id', 'currency_id')
def _onchange_different_currency(self):
""" When the Currency is changed back to company currency, the boolean field is disabled """
if self.company_currency_id == self.currency_id:
if self.is_exchange:
self.is_exchange = False
@api.depends('line_ids.sale_line_ids.order_id')
def _compute_sale_order(self):
""" Compute Function to Update the Corresponding Sale Order """
for move in self:
sale_orders = move.line_ids.mapped('sale_line_ids.order_id')
move.sale_order_id = sale_orders and sale_orders[0] or False
@api.depends('line_ids.purchase_line_id.order_id')
def _compute_purchase_order(self):
""" Compute Function to Update the Corresponding Purchase Order """
for move in self:
purchase_orders = move.line_ids.mapped('purchase_line_id.order_id')
move.purchase_order_id = purchase_orders and purchase_orders[0] or False
@api.depends('currency_id', 'company_currency_id', 'company_id', 'invoice_date', 'rate', 'is_exchange')
def _compute_invoice_currency_rate(self):
"""Overriding the Default Compute function to include the Manual Rate Also."""
for move in self:
if move.is_invoice(include_receipts=True):
if move.currency_id:
if move.is_exchange:
rate = move.rate if move.rate else 1
move.invoice_currency_rate = rate
continue
move.invoice_currency_rate = self.env['res.currency']._get_conversion_rate(
from_currency=move.company_currency_id,
to_currency=move.currency_id,
company=move.company_id,
date=move._get_invoice_currency_rate_date(),
)
else:
move.invoice_currency_rate = 1
@api.depends('sale_order_id.is_exchange', 'purchase_order_id.is_exchange')
def _compute_is_exchange(self):
""" Compute Function to Update the Exchange Boolean based on Sale Order and Purchase Order"""
for move in self:
if move.sale_order_id:
move.is_exchange = move.sale_order_id.is_exchange
elif move.purchase_order_id:
move.is_exchange = move.purchase_order_id.is_exchange
else:
move.is_exchange = False
def _inverse_is_exchange(self):
""" Allow manual editing of is_exchange in account.move """
pass
@api.depends('sale_order_id.rate', 'purchase_order_id.rate')
def _compute_rate(self):
"""Changing the unit price of product by changing the rate."""
for rec in self:
if rec.move_type == 'out_invoice':
if len(rec.invoice_line_ids) >= 1 and rec.is_exchange:
rec.invoice_line_ids[-1].price_unit = rec.invoice_line_ids[
-1].product_id.list_price * rec.rate
elif rec.move_type == 'in_invoice':
if len(rec.invoice_line_ids) >= 1 and rec.is_exchange:
rec.invoice_line_ids[-1].price_unit = rec.invoice_line_ids[
-1].product_id.standard_price * rec.rate
""" Compute The rate based on sale order and purchase order"""
for move in self:
if move.sale_order_id:
move.rate = move.sale_order_id.rate
elif move.purchase_order_id:
move.rate = move.purchase_order_id.rate
else:
move.rate = move.env['res.currency']._get_conversion_rate(
from_currency=move.company_currency_id,
to_currency=move.currency_id,
company=move.company_id,
date=self.date,
)
def _inverse_rate(self):
""" Allow manual editing of rate in account.move """
pass

35
exchange_currency_rate/models/purchase_order.py

@ -21,7 +21,6 @@
################################################################################
from odoo import api, fields, models
class PurchaseOrder(models.Model):
"""This class extends the base 'purchase.order' model to introduce a
new field, 'is_exchange',which allows users to manually apply an exchange
@ -29,17 +28,25 @@ class PurchaseOrder(models.Model):
the exchange rate through the 'rate' field."""
_inherit = 'purchase.order'
is_exchange = fields.Boolean(string='Apply Manual Currency',
help='Check this box if you want to manually'
'apply an exchange rate for this '
'transaction.')
rate = fields.Float(string='Rate', help='specify the rate', compute='_compute_rate', readonly=False, store=True,
default=1)
company_currency_id = fields.Many2one(
string='Company Currency',
related='company_id.currency_id', readonly=True, help="To store the Company Currency")
is_exchange = fields.Boolean(string='Apply Manual Currency', help='allows users to manually apply an exchange rate')
rate = fields.Float(string='Rate', help='specify the rate', default=1)
@api.constrains('company_currency_id', 'currency_id')
def _onchange_different_currency(self):
""" When the Currency is changed back to company currency, the boolean field is disabled """
if self.company_currency_id == self.currency_id:
if self.is_exchange:
self.is_exchange = False
@api.depends('order_line.product_id')
def _compute_rate(self):
"""Changing the unit price of product by changing the rate."""
for rec in self:
if len(rec.order_line) >= 1 and rec.is_exchange:
rec.order_line[-1].price_unit = rec.order_line[
-1].product_id.standard_price * rec.rate
@api.onchange('is_exchange')
def _onchange_is_exchange(self):
""" Update Rate when is_exchange is Enabled."""
if self.is_exchange:
self.rate = self.env['res.currency']._get_conversion_rate(
from_currency=self.company_currency_id,
to_currency=self.currency_id,
company=self.company_id,
date=self.date_order)

34
exchange_currency_rate/models/sale_order.py

@ -21,7 +21,6 @@
################################################################################
from odoo import api, fields, models
class SaleOrder(models.Model):
"""This class extends the base 'sale.order' model to introduce a
new field, 'is_exchange',which allows users to manually apply an exchange
@ -29,17 +28,30 @@ class SaleOrder(models.Model):
exchange rate through the 'rate' field."""
_inherit = 'sale.order'
company_currency_id = fields.Many2one(
string='Company Currency',
related='company_id.currency_id', readonly=True,help='Store the Company Currency'
)
is_exchange = fields.Boolean(string='Apply Manual Currency',
help='Enable the boolean field to display '
'rate field')
rate = fields.Float(string='Rate', help='specify the currency rate',
compute='_compute_rate', readonly=False, store=True,
default=1)
rate = fields.Float(string='Rate', help='specify the currency rate',default=1)
@api.constrains('company_currency_id', 'currency_id')
def _onchange_different_currency(self):
""" When the Currency is changed back to company currency, the boolean field is disabled """
if self.company_currency_id == self.currency_id:
if self.is_exchange:
self.is_exchange = False
@api.depends('order_line.product_id')
def _compute_rate(self):
"""Changing the unit price of product by changing the rate."""
for rec in self:
if len(rec.order_line) >= 1 and rec.is_exchange:
rec.order_line[-1].price_unit = rec.order_line[
-1].product_id.list_price * rec.rate
@api.onchange('is_exchange')
def _onchange_is_exchange(self):
""" Update Rate when is_exchange is Enabled."""
if self.is_exchange:
self.rate = self.env['res.currency']._get_conversion_rate(
from_currency=self.company_currency_id,
to_currency=self.currency_id,
company=self.company_id,
date=self.date_order,
)

BIN
exchange_currency_rate/static/description/assets/icons/hero.gif

Binary file not shown.

Before

Width:  |  Height:  |  Size: 250 KiB

After

Width:  |  Height:  |  Size: 400 KiB

BIN
exchange_currency_rate/static/description/assets/screenshots/1.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 146 KiB

After

Width:  |  Height:  |  Size: 168 KiB

BIN
exchange_currency_rate/static/description/assets/screenshots/2.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 174 KiB

After

Width:  |  Height:  |  Size: 149 KiB

BIN
exchange_currency_rate/static/description/assets/screenshots/3.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 148 KiB

After

Width:  |  Height:  |  Size: 154 KiB

BIN
exchange_currency_rate/static/description/assets/screenshots/4.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 179 KiB

BIN
exchange_currency_rate/static/description/assets/screenshots/5.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 125 KiB

After

Width:  |  Height:  |  Size: 162 KiB

BIN
exchange_currency_rate/static/description/assets/screenshots/6.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 139 KiB

After

Width:  |  Height:  |  Size: 161 KiB

BIN
exchange_currency_rate/static/description/assets/screenshots/7.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 153 KiB

After

Width:  |  Height:  |  Size: 162 KiB

BIN
exchange_currency_rate/static/description/assets/screenshots/8.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 164 KiB

BIN
exchange_currency_rate/static/description/banner.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 94 KiB

128
exchange_currency_rate/static/description/index.html

@ -395,37 +395,6 @@ In the
<h1 style="font-weight:bold; font-size:calc(1.1rem + 1vw); line-height:120%; text-align:center; text-transform:capitalize; font-size: 40px;
font-weight: 700;">
<span style="color:#121212; font-size:calc(1.1rem + 1vw)">
Here you can find different prices for the
</span>
<span style="color: var(--primary-color); font-size:calc(1.1rem + 1vw)">same product</span>
</h1>
</div>
<div class="col-md-12 mb-4">
<p style="font-weight:400; font-size:16px; line-height:150%; text-align:center; color:var(--text-color-light)">
Above mentioned one is the actual sales price of the product. Below is
the changing price as manual currency exchange rates are provided.
</p>
</div>
<div class="col-md-12 text-center">
<div class="d-inline-block p-3 shadow-sm"
style="background-color:#fff; border-radius:10px">
<img alt="" class="img-fluid"
loading="lazy"
src="./assets/screenshots/2.png"
style="min-height: 1px;">
</div>
</div>
</div>
</div>
</div>
<div class="position-relative mb-4"
style="border-radius:10px; background-color:#f4f4f4">
<div class="p-md-5 p-3 position-relative">
<div class="row">
<div class="col-md-12">
<h1 style="font-weight:bold; font-size:calc(1.1rem + 1vw); line-height:120%; text-align:center; text-transform:capitalize; font-size: 40px;
font-weight: 700;">
<span style="color:#121212; font-size:calc(1.1rem + 1vw)">
In the
</span>
<span style="color: var(--primary-color); font-size:calc(1.1rem + 1vw)">Purchase Order</span>
@ -442,38 +411,7 @@ In the
style="background-color:#fff; border-radius:10px">
<img alt="" class="img-fluid"
loading="lazy"
src="./assets/screenshots/3.png"
style="min-height: 1px;">
</div>
</div>
</div>
</div>
</div>
<div class="position-relative mb-4"
style="border-radius:10px; background-color:#f4f4f4">
<div class="p-md-5 p-3 position-relative">
<div class="row">
<div class="col-md-12">
<h1 style="font-weight:bold; font-size:calc(1.1rem + 1vw); line-height:120%; text-align:center; text-transform:capitalize; font-size: 40px;
font-weight: 700;">
<span style="color:#121212; font-size:calc(1.1rem + 1vw)">
Here you can find different prices for the
</span>
<span style="color: var(--primary-color); font-size:calc(1.1rem + 1vw)">same product</span>
</h1>
</div>
<div class="col-md-12 mb-4">
<p style="font-weight:400; font-size:16px; line-height:150%; text-align:center; color:var(--text-color-light)">
Above mentioned one is the actual purchase cost of the product. Below is
the changing price as manual currency exchange rates are provided.
</p>
</div>
<div class="col-md-12 text-center">
<div class="d-inline-block p-3 shadow-sm"
style="background-color:#fff; border-radius:10px">
<img alt="" class="img-fluid"
loading="lazy"
src="./assets/screenshots/4.png"
src="./assets/screenshots/2.png"
style="min-height: 1px;">
</div>
</div>
@ -495,8 +433,10 @@ In the
</div>
<div class="col-md-12 mb-4">
<p style="font-weight:400; font-size:16px; line-height:150%; text-align:center; color:var(--text-color-light)">
there is a check-box to select for manual currency exchange rate. Apply
rates that you want to be exchanged.
There is a check-box to select for manual currency exchange rate, this
will be automatically updated from the Sale Order.
Here the rates can be updated again or manual exchange rate can be
disabled.
</p>
</div>
<div class="col-md-12 text-center">
@ -504,7 +444,7 @@ In the
style="background-color:#fff; border-radius:10px">
<img alt="" class="img-fluid"
loading="lazy"
src="./assets/screenshots/5.png"
src="./assets/screenshots/3.png"
style="min-height: 1px;">
</div>
</div>
@ -519,15 +459,15 @@ In the
<h1 style="font-weight:bold; font-size:calc(1.1rem + 1vw); line-height:120%; text-align:center; text-transform:capitalize; font-size: 40px;
font-weight: 700;">
<span style="color:#121212; font-size:calc(1.1rem + 1vw)">
Here you can find different prices for the
Converted Price
</span>
<span style="color: var(--primary-color); font-size:calc(1.1rem + 1vw)"> same product</span>
<!-- <span style="color: var(&#45;&#45;primary-color); font-size:calc(1.1rem + 1vw)"> same product</span>-->
</h1>
</div>
<div class="col-md-12 mb-4">
<p style="font-weight:400; font-size:16px; line-height:150%; text-align:center; color:var(--text-color-light)">
Above mentioned one is the actual sales price of the product. Below is
the changing price as manual currency exchange rates are provided.
Here you can find converted prices for the Products in the Journal Items based on the newly applied Manual Rate.
</p>
</div>
<div class="col-md-12 text-center">
@ -535,7 +475,7 @@ Here you can find different prices for the
style="background-color:#fff; border-radius:10px">
<img alt="" class="img-fluid"
loading="lazy"
src="./assets/screenshots/6.png"
src="./assets/screenshots/7.png"
style="min-height: 1px;">
</div>
</div>
@ -558,8 +498,10 @@ In the
</div>
<div class="col-md-12 mb-4">
<p style="font-weight:400; font-size:16px; line-height:150%; text-align:center; color:var(--text-color-light)">
there is a check-box to select for manual currency exchange rate. Apply
rates that you want to be exchanged.
There is a check-box to select for manual currency exchange rate, this
will be automatically updated from the Purchase Order.
Here the rates can be updated again or manual exchange rate can be
disabled.
</p>
</div>
<div class="col-md-12 text-center">
@ -567,7 +509,7 @@ In the
style="background-color:#fff; border-radius:10px">
<img alt="" class="img-fluid"
loading="lazy"
src="./assets/screenshots/7.png"
src="./assets/screenshots/5.png"
style="min-height: 1px;">
</div>
</div>
@ -582,15 +524,16 @@ In the
<h1 style="font-weight:bold; font-size:calc(1.1rem + 1vw); line-height:120%; text-align:center; text-transform:capitalize; font-size: 40px;
font-weight: 700;">
<span style="color:#121212; font-size:calc(1.1rem + 1vw)">
Here you can find different prices for the
Converted Price
</span>
<span style="color: var(--primary-color); font-size:calc(1.1rem + 1vw)">same product</span>
<!-- <span style="color: var(&#45;&#45;primary-color); font-size:calc(1.1rem + 1vw)">same product</span>-->
</h1>
</div>
<div class="col-md-12 mb-4">
<p style="font-weight:400; font-size:16px; line-height:150%; text-align:center; color:var(--text-color-light)">
Above mentioned one is the actual purchase cost of the product. Below is
the changing price as manual currency exchange rates are provided.
Here you can find converted prices for the Products in the Journal Items
based on the newly applied Manual Rate.
</p>
</div>
<div class="col-md-12 text-center">
@ -598,7 +541,7 @@ Here you can find different prices for the
style="background-color:#fff; border-radius:10px">
<img alt="" class="img-fluid"
loading="lazy"
src="./assets/screenshots/8.png"
src="./assets/screenshots/6.png"
style="min-height: 1px;">
</div>
</div>
@ -667,7 +610,8 @@ Here you can find different prices for the
style="cursor: pointer; background-color:#f8f8f8; border:none; border-top-right-radius:10px; border-top-left-radius:10px; padding: 12px 24px;">
<a class="card-title text-decoration-none"
style=" font-size:18px; line-height:30px; font-weight:500; color:#040f3a">
Can I manually set exchange rates for each sale and purchase?
Can I manually set exchange rates for each sale and
purchase?
<img alt=""
class="float-end"
src="//apps.odoocdn.com/apps/assets/16.0/index_test_odoo/assets/icons/down.svg?6ef7fd7"
@ -680,7 +624,8 @@ Here you can find different prices for the
id="collapseFAQOne"
style=" box-shadow: rgba(0, 0, 0, 0.05) 0px 6px 24px 0px; border: 1px solid #f8f8f8; border-bottom-right-radius:10px; border-bottom-left-radius:10px">
<p style=" padding:0.75rem 1.25rem; font-size:16px; line-height:27px; color:#888; font-weight:normal; border-bottom-right-radius:10px; border-bottom-left-radius:10px">
Yes, the module allows you to manually set specific exchange rates for each transaction individually.
Yes, the module allows you to manually set specific exchange
rates for each transaction individually.
</p>
</div>
</div>
@ -694,7 +639,8 @@ Here you can find different prices for the
style="cursor: pointer; background-color:#f8f8f8; border:1px solid #f8f8f8; border-top-right-radius:10px; border-top-left-radius:10px; padding: 12px 24px">
<a class="card-title text-decoration-none"
style=" font-size:18px; line-height:30px; font-weight:500; color:#040f3a">
How can I update the exchange rate for a sale or purchase order?
How can I update the exchange rate for a sale or purchase
order?
<img alt=""
class="float-end"
src="//apps.odoocdn.com/apps/assets/16.0/index_test_odoo/assets/icons/down.svg?6ef7fd7"
@ -707,7 +653,8 @@ Here you can find different prices for the
id="collapseFAQThree"
style="box-shadow: rgba(0, 0, 0, 0.05) 0px 6px 24px 0px; border: 1px solid #f8f8f8; border-bottom-right-radius:10px; border-bottom-left-radius:10px">
<p style="padding:0.75rem 1.25rem; font-size:16px; line-height:27px; color:#888; font-weight:normal; border-bottom-right-radius:10px; border-bottom-left-radius:10px">
You can update the exchange rate directly from the sale or purchase order form under the currency section.
You can update the exchange rate directly from the sale or
purchase order form under the currency section.
</p>
</div>
</div>
@ -721,7 +668,8 @@ Here you can find different prices for the
style="cursor: pointer; background-color:#f8f8f8; border:1px solid #f8f8f8; border-top-right-radius:10px; border-top-left-radius:10px; padding: 12px 24px">
<a class="card-title text-decoration-none"
style=" font-size:18px; line-height:30px; font-weight:500; color:#040f3a">
Will the manual exchange rate override the system’s automatic rates?
Will the manual exchange rate override the system’s
automatic rates?
<img alt=""
class="float-end"
src="//apps.odoocdn.com/apps/assets/16.0/index_test_odoo/assets/icons/down.svg?6ef7fd7"
@ -734,7 +682,8 @@ Here you can find different prices for the
id="collapseFAQFour"
style="box-shadow: rgba(0, 0, 0, 0.05) 0px 6px 24px 0px; border: 1px solid #f8f8f8; border-bottom-right-radius:10px; border-bottom-left-radius:10px">
<p style="padding:0.75rem 1.25rem; font-size:16px; line-height:27px; color:#888; font-weight:normal; border-bottom-right-radius:10px; border-bottom-left-radius:10px">
Yes, when you apply a manual exchange rate, it will override any automatically retrieved rates for that transaction.
Yes, when you apply a manual exchange rate, it will override
any automatically retrieved rates for that transaction.
</p>
</div>
</div>
@ -748,7 +697,8 @@ Here you can find different prices for the
style="cursor: pointer; background-color:#f8f8f8; border:1px solid #f8f8f8; border-top-right-radius:10px; border-top-left-radius:10px; padding: 12px 24px">
<a class="card-title text-decoration-none"
style=" font-size:18px; line-height:30px; font-weight:500; color:#040f3a">
Can I view or edit exchange rates after confirming the order?
Can I view or edit exchange rates after confirming the
order?
<img alt=""
class="float-end"
src="//apps.odoocdn.com/apps/assets/16.0/index_test_odoo/assets/icons/down.svg?6ef7fd7"
@ -761,7 +711,9 @@ Here you can find different prices for the
id="collapseFAQFive"
style="box-shadow: rgba(0, 0, 0, 0.05) 0px 6px 24px 0px; border: 1px solid #f8f8f8; border-bottom-right-radius:10px; border-bottom-left-radius:10px">
<p style="padding:0.75rem 1.25rem; font-size:16px; line-height:27px; color:#888; font-weight:normal; border-bottom-right-radius:10px; border-bottom-left-radius:10px">
Yes, you can view and adjust the applied exchange rate even after the order has been confirmed, as long as the transaction is still editable.
Yes, you can view and adjust the applied exchange rate even
after the order has been confirmed, as long as the
transaction is still editable.
</p>
</div>
</div>
@ -1078,7 +1030,7 @@ Here you can find different prices for the
style="background-color:#FCD12C; border-radius:50%; height:56px; width:56px">
<img src="./assets/icons/hire-odoo.svg"
class="img-responsive"
height="28px" width="28px">
height="28px" width="28px"/>
</div>
<span style="font-size: 18px;
color: var(--text-color);

10
exchange_currency_rate/views/account_move_views.xml

@ -8,10 +8,12 @@
<field name="arch" type="xml">
<xpath expr="//field[@name='payment_reference']"
position='after'>
<field name="is_exchange"/>
<field name="rate"
invisible="is_exchange == False"/>
<field name="sale_order_id" invisible="1"/>
<field name="purchase_order_id" invisible="1"/>
<field name="is_exchange" invisible="currency_id == company_currency_id" readonly="state != 'draft'"/>
<field name="rate" digits="[12,6]"
invisible="is_exchange == False" readonly="state != 'draft'"/>
</xpath>
</field>
</record>
</odoo>
</odoo>

11
exchange_currency_rate/views/purchase_order_views.xml

@ -7,10 +7,13 @@
<field name="inherit_id" ref="purchase.purchase_order_form"/>
<field name="arch" type="xml">
<xpath expr="//field[@name='date_order']" position='after'>
<field name="is_exchange"/>
<field name="rate"
invisible="is_exchange == False"/>
<field name="company_currency_id" invisible="1"/>
<field name="is_exchange" invisible="currency_id == company_currency_id"
readonly="state in ['cancel', 'done', 'purchase']"/>
<field name="rate" digits="[12,6]"
invisible="is_exchange == False or currency_id == company_currency_id"
readonly="state in ['cancel', 'done', 'purchase']"/>
</xpath>
</field>
</record>
</odoo>
</odoo>

12
exchange_currency_rate/views/sale_order_views.xml

@ -6,11 +6,13 @@
<field name="model">sale.order</field>
<field name="inherit_id" ref="sale.view_order_form"/>
<field name="arch" type="xml">
<xpath expr="//field[@name='payment_term_id']" position='after'>
<field name="is_exchange"/>
<field name="rate"
invisible="is_exchange == False"/>
</xpath>
<xpath expr="//field[@name='payment_term_id']" position='after'>
<field name="company_currency_id" invisible="1"/>
<field name="is_exchange" readonly="state in ['cancel', 'sale']"
invisible="currency_id == company_currency_id"/>
<field name="rate" digits="[12,6]" readonly="state in ['cancel', 'sale']"
invisible="is_exchange == False or currency_id == company_currency_id"/>
</xpath>
</field>
</record>
</odoo>

Loading…
Cancel
Save