mirror of
https://github.com/NaN-tic/trytond-stock_origin_sale.git
synced 2023-12-14 03:23:05 +01:00
Added sales as origin for ShipmentOutReturn
This commit is contained in:
parent
89894439ef
commit
823293d355
|
@ -8,4 +8,5 @@ from .shipment import *
|
|||
def register():
|
||||
Pool.register(
|
||||
ShipmentOut,
|
||||
ShipmentOutReturn,
|
||||
module='stock_origin_sale', type_='model')
|
||||
|
|
21
shipment.py
21
shipment.py
|
@ -4,7 +4,7 @@
|
|||
from trytond.model import fields
|
||||
from trytond.pool import Pool, PoolMeta
|
||||
|
||||
__all__ = ['ShipmentOut']
|
||||
__all__ = ['ShipmentOut', 'ShipmentOutReturn']
|
||||
__metaclass__ = PoolMeta
|
||||
|
||||
|
||||
|
@ -25,3 +25,22 @@ class ShipmentOut:
|
|||
@classmethod
|
||||
def _get_origin(cls):
|
||||
return super(ShipmentOut, cls)._get_origin() + ['sale.sale']
|
||||
|
||||
|
||||
class ShipmentOutReturn:
|
||||
__name__ = 'stock.shipment.out.return'
|
||||
|
||||
@classmethod
|
||||
def get_origin_value(cls, shipments, name):
|
||||
SaleLine = Pool().get('sale.line')
|
||||
origin = super(ShipmentOutReturn, cls).get_origin_value(shipments, name)
|
||||
for shipment in shipments:
|
||||
for m in shipment.incoming_moves:
|
||||
if m.origin and isinstance(m.origin, SaleLine):
|
||||
origin[shipment.id] = 'sale.sale,%s' % (m.origin.sale.id)
|
||||
break
|
||||
return origin
|
||||
|
||||
@classmethod
|
||||
def _get_origin(cls):
|
||||
return super(ShipmentOutReturn, cls)._get_origin() + ['sale.sale']
|
||||
|
|
Loading…
Reference in a new issue