mirror of
https://bitbucket.org/presik/trytonpsk-purchase_discount.git
synced 2023-12-14 05:03:01 +01:00
new version
This commit is contained in:
parent
08cffa79ae
commit
f93429db61
22
purchase.py
22
purchase.py
|
@ -12,7 +12,7 @@ from trytond.config import config as config_
|
|||
from trytond.transaction import Transaction
|
||||
|
||||
__all__ = ['PurchaseLine', 'PurchaseDiscountReport', 'Configuration',
|
||||
'PurchaseDiscountWizardStart', 'PurchaseDiscountWizard']
|
||||
'PurchaseDiscountWizardStart', 'PurchaseDiscountWizard']
|
||||
|
||||
STATES = {
|
||||
'invisible': Eval('type') != 'line',
|
||||
|
@ -22,14 +22,12 @@ DIGITS = config_.getint('product', 'price_decimal', default=4)
|
|||
DISCOUNT_DIGITS = 6
|
||||
|
||||
|
||||
class Configuration:
|
||||
__metaclass__ = PoolMeta
|
||||
class Configuration(metaclass=PoolMeta):
|
||||
__name__ = 'purchase.configuration'
|
||||
description = fields.Char('Default Description')
|
||||
|
||||
|
||||
class Purchase:
|
||||
__metaclass__ = PoolMeta
|
||||
class Purchase(metaclass=PoolMeta):
|
||||
__name__ = 'purchase.purchase'
|
||||
|
||||
@staticmethod
|
||||
|
@ -39,8 +37,7 @@ class Purchase:
|
|||
return config.description
|
||||
|
||||
|
||||
class PurchaseLine:
|
||||
__metaclass__ = PoolMeta
|
||||
class PurchaseLine(metaclass=PoolMeta):
|
||||
__name__ = 'purchase.line'
|
||||
|
||||
gross_unit_price = fields.Numeric('Gross Price', digits=(16, DIGITS),
|
||||
|
@ -51,7 +48,7 @@ class PurchaseLine:
|
|||
stock_quantity = fields.Function(fields.Float('Stock Quantity',
|
||||
digits=(16, 2), depends=['product'], states=STATES),
|
||||
'on_change_with_stock_quantity')
|
||||
product_description = fields.Text('Application')
|
||||
# product_description = fields.Text('Application')
|
||||
|
||||
@classmethod
|
||||
def __setup__(cls):
|
||||
|
@ -99,13 +96,13 @@ class PurchaseLine:
|
|||
def on_change_discount(self):
|
||||
return self.update_prices()
|
||||
|
||||
@fields.depends('unit_price', 'discount', 'stock_quantity', 'product_description')
|
||||
@fields.depends('unit_price', 'discount', 'stock_quantity')
|
||||
def on_change_product(self):
|
||||
super(PurchaseLine, self).on_change_product()
|
||||
self.gross_unit_price = self.unit_price
|
||||
self.discount = Decimal(0)
|
||||
if self.product and self.product.description:
|
||||
self.product_description = self.product.description
|
||||
# if self.product and self.product.description:
|
||||
# self.product_description = self.product.description
|
||||
if self.unit_price:
|
||||
self.update_prices()
|
||||
|
||||
|
@ -141,9 +138,6 @@ class PurchaseLine:
|
|||
for line in lines:
|
||||
line.gross_unit_price = self.gross_unit_price
|
||||
line.discount = self.discount
|
||||
# if self.product_description and self.product:
|
||||
# self.product.description = self.product_description
|
||||
# self.product.save()
|
||||
return lines
|
||||
|
||||
@classmethod
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
[tryton]
|
||||
version=5.0.0
|
||||
version=5.0.1
|
||||
depends:
|
||||
product
|
||||
purchase
|
||||
|
|
|
@ -13,7 +13,7 @@ copyright notices and license terms. -->
|
|||
</group>
|
||||
<label name="stock_quantity"/>
|
||||
<field name="stock_quantity"/>
|
||||
<separator name="product_description" colspan="4"/>
|
||||
<field name="product_description" colspan="4"/>
|
||||
<!-- <separator name="product_description" colspan="4"/>
|
||||
<field name="product_description" colspan="4"/> -->
|
||||
</xpath>
|
||||
</data>
|
||||
|
|
|
@ -8,6 +8,6 @@ copyright notices and license terms. -->
|
|||
<suffix name="discount" string="%"/>
|
||||
</field>
|
||||
<!-- <field name="stock_quantity"/>-->
|
||||
<field name="product_description"/>
|
||||
<!-- <field name="product_description"/> -->
|
||||
</xpath>
|
||||
</data>
|
||||
|
|
Loading…
Reference in a new issue