issue9146.diff - [account_stock_landed_cost] Use field digits on secondary unit
This commit is contained in:
parent
a7bee98726
commit
a21593b903
|
@ -0,0 +1,45 @@
|
||||||
|
diff --git a/trytond/trytond/modules/account_stock_landed_cost/account.py b/trytond/trytond/modules/account_stock_landed_cost/account.py
|
||||||
|
index 3815326..93478b1 100644
|
||||||
|
--- a/trytond/trytond/modules/account_stock_landed_cost/account.py
|
||||||
|
+++ b/trytond/trytond/modules/account_stock_landed_cost/account.py
|
||||||
|
@@ -10,11 +10,18 @@ from trytond.transaction import Transaction
|
||||||
|
from trytond import backend
|
||||||
|
from trytond.tools.multivalue import migrate_property
|
||||||
|
from trytond.modules.company.model import CompanyValueMixin
|
||||||
|
+from trytond.modules.product import price_digits
|
||||||
|
|
||||||
|
__all__ = ['Configuration', 'ConfigurationLandedCostSequence',
|
||||||
|
'LandedCost', 'LandedCost_Shipment', 'InvoiceLine']
|
||||||
|
|
||||||
|
|
||||||
|
+def round_price(value, rounding=None):
|
||||||
|
+ "Round price using the price digits"
|
||||||
|
+ return value.quantize(
|
||||||
|
+ Decimal(1) / 10 ** price_digits[1], rounding=rounding)
|
||||||
|
+
|
||||||
|
+
|
||||||
|
class Configuration(metaclass=PoolMeta):
|
||||||
|
__name__ = 'account.configuration'
|
||||||
|
landed_cost_sequence = fields.MultiValue(fields.Many2One(
|
||||||
|
@@ -244,8 +251,8 @@ class LandedCost(Workflow, ModelSQL, ModelView):
|
||||||
|
for move in moves:
|
||||||
|
quantity = Decimal(str(move.quantity))
|
||||||
|
move_cost = cost * factors[move.id]
|
||||||
|
- unit_landed_cost = (move_cost / quantity).quantize(exp,
|
||||||
|
- rounding=ROUND_DOWN)
|
||||||
|
+ unit_landed_cost = round_price(
|
||||||
|
+ move_cost / quantity, rounding=ROUND_DOWN)
|
||||||
|
costs.append({
|
||||||
|
'unit_landed_cost': unit_landed_cost,
|
||||||
|
'difference': move_cost - (unit_landed_cost * quantity),
|
||||||
|
@@ -267,8 +274,8 @@ class LandedCost(Workflow, ModelSQL, ModelView):
|
||||||
|
unit_landed_cost = Currency.compute(
|
||||||
|
currency, cost['unit_landed_cost'],
|
||||||
|
move.currency, round=False)
|
||||||
|
- unit_landed_cost = unit_landed_cost.quantize(
|
||||||
|
- exp, rounding=ROUND_HALF_EVEN)
|
||||||
|
+ unit_landed_cost = round_price(
|
||||||
|
+ unit_landed_cost, rounding=ROUND_HALF_EVEN)
|
||||||
|
if move.unit_landed_cost is None:
|
||||||
|
move.unit_landed_cost = 0
|
||||||
|
move.unit_price += unit_landed_cost
|
1
series
1
series
|
@ -95,3 +95,4 @@ account_asset_update_asset.diff # [account_asset] convert float to decimal [#044
|
||||||
issue10382.diff # [stock_split] Decimals of quantity move exceed the total digits when split move
|
issue10382.diff # [stock_split] Decimals of quantity move exceed the total digits when split move
|
||||||
|
|
||||||
issue10338.diff # [bank] Search on rec_name of other model in search_rec_name
|
issue10338.diff # [bank] Search on rec_name of other model in search_rec_name
|
||||||
|
issue9146.diff # [account_stock_landed_cost] Use field digits on secondary unit
|
||||||
|
|
Loading…
Reference in New Issue