mirror of
https://bitbucket.org/presik/trytonpsk-purchase_discount.git
synced 2023-12-14 05:03:01 +01:00
Remove error
This commit is contained in:
parent
42b87f4852
commit
537c42eec9
5
move.py
5
move.py
|
@ -4,14 +4,11 @@
|
||||||
from trytond.pool import PoolMeta
|
from trytond.pool import PoolMeta
|
||||||
from trytond.config import config as config_
|
from trytond.config import config as config_
|
||||||
|
|
||||||
__all__ = ['Move']
|
|
||||||
|
|
||||||
DIGITS = config_.getint('product', 'price_decimal', default=4)
|
DIGITS = config_.getint('product', 'price_decimal', default=4)
|
||||||
DISCOUNT_DIGITS = config_.getint('product', 'discount_decimal', default=4)
|
DISCOUNT_DIGITS = config_.getint('product', 'discount_decimal', default=4)
|
||||||
|
|
||||||
|
|
||||||
class Move:
|
class Move(metaclass=PoolMeta):
|
||||||
__metaclass__ = PoolMeta
|
|
||||||
__name__ = 'stock.move'
|
__name__ = 'stock.move'
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
|
|
|
@ -3,6 +3,8 @@
|
||||||
# the full copyright notices and license terms.
|
# the full copyright notices and license terms.
|
||||||
from datetime import date
|
from datetime import date
|
||||||
from decimal import Decimal
|
from decimal import Decimal
|
||||||
|
|
||||||
|
from trytond.exceptions import UserError
|
||||||
from trytond.model import ModelView, fields
|
from trytond.model import ModelView, fields
|
||||||
from trytond.wizard import Wizard, StateTransition, StateView, Button
|
from trytond.wizard import Wizard, StateTransition, StateView, Button
|
||||||
from trytond.pool import PoolMeta, Pool
|
from trytond.pool import PoolMeta, Pool
|
||||||
|
@ -14,7 +16,7 @@ from trytond.transaction import Transaction
|
||||||
STATES = {
|
STATES = {
|
||||||
'invisible': Eval('type') != 'line',
|
'invisible': Eval('type') != 'line',
|
||||||
'required': Eval('type') == 'line',
|
'required': Eval('type') == 'line',
|
||||||
}
|
}
|
||||||
DIGITS = config_.getint('product', 'price_decimal', default=4)
|
DIGITS = config_.getint('product', 'price_decimal', default=4)
|
||||||
DISCOUNT_DIGITS = 6
|
DISCOUNT_DIGITS = 6
|
||||||
|
|
||||||
|
@ -61,9 +63,6 @@ class PurchaseLine(metaclass=PoolMeta):
|
||||||
cls.amount.on_change_with.add('gross_unit_price')
|
cls.amount.on_change_with.add('gross_unit_price')
|
||||||
if 'discount' not in cls.quantity.on_change:
|
if 'discount' not in cls.quantity.on_change:
|
||||||
cls.quantity.on_change.add('discount')
|
cls.quantity.on_change.add('discount')
|
||||||
cls._error_messages.update({
|
|
||||||
'purchase_without_warehouse': ('Missing warehouse in purchase'),
|
|
||||||
})
|
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def default_discount():
|
def default_discount():
|
||||||
|
@ -118,7 +117,7 @@ class PurchaseLine(metaclass=PoolMeta):
|
||||||
def on_change_with_stock_quantity(self, name=None):
|
def on_change_with_stock_quantity(self, name=None):
|
||||||
res = 0
|
res = 0
|
||||||
if not self.purchase.warehouse:
|
if not self.purchase.warehouse:
|
||||||
self.raise_user_error('purchase_without_warehouse')
|
raise UserError('purchase_without_warehouse')
|
||||||
location_id = self.purchase.warehouse.id
|
location_id = self.purchase.warehouse.id
|
||||||
if self.product:
|
if self.product:
|
||||||
stock_context = {
|
stock_context = {
|
||||||
|
|
Loading…
Reference in a new issue