Check pending drop shipment to erase party

issue7169
review40131002
This commit is contained in:
Cédric Krier
2018-03-24 00:09:55 +01:00
parent 8c9feb4ed3
commit 737b769949
3 changed files with 29 additions and 4 deletions
+1
View File
@@ -1,3 +1,4 @@
* Check pending drop shipment to erase party
* Create drop shipment depending on the shipment method
Version 4.6.0 - 2017-10-30
+3 -2
View File
@@ -5,7 +5,7 @@ from trytond.pool import Pool
from stock import *
from sale import *
from purchase import *
from .party import PartyReplace
from . import party
def register():
@@ -28,5 +28,6 @@ def register():
Pool.register(
CreatePurchase,
PurchaseHandleShipmentException,
PartyReplace,
party.PartyReplace,
party.PartyErase,
module='sale_supply_drop_shipment', type_='wizard')
+25 -2
View File
@@ -1,8 +1,8 @@
# This file is part of Tryton. The COPYRIGHT file at the top level of
# this repository contains the full copyright notices and license terms.
from trytond.pool import PoolMeta
from trytond.pool import PoolMeta, Pool
__all__ = ['PartyReplace']
__all__ = ['PartyReplace', 'PartyErase']
class PartyReplace:
@@ -17,3 +17,26 @@ class PartyReplace:
('stock.shipment.drop', 'supplier'),
('stock.shipment.drop', 'customer'),
]
class PartyErase:
__metaclass__ = PoolMeta
__name__ = 'party.erase'
def check_erase_company(self, party, company):
pool = Pool()
ShipmentDrop = pool.get('stock.shipment.drop')
super(PartyErase, self).check_erase_company(party, company)
shipments = ShipmentDrop.search([
['OR',
('supplier', '=', party.id),
('customer', '=', party.id),
],
('state', 'not in', ['done', 'cancel']),
])
if shipments:
self.raise_user_error('pending_shipment', {
'party': party.rec_name,
'company': company.rec_name,
})