Fix style
This commit is contained in:
parent
2b6bb452c2
commit
dc1e5176d1
|
@ -1,6 +1,6 @@
|
||||||
#This file is part margin module for Tryton.
|
# This file is part margin module for Tryton.
|
||||||
#The COPYRIGHT file at the top level of this repository contains
|
# The COPYRIGHT file at the top level of this repository contains the full
|
||||||
#the full copyright notices and license terms.
|
# copyright notices and license terms.
|
||||||
from trytond.pool import Pool
|
from trytond.pool import Pool
|
||||||
from . import configuration
|
from . import configuration
|
||||||
from . import sale
|
from . import sale
|
||||||
|
|
|
@ -2,9 +2,7 @@
|
||||||
# The COPYRIGHT file at the top level of this repository contains
|
# The COPYRIGHT file at the top level of this repository contains
|
||||||
# the full copyright notices and license terms.
|
# the full copyright notices and license terms.
|
||||||
from trytond.model import fields
|
from trytond.model import fields
|
||||||
from trytond.pool import Pool
|
from trytond.pool import Pool, PoolMeta
|
||||||
from trytond.pyson import Eval, Bool
|
|
||||||
from trytond.pool import PoolMeta
|
|
||||||
|
|
||||||
__all__ = ['Configuration', 'ConfigurationSaleMethod']
|
__all__ = ['Configuration', 'ConfigurationSaleMethod']
|
||||||
|
|
||||||
|
@ -29,7 +27,8 @@ class Configuration:
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def default_sale_margin_method(cls, **pattern):
|
def default_sale_margin_method(cls, **pattern):
|
||||||
return cls.multivalue_model('sale_margin_method').default_sale_margin_method()
|
return cls.multivalue_model(
|
||||||
|
'sale_margin_method').default_sale_margin_method()
|
||||||
|
|
||||||
|
|
||||||
class ConfigurationSaleMethod:
|
class ConfigurationSaleMethod:
|
||||||
|
|
7
sale.py
7
sale.py
|
@ -17,8 +17,8 @@ class Sale:
|
||||||
margin = fields.Function(fields.Numeric('Margin',
|
margin = fields.Function(fields.Numeric('Margin',
|
||||||
digits=(16, Eval('currency_digits', 2),),
|
digits=(16, Eval('currency_digits', 2),),
|
||||||
depends=['currency_digits'],
|
depends=['currency_digits'],
|
||||||
help='It gives profitability by calculating the difference '
|
help=('It gives profitability by calculating the difference '
|
||||||
'between the Unit Price and Cost Price.'),
|
'between the Unit Price and Cost Price.')),
|
||||||
'get_margin')
|
'get_margin')
|
||||||
margin_cache = fields.Numeric('Margin Cache',
|
margin_cache = fields.Numeric('Margin Cache',
|
||||||
digits=(16, Eval('currency_digits', 2)),
|
digits=(16, Eval('currency_digits', 2)),
|
||||||
|
@ -184,7 +184,8 @@ class SaleLine:
|
||||||
if not price:
|
if not price:
|
||||||
return Decimal('1.0')
|
return Decimal('1.0')
|
||||||
else:
|
else:
|
||||||
return (self.margin / price).quantize(Decimal('0.0001'))
|
return (
|
||||||
|
self.margin / price).quantize(Decimal('0.0001'))
|
||||||
if line2.type == 'line':
|
if line2.type == 'line':
|
||||||
if sale_margin_method == 'unit_price':
|
if sale_margin_method == 'unit_price':
|
||||||
price += line2.get_margin_unit_price()
|
price += line2.get_margin_unit_price()
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
#This file is part sale_margin module for Tryton.
|
# This file is part sale_margin module for Tryton.
|
||||||
#The COPYRIGHT file at the top level of this repository contains
|
# The COPYRIGHT file at the top level of this repository contains the full
|
||||||
#the full copyright notices and license terms.
|
# copyright notices and license terms.
|
||||||
|
|
||||||
try:
|
try:
|
||||||
from trytond.modules.sale_margin.tests.test_sale_margin import suite
|
from trytond.modules.sale_margin.tests.test_sale_margin import suite
|
||||||
|
|
Loading…
Reference in New Issue