Round get_purchase_price according to unit_price digits
issue2094 review226007 (transplanted from 4d47bbcd5826e49339fbf0e31ec85af141671445)
This commit is contained in:
1 parent
d83b369e1f
commit
a775136ffe
1 file changed
+4
@@ -2,6 +2,7 @@
|
||||
#this repository contains the full copyright notices and license terms.
|
||||
import datetime
|
||||
import operator
|
||||
from decimal import Decimal
|
||||
from trytond.model import ModelView, ModelSQL, fields
|
||||
from trytond.wizard import Wizard
|
||||
from trytond.pyson import If, In, Eval, Get
|
||||
@@ -668,6 +669,7 @@ class CreatePurchase(Wizard):
|
||||
party_obj = pool.get('party.party')
|
||||
product_obj = pool.get('product.product')
|
||||
tax_rule_obj = pool.get('account.tax.rule')
|
||||
line_obj = pool.get('purchase.line')
|
||||
|
||||
line = {
|
||||
'product': request.product.id,
|
||||
@@ -683,6 +685,8 @@ class CreatePurchase(Wizard):
|
||||
currency=request.company.currency.id):
|
||||
product_price = product_obj.get_purchase_price(
|
||||
[request.product.id], request.quantity)[request.product.id]
|
||||
product_price = product_price.quantize(
|
||||
Decimal(1) / 10 ** line_obj.unit_price.digits[1])
|
||||
|
||||
if not product_price:
|
||||
self.raise_user_error('missing_price', (request.product.name,
|
||||
|
||||
Reference in new issue
Block a user