17.01.26 #6
@@ -367,7 +367,21 @@ class Fee(ModelSQL,ModelView):
|
|||||||
p.currency = record.currency
|
p.currency = record.currency
|
||||||
p.line_type = 'service'
|
p.line_type = 'service'
|
||||||
Purchase.save([p])
|
Purchase.save([p])
|
||||||
|
#if reception of moves done we need to generate accrual for fee
|
||||||
|
StockMove = Pool().get('stock.move')
|
||||||
|
feelots = FeeLots.search(['fee','=',record.id])
|
||||||
|
for lot in feelots:
|
||||||
|
move = lot.get_received_move()
|
||||||
|
if move:
|
||||||
|
Warning = Pool().get('res.user.warning')
|
||||||
|
warning_name = Warning.format("Lot ever received", [])
|
||||||
|
if Warning.check(warning_name):
|
||||||
|
raise Warning(warning_name,
|
||||||
|
"By clicking yes, an accrual for this fee will be created")
|
||||||
|
AccountMove = Pool().get('account.move')
|
||||||
|
account_move = move._get_account_stock_move_fee(record.id)
|
||||||
|
AccountMove.save([account_move])
|
||||||
|
|
||||||
return records
|
return records
|
||||||
|
|
||||||
class FeeLots(ModelSQL,ModelView):
|
class FeeLots(ModelSQL,ModelView):
|
||||||
|
|||||||
@@ -578,6 +578,14 @@ class Lot(metaclass=PoolMeta):
|
|||||||
return True
|
return True
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
def get_received_move(self):
|
||||||
|
if self.lot_move:
|
||||||
|
lm = sorted(self.lot_move, key=lambda x: x.sequence, reverse=True)
|
||||||
|
for m in lm:
|
||||||
|
if m.move.from_location.type == 'supplier' and m.move.state == 'done':
|
||||||
|
return m
|
||||||
|
return None
|
||||||
|
|
||||||
def GetShipment(self,type):
|
def GetShipment(self,type):
|
||||||
if type == 'in':
|
if type == 'in':
|
||||||
m = self.get_current_supplier_move()
|
m = self.get_current_supplier_move()
|
||||||
|
|||||||
Reference in New Issue
Block a user