mirror of
https://github.com/NaN-tic/trytond-stock_external_reception.git
synced 2023-12-14 03:43:03 +01:00
Remove duplicated method and little view improvement
This commit is contained in:
parent
4d0af8666f
commit
2b521cde88
|
@ -1,2 +1,6 @@
|
|||
Version 3.4.1 - 2015-01-19
|
||||
* Little usability improvement in reception line form
|
||||
* Remove duplicated method
|
||||
|
||||
Version 3.4.0 - 2014-11-03
|
||||
* Initial release
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
Copyright (C) 2014 NaN·tic
|
||||
Copyright (C) 2014-15 NaN·tic
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
|
48
shipment.py
48
shipment.py
|
@ -152,6 +152,19 @@ class ExternalReception(Workflow, ModelSQL, ModelView):
|
|||
Shipment.assign_force(shipments)
|
||||
Shipment.done(shipments)
|
||||
|
||||
def _get_shipment(self):
|
||||
'Return the shipment to be generated by the external reception'
|
||||
pool = Pool()
|
||||
Shipment = pool.get('stock.shipment.external')
|
||||
shipment = Shipment()
|
||||
shipment.company = self.company
|
||||
shipment.effective_date = self.effective_date
|
||||
shipment.party = self.party
|
||||
shipment.reference = self.rec_name
|
||||
shipment.from_location = self.party.customer_location
|
||||
shipment.to_location = self.warehouse.storage_location
|
||||
return shipment
|
||||
|
||||
@classmethod
|
||||
def create(cls, vlist):
|
||||
pool = Pool()
|
||||
|
@ -166,18 +179,15 @@ class ExternalReception(Workflow, ModelSQL, ModelView):
|
|||
shipments = super(ExternalReception, cls).create(vlist)
|
||||
return shipments
|
||||
|
||||
def _get_shipment(self):
|
||||
'Return the shipment to be generated by the external reception'
|
||||
pool = Pool()
|
||||
Shipment = pool.get('stock.shipment.external')
|
||||
shipment = Shipment()
|
||||
shipment.company = self.company
|
||||
shipment.effective_date = self.effective_date
|
||||
shipment.party = self.party
|
||||
shipment.reference = self.rec_name
|
||||
shipment.from_location = self.party.customer_location
|
||||
shipment.to_location = self.warehouse.storage_location
|
||||
return shipment
|
||||
@classmethod
|
||||
def copy(cls, receptions, default=None):
|
||||
if default is None:
|
||||
default = {}
|
||||
else:
|
||||
default = default.copy()
|
||||
default['shipments'] = None
|
||||
return super(ExternalReception, cls).copy(receptions, default=default)
|
||||
|
||||
|
||||
|
||||
class ExternalReceptionLine(ModelSQL, ModelView):
|
||||
|
@ -209,20 +219,6 @@ class ExternalReceptionLine(ModelSQL, ModelView):
|
|||
'on_change_with_unit_digits')
|
||||
notes = fields.Text('Notes')
|
||||
|
||||
@fields.depends('product', 'unit')
|
||||
def on_change_product(self):
|
||||
res = {}
|
||||
if not self.product:
|
||||
return res
|
||||
|
||||
category = self.product.default_uom.category
|
||||
if not self.unit or self.unit not in category.uoms:
|
||||
res['unit'] = self.product.default_uom.id
|
||||
self.unit = self.product.default_uom
|
||||
res['unit.rec_name'] = self.product.default_uom.rec_name
|
||||
res['unit_digits'] = self.product.default_uom.digits
|
||||
return res
|
||||
|
||||
@fields.depends('product', 'unit')
|
||||
def on_change_product(self):
|
||||
res = {}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
[tryton]
|
||||
version=3.4.0
|
||||
version=3.4.1
|
||||
depends:
|
||||
stock_external
|
||||
xml:
|
||||
|
|
|
@ -8,10 +8,10 @@
|
|||
<field name="description" colspan="4"/>
|
||||
<label name="quantity"/>
|
||||
<field name="quantity"/>
|
||||
<label name="unit"/>
|
||||
<field name="unit"/>
|
||||
<separator name="notes" colspan="4"/>
|
||||
<field name="notes" colspan="4"/>
|
||||
<label name="product"/>
|
||||
<field name="product"/>
|
||||
<label name="unit"/>
|
||||
<field name="unit"/>
|
||||
</form>
|
||||
|
|
Loading…
Reference in a new issue