Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # -*- coding: utf-8 -*-
- from trytond.model import Workflow, ModelView, ModelSQL, fields
- from trytond.pyson import Eval, Or, Bool, And, Not,Equal
- from trytond.transaction import Transaction
- from trytond.pool import Pool
- __all__ = ['ShipmentIn']
- class ShipmentIn(Workflow, ModelSQL, ModelView):
- "Supplier Shipment"
- __name__ = 'stock.shipment.in'
- is_donation = fields.Boolean('By donation',
- help='Check if the shipment is a donation')
- @classmethod
- def create(cls, vlist):
- pool = Pool()
- Sequence = pool.get('ir.sequence')
- Config = pool.get('stock.configuration')
- vlist = [x.copy() for x in vlist]
- config = Config(1)
- for values in vlist:
- if values['is_donation']:
- values['code'] = Sequence.get_id(config.shipment_in_donation_sequence)
- else:
- values['code'] = Sequence.get_id(config.shipment_in_sequence)
- shipments = super(ShipmentIn, cls).create(vlist)
- cls._set_move_planned_date(shipments)
- return shipments
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement