25.03.26
This commit is contained in:
@@ -983,7 +983,7 @@ class QualityAnalysis(ModelSQL,ModelView):
|
||||
class Line(metaclass=PoolMeta):
|
||||
__name__ = 'purchase.line'
|
||||
|
||||
quantity_theorical = fields.Numeric("Th. quantity", digits='unit', readonly=True)
|
||||
quantity_theorical = fields.Numeric("Th. quantity", digits='unit', readonly=False)
|
||||
price_type = fields.Selection([
|
||||
('cash', 'Cash Price'),
|
||||
('priced', 'Priced'),
|
||||
@@ -1210,6 +1210,26 @@ class Line(metaclass=PoolMeta):
|
||||
return round(d.price_index.get_price(Date.today(),self.unit,self.purchase.currency,True),4)
|
||||
return self.unit_price
|
||||
|
||||
@classmethod
|
||||
def write(cls, *args):
|
||||
old_values = {}
|
||||
|
||||
for records, values in zip(args[::2], args[1::2]):
|
||||
if 'quantity_theorical' in values:
|
||||
for record in records:
|
||||
old_values[record.id] = record.quantity_theorical
|
||||
|
||||
super().write(*args)
|
||||
|
||||
lines = sum(args[::2], [])
|
||||
for line in lines:
|
||||
if line.id in old_values:
|
||||
old = old_values[line.id]
|
||||
new = line.quantity_theorical
|
||||
delta = Decimal(new) - Decimal(old)
|
||||
if delta > 0:
|
||||
continue
|
||||
|
||||
@classmethod
|
||||
def copy(cls, lines, default=None):
|
||||
if default is None:
|
||||
@@ -1292,16 +1312,7 @@ class Line(metaclass=PoolMeta):
|
||||
fl.lot = lot.id
|
||||
fl.line = line.id
|
||||
FeeLots.save([fl])
|
||||
|
||||
#update inherit fee qt
|
||||
# if line.fees:
|
||||
# Fee = Pool().get('fee.fee')
|
||||
# for f in line.fees:
|
||||
# if f.inherit_qt:
|
||||
# f.quantity = round(line.quantity_theorical,4)
|
||||
# f.unit = line.unit
|
||||
# Fee.save([f])
|
||||
#check if fee purchase is filled on fee
|
||||
|
||||
if line.fee_:
|
||||
if not line.fee_.purchase:
|
||||
Fee = Pool().get('fee.fee')
|
||||
|
||||
Reference in New Issue
Block a user