Remove currency_digits

From Add monetary field - issue10598
This commit is contained in:
Raimon Esteve 2021-08-24 10:18:10 +02:00
parent a7e092782d
commit 32e901a520
3 changed files with 2 additions and 27 deletions

View File

@ -26,9 +26,6 @@ class Carrier(metaclass=PoolMeta):
'readonly': Bool(Eval('formula_price_list', [])),
},
depends=['carrier_cost_method', 'formula_price_list'])
formula_currency_digits = fields.Function(fields.Integer(
'Formula Currency Digits'),
'on_change_with_formula_currency_digits')
formula_price_list = fields.One2Many(
'carrier.formula_price_list', 'carrier', 'Price List',
states={
@ -50,20 +47,6 @@ class Carrier(metaclass=PoolMeta):
if company:
return Company(company).currency.id
@staticmethod
def default_formula_currency_digits():
Company = Pool().get('company.company')
company = Transaction().context.get('company')
if company:
return Company(company).currency.digits
return 2
@fields.depends('formula_currency')
def on_change_with_formula_currency_digits(self, name=None):
if self.formula_currency:
return self.formula_currency.digits
return 2
@staticmethod
def round_price_formula(number, digits):
quantize = Decimal(10) ** -Decimal(digits)
@ -150,7 +133,7 @@ class Carrier(metaclass=PoolMeta):
else:
price = self.carrier_product.list_price
price = self.round_price_formula(price, self.formula_currency_digits)
price = self.round_price_formula(price, self.formula_currency.digits)
return price, currency_id
def get_purchase_price(self):
@ -190,7 +173,7 @@ class Carrier(metaclass=PoolMeta):
else:
price = self.carrier_product.list_price
price = self.round_price_formula(price, self.formula_currency_digits)
price = self.round_price_formula(price, self.formula_currency.digits)
return price, currency_id

View File

@ -10,10 +10,6 @@ msgctxt "field:carrier,formula_currency:"
msgid "Currency"
msgstr "Moneda"
msgctxt "field:carrier,formula_currency_digits:"
msgid "Formula Currency Digits"
msgstr "Dígits moneda formula"
msgctxt "field:carrier,formula_price_list:"
msgid "Price List"
msgstr "Tarifa"

View File

@ -10,10 +10,6 @@ msgctxt "field:carrier,formula_currency:"
msgid "Currency"
msgstr "Moneda"
msgctxt "field:carrier,formula_currency_digits:"
msgid "Formula Currency Digits"
msgstr "Dígitos moneda formula"
msgctxt "field:carrier,formula_price_list:"
msgid "Price List"
msgstr "Tarifa"