trytond-purchase_discount/move.py

25 lines
890 B
Python
Raw Permalink Normal View History

2015-04-01 09:35:32 +02:00
# This file is part of purchase_discount module for Tryton.
# The COPYRIGHT file at the top level of this repository contains
# the full copyright notices and license terms.
from trytond.pool import PoolMeta
2015-08-11 23:41:20 +02:00
from trytond.config import config as config_
2015-04-01 09:35:32 +02:00
__all__ = ['Move']
2015-08-11 23:41:20 +02:00
DIGITS = config_.getint('product', 'price_decimal', default=4)
DISCOUNT_DIGITS = config_.getint('product', 'discount_decimal', default=4)
2015-04-01 09:35:32 +02:00
2018-08-18 23:34:13 +02:00
class Move(metaclass=PoolMeta):
2015-04-01 09:35:32 +02:00
__name__ = 'stock.move'
@classmethod
def __setup__(cls):
super(Move, cls).__setup__()
cls.unit_price.digits = (20, DIGITS + DISCOUNT_DIGITS)
# Compatibility with purchase_shipment_cost
if hasattr(cls, 'unit_shipment_cost'):
cls.unit_shipment_cost.digits = cls.unit_price.digits
if hasattr(cls, 'unit_landed_cost'):
cls.unit_landed_cost.digits = cls.unit_price.digits