Send only the required fields when fetching a readonly view definition
issue11134 review380081002
This commit is contained in:
+6
-12
@@ -137,48 +137,42 @@ class ConfigurationSequence(ModelSQL, CompanyValueMixin):
|
||||
('company', 'in', [Eval('company', -1), None]),
|
||||
('sequence_type', '=',
|
||||
Id('stock', 'sequence_type_shipment_in')),
|
||||
],
|
||||
depends=['company'])
|
||||
])
|
||||
shipment_in_return_sequence = fields.Many2One(
|
||||
'ir.sequence', "Supplier Return Shipment Sequence", required=True,
|
||||
domain=[
|
||||
('company', 'in', [Eval('company', -1), None]),
|
||||
('sequence_type', '=',
|
||||
Id('stock', 'sequence_type_shipment_in_return')),
|
||||
],
|
||||
depends=['company'])
|
||||
])
|
||||
shipment_out_sequence = fields.Many2One(
|
||||
'ir.sequence', "Customer Shipment Sequence", required=True,
|
||||
domain=[
|
||||
('company', 'in', [Eval('company', -1), None]),
|
||||
('sequence_type', '=',
|
||||
Id('stock', 'sequence_type_shipment_out')),
|
||||
],
|
||||
depends=['company'])
|
||||
])
|
||||
shipment_out_return_sequence = fields.Many2One(
|
||||
'ir.sequence', "Customer Return Shipment Sequence", required=True,
|
||||
domain=[
|
||||
('company', 'in', [Eval('company', -1), None]),
|
||||
('sequence_type', '=',
|
||||
Id('stock', 'sequence_type_shipment_out_return')),
|
||||
],
|
||||
depends=['company'])
|
||||
])
|
||||
shipment_internal_sequence = fields.Many2One(
|
||||
'ir.sequence', "Internal Shipment Sequence", required=True,
|
||||
domain=[
|
||||
('company', 'in', [Eval('company', -1), None]),
|
||||
('sequence_type', '=',
|
||||
Id('stock', 'sequence_type_shipment_internal')),
|
||||
],
|
||||
depends=['company'])
|
||||
])
|
||||
inventory_sequence = fields.Many2One(
|
||||
'ir.sequence', "Inventory Sequence", required=True,
|
||||
domain=[
|
||||
('company', 'in', [Eval('company', -1), None]),
|
||||
('sequence_type', '=',
|
||||
Id('stock', 'sequence_type_inventory')),
|
||||
],
|
||||
depends=['company'])
|
||||
])
|
||||
|
||||
@classmethod
|
||||
def __register__(cls, module_name):
|
||||
|
||||
+6
-13
@@ -25,7 +25,6 @@ class Inventory(Workflow, ModelSQL, ModelView):
|
||||
_states = {
|
||||
'readonly': Eval('state') != 'draft',
|
||||
}
|
||||
_depends = ['state']
|
||||
|
||||
number = fields.Char('Number', readonly=True,
|
||||
help="The main identifier for the inventory.")
|
||||
@@ -34,31 +33,27 @@ class Inventory(Workflow, ModelSQL, ModelView):
|
||||
domain=[('type', '=', 'storage')], states={
|
||||
'readonly': (Eval('state') != 'draft') | Eval('lines', [0]),
|
||||
},
|
||||
depends=['state'],
|
||||
help="The location inventoried.")
|
||||
date = fields.Date('Date', required=True, states={
|
||||
'readonly': (Eval('state') != 'draft') | Eval('lines', [0]),
|
||||
},
|
||||
depends=['state'],
|
||||
help="The date of the stock count.")
|
||||
lines = fields.One2Many(
|
||||
'stock.inventory.line', 'inventory', 'Lines',
|
||||
states={
|
||||
'readonly': (_states['readonly'] | ~Eval('location')
|
||||
| ~Eval('date')),
|
||||
},
|
||||
depends=['location', 'date'] + _depends)
|
||||
})
|
||||
empty_quantity = fields.Selection([
|
||||
(None, ""),
|
||||
('keep', "Keep"),
|
||||
('empty', "Empty"),
|
||||
], "Empty Quantity", states=_states, depends=_depends,
|
||||
], "Empty Quantity", states=_states,
|
||||
help="How lines without a quantity are handled.")
|
||||
company = fields.Many2One('company.company', 'Company', required=True,
|
||||
states={
|
||||
'readonly': (Eval('state') != 'draft') | Eval('lines', [0]),
|
||||
},
|
||||
depends=['state'],
|
||||
help="The company the inventory is associated with.")
|
||||
state = fields.Selection([
|
||||
('draft', "Draft"),
|
||||
@@ -67,7 +62,7 @@ class Inventory(Workflow, ModelSQL, ModelView):
|
||||
], "State", readonly=True, select=True, sort=False,
|
||||
help="The current state of the inventory.")
|
||||
|
||||
del _states, _depends
|
||||
del _states
|
||||
|
||||
@classmethod
|
||||
def __setup__(cls):
|
||||
@@ -326,12 +321,11 @@ class InventoryLine(ModelSQL, ModelView):
|
||||
_states = {
|
||||
'readonly': Eval('inventory_state') != 'draft',
|
||||
}
|
||||
_depends = ['inventory_state']
|
||||
|
||||
product = fields.Many2One('product.product', 'Product', required=True,
|
||||
domain=[
|
||||
('type', '=', 'goods'),
|
||||
], states=_states, depends=_depends)
|
||||
], states=_states)
|
||||
uom = fields.Function(fields.Many2One('product.uom', 'UOM',
|
||||
help="The unit in which the quantity is specified."), 'get_uom')
|
||||
expected_quantity = fields.Float(
|
||||
@@ -341,7 +335,7 @@ class InventoryLine(ModelSQL, ModelView):
|
||||
},
|
||||
help="The quantity the system calculated should be in the location.")
|
||||
quantity = fields.Float(
|
||||
"Actual Quantity", digits='uom', states=_states, depends=_depends,
|
||||
"Actual Quantity", digits='uom', states=_states,
|
||||
help="The actual quantity found in the location.")
|
||||
moves = fields.One2Many('stock.move', 'origin', 'Moves', readonly=True)
|
||||
inventory = fields.Many2One('stock.inventory', 'Inventory', required=True,
|
||||
@@ -349,7 +343,6 @@ class InventoryLine(ModelSQL, ModelView):
|
||||
states={
|
||||
'readonly': _states['readonly'] & Bool(Eval('inventory')),
|
||||
},
|
||||
depends=_depends,
|
||||
help="The inventory the line belongs to.")
|
||||
inventory_location = fields.Function(
|
||||
fields.Many2One('stock.location', "Location"),
|
||||
@@ -361,7 +354,7 @@ class InventoryLine(ModelSQL, ModelView):
|
||||
searcher='search_inventory_date')
|
||||
inventory_state = fields.Function(
|
||||
fields.Selection('get_inventory_states', "Inventory State",
|
||||
depends=['inventory']),
|
||||
depends={'inventory'}),
|
||||
'on_change_with_inventory_state')
|
||||
|
||||
@classmethod
|
||||
|
||||
+3
-17
@@ -48,8 +48,7 @@ class Location(DeactivableMixin, tree(), ModelSQL, ModelView):
|
||||
'party.address', "Address",
|
||||
states={
|
||||
'invisible': Eval('type') != 'warehouse',
|
||||
},
|
||||
depends=['type'])
|
||||
})
|
||||
type = fields.Selection([
|
||||
('supplier', 'Supplier'),
|
||||
('customer', 'Customer'),
|
||||
@@ -86,7 +85,6 @@ class Location(DeactivableMixin, tree(), ModelSQL, ModelView):
|
||||
('parent', '=', None),
|
||||
],
|
||||
],
|
||||
depends=['type', 'id'],
|
||||
help="Where incoming stock is received.")
|
||||
output_location = fields.Many2One(
|
||||
"stock.location", "Output", states={
|
||||
@@ -98,7 +96,6 @@ class Location(DeactivableMixin, tree(), ModelSQL, ModelView):
|
||||
['OR',
|
||||
('parent', 'child_of', [Eval('id', -1)]),
|
||||
('parent', '=', None)]],
|
||||
depends=['type', 'id'],
|
||||
help="Where outgoing stock is sent from.")
|
||||
storage_location = fields.Many2One(
|
||||
"stock.location", "Storage", states={
|
||||
@@ -110,7 +107,6 @@ class Location(DeactivableMixin, tree(), ModelSQL, ModelView):
|
||||
['OR',
|
||||
('parent', 'child_of', [Eval('id', -1)]),
|
||||
('parent', '=', None)]],
|
||||
depends=['type', 'id'],
|
||||
help="The top level location where stock is stored.")
|
||||
picking_location = fields.Many2One(
|
||||
'stock.location', 'Picking', states={
|
||||
@@ -120,7 +116,6 @@ class Location(DeactivableMixin, tree(), ModelSQL, ModelView):
|
||||
('type', '=', 'storage'),
|
||||
('parent', 'child_of', [Eval('storage_location', -1)]),
|
||||
],
|
||||
depends=['type', 'storage_location'],
|
||||
help="Where stock is picked from.\n"
|
||||
"Leave empty to use the storage location.")
|
||||
lost_found_location = fields.Many2One(
|
||||
@@ -132,7 +127,6 @@ class Location(DeactivableMixin, tree(), ModelSQL, ModelView):
|
||||
domain=[
|
||||
('type', '=', 'lost_found'),
|
||||
],
|
||||
depends=['type', 'active'],
|
||||
help="Used, by inventories, when correcting stock levels "
|
||||
"in the warehouse.")
|
||||
waste_locations = fields.Many2Many(
|
||||
@@ -143,7 +137,6 @@ class Location(DeactivableMixin, tree(), ModelSQL, ModelView):
|
||||
domain=[
|
||||
('type', '=', 'lost_found'),
|
||||
],
|
||||
depends=['type'],
|
||||
help="The locations used for waste products from the warehouse.")
|
||||
waste_warehouses = fields.Many2Many(
|
||||
'stock.location.waste', 'location', 'warehouse', "Waste Warehouses",
|
||||
@@ -153,19 +146,16 @@ class Location(DeactivableMixin, tree(), ModelSQL, ModelView):
|
||||
domain=[
|
||||
('type', '=', 'warehouse'),
|
||||
],
|
||||
depends=['type'],
|
||||
help="The warehouses that use the location for waste products.")
|
||||
|
||||
quantity = fields.Function(
|
||||
fields.Float(
|
||||
"Quantity", digits=(16, Eval('quantity_uom_digits', 2)),
|
||||
depends=['quantity_uom_digits'],
|
||||
help="The amount of stock in the location."),
|
||||
'get_quantity', searcher='search_quantity')
|
||||
forecast_quantity = fields.Function(
|
||||
fields.Float(
|
||||
"Forecast Quantity", digits=(16, Eval('quantity_uom_digits', 2)),
|
||||
depends=['quantity_uom_digits'],
|
||||
help="The amount of stock expected to be in the location."),
|
||||
'get_quantity', searcher='search_quantity')
|
||||
quantity_uom = fields.Function(fields.Many2One(
|
||||
@@ -202,9 +192,7 @@ class Location(DeactivableMixin, tree(), ModelSQL, ModelView):
|
||||
childs_domain.append(If(Eval('type') == type_,
|
||||
('type', 'in', childs_mapping[type_]), ()))
|
||||
cls.parent.domain = parent_domain
|
||||
cls.parent.depends.append('type')
|
||||
cls.childs.domain = childs_domain
|
||||
cls.childs.depends.extend(['flat_childs', 'type'])
|
||||
|
||||
@classmethod
|
||||
def _parent_domain(cls):
|
||||
@@ -747,13 +735,11 @@ class ProductsByLocations(DeactivableMixin, ModelSQL, ModelView):
|
||||
product = fields.Many2One('product.product', "Product")
|
||||
quantity = fields.Function(
|
||||
fields.Float(
|
||||
"Quantity", digits=(16, Eval('default_uom_digits', 2)),
|
||||
depends=['default_uom_digits']),
|
||||
"Quantity", digits=(16, Eval('default_uom_digits', 2))),
|
||||
'get_product', searcher='search_product')
|
||||
forecast_quantity = fields.Function(
|
||||
fields.Float(
|
||||
"Forecast Quantity", digits=(16, Eval('default_uom_digits', 2)),
|
||||
depends=['default_uom_digits']),
|
||||
"Forecast Quantity", digits=(16, Eval('default_uom_digits', 2))),
|
||||
'get_product', searcher='search_product')
|
||||
default_uom = fields.Function(
|
||||
fields.Many2One('product.uom', "Default UOM"),
|
||||
|
||||
@@ -26,7 +26,6 @@ from .exceptions import MoveFutureWarning, MoveOriginWarning
|
||||
STATES = {
|
||||
'readonly': Eval('state').in_(['cancelled', 'assigned', 'done']),
|
||||
}
|
||||
DEPENDS = ['state']
|
||||
LOCATION_DOMAIN = [
|
||||
If(Eval('state').in_(['staging', 'draft', 'cancelled']),
|
||||
('type', 'not in', ['warehouse']),
|
||||
@@ -35,7 +34,6 @@ LOCATION_DOMAIN = [
|
||||
('active', '=', True),
|
||||
()),
|
||||
]
|
||||
LOCATION_DEPENDS = ['state']
|
||||
|
||||
|
||||
class StockMixin(object):
|
||||
@@ -183,7 +181,7 @@ class Move(Workflow, ModelSQL, ModelView):
|
||||
context={
|
||||
'company': Eval('company', -1),
|
||||
},
|
||||
depends=DEPENDS + ['company'],
|
||||
depends={'company'},
|
||||
help="The product that the move is associated with.")
|
||||
product_uom_category = fields.Function(
|
||||
fields.Many2One('product.uom.category', 'Product Uom Category'),
|
||||
@@ -198,21 +196,20 @@ class Move(Workflow, ModelSQL, ModelView):
|
||||
('category', '=', Eval('product_uom_category')),
|
||||
()),
|
||||
],
|
||||
depends=['state', 'unit_price', 'product_uom_category'],
|
||||
help="The unit in which the quantity is specified.")
|
||||
quantity = fields.Float(
|
||||
"Quantity", digits='uom', required=True,
|
||||
states=STATES, depends=DEPENDS,
|
||||
states=STATES,
|
||||
help="The amount of stock moved.")
|
||||
internal_quantity = fields.Float('Internal Quantity', readonly=True,
|
||||
required=True)
|
||||
from_location = fields.Many2One("stock.location", "From Location",
|
||||
select=True, required=True, states=STATES,
|
||||
depends=DEPENDS + LOCATION_DEPENDS, domain=LOCATION_DOMAIN,
|
||||
domain=LOCATION_DOMAIN,
|
||||
help="Where the stock is moved from.")
|
||||
to_location = fields.Many2One("stock.location", "To Location", select=True,
|
||||
required=True, states=STATES,
|
||||
depends=DEPENDS + LOCATION_DEPENDS, domain=LOCATION_DOMAIN,
|
||||
domain=LOCATION_DOMAIN,
|
||||
help="Where the stock is moved to.")
|
||||
shipment = fields.Reference('Shipment', selection='get_shipment',
|
||||
readonly=True, select=True,
|
||||
@@ -224,12 +221,11 @@ class Move(Workflow, ModelSQL, ModelView):
|
||||
states={
|
||||
'readonly': Eval('state') != 'draft',
|
||||
},
|
||||
depends=['state'],
|
||||
help="The source of the stock move.")
|
||||
planned_date = fields.Date("Planned Date", states={
|
||||
'readonly': (Eval('state').in_(['cancelled', 'assigned', 'done'])
|
||||
| Eval('shipment'))
|
||||
}, depends=['state', 'shipment'],
|
||||
},
|
||||
select=True,
|
||||
help="When the stock is expected to be moved.")
|
||||
effective_date = fields.Date("Effective Date", select=True,
|
||||
@@ -238,7 +234,6 @@ class Move(Workflow, ModelSQL, ModelView):
|
||||
'readonly': (Eval('state').in_(['cancelled', 'done'])
|
||||
| Eval('shipment')),
|
||||
},
|
||||
depends=['state', 'shipment'],
|
||||
help="When the stock was actually moved.")
|
||||
state = fields.Selection([
|
||||
('staging', 'Staging'),
|
||||
@@ -253,29 +248,25 @@ class Move(Workflow, ModelSQL, ModelView):
|
||||
states={
|
||||
'readonly': Eval('state') != 'draft',
|
||||
},
|
||||
depends=['state'],
|
||||
help="The company the stock move is associated with.")
|
||||
unit_price = fields.Numeric('Unit Price', digits=price_digits,
|
||||
states={
|
||||
'invisible': ~Eval('unit_price_required'),
|
||||
'required': Bool(Eval('unit_price_required')),
|
||||
'readonly': Eval('state') != 'draft',
|
||||
},
|
||||
depends=['unit_price_required', 'state'])
|
||||
})
|
||||
unit_price_company = fields.Function(
|
||||
fields.Numeric("Unit Price", digits=price_digits,
|
||||
states={
|
||||
'invisible': ~Eval('unit_price_required'),
|
||||
},
|
||||
depends=['unit_price_required'],
|
||||
help="Unit price in company currency."),
|
||||
'get_unit_price_company')
|
||||
unit_price_updated = fields.Boolean(
|
||||
"Unit Price Updated", readonly=True,
|
||||
states={
|
||||
'invisible': Eval('state') != 'done',
|
||||
},
|
||||
depends=['state'])
|
||||
})
|
||||
cost_price = fields.Numeric(
|
||||
"Cost Price", digits=price_digits, readonly=True,
|
||||
states={
|
||||
@@ -283,15 +274,13 @@ class Move(Workflow, ModelSQL, ModelView):
|
||||
'required': (
|
||||
(Eval('state') == 'done')
|
||||
& Eval('cost_price_required', False)),
|
||||
},
|
||||
depends=['cost_price_required'])
|
||||
})
|
||||
currency = fields.Many2One('currency.currency', 'Currency',
|
||||
states={
|
||||
'invisible': ~Eval('unit_price_required'),
|
||||
'required': Bool(Eval('unit_price_required')),
|
||||
'readonly': Eval('state') != 'draft',
|
||||
},
|
||||
depends=['unit_price_required', 'state'],
|
||||
help="The currency in which the unit price is specified.")
|
||||
unit_price_required = fields.Function(
|
||||
fields.Boolean('Unit Price Required'),
|
||||
@@ -315,7 +304,6 @@ class Move(Workflow, ModelSQL, ModelView):
|
||||
()),
|
||||
('type', 'in', cls.get_product_types()),
|
||||
]
|
||||
cls.product.depends += ['product_uom_category']
|
||||
cls._deny_modify_assigned = set(['product', 'uom', 'quantity',
|
||||
'from_location', 'to_location', 'company', 'currency'])
|
||||
cls._deny_modify_done_cancel = (cls._deny_modify_assigned
|
||||
|
||||
@@ -19,7 +19,7 @@ class Period(Workflow, ModelSQL, ModelView):
|
||||
__name__ = 'stock.period'
|
||||
date = fields.Date('Date', required=True, states={
|
||||
'readonly': Eval('state') == 'closed',
|
||||
}, depends=['state'],
|
||||
},
|
||||
help="When the stock period ends.")
|
||||
company = fields.Many2One(
|
||||
'company.company', "Company", required=True,
|
||||
|
||||
+2
-4
@@ -192,12 +192,10 @@ class Product(StockMixin, object, metaclass=PoolMeta):
|
||||
__name__ = "product.product"
|
||||
quantity = fields.Function(fields.Float(
|
||||
"Quantity", digits=(16, Eval('default_uom_digits', 2)),
|
||||
depends=['default_uom_digits'],
|
||||
help="The amount of stock in the location."),
|
||||
'get_quantity', searcher='search_quantity')
|
||||
forecast_quantity = fields.Function(fields.Float(
|
||||
"Forecast Quantity", digits=(16, Eval('default_uom_digits', 2)),
|
||||
depends=['default_uom_digits'],
|
||||
help="The amount of stock expected to be in the location."),
|
||||
'get_quantity', searcher='search_quantity')
|
||||
cost_value = fields.Function(fields.Numeric(
|
||||
@@ -1195,7 +1193,7 @@ class CostPriceRevision(ModelSQL, ModifyCostPriceStart):
|
||||
context={
|
||||
'company': Eval('company', -1),
|
||||
},
|
||||
depends=['product', 'company'])
|
||||
depends={'company'})
|
||||
product = fields.Many2One(
|
||||
'product.product', "Variant",
|
||||
ondelete='CASCADE', select=True,
|
||||
@@ -1207,7 +1205,7 @@ class CostPriceRevision(ModelSQL, ModifyCostPriceStart):
|
||||
context={
|
||||
'company': Eval('company', -1),
|
||||
},
|
||||
depends=['template', 'company'])
|
||||
depends={'company'})
|
||||
company = fields.Many2One(
|
||||
'company.company', "Company", ondelete='CASCADE', required=True)
|
||||
|
||||
|
||||
+20
-63
@@ -128,23 +128,21 @@ class ShipmentIn(ShipmentMixin, Workflow, ModelSQL, ModelView):
|
||||
states={
|
||||
'readonly': Eval('state').in_(['cancelled', 'done']),
|
||||
},
|
||||
depends=['state'],
|
||||
help="When the stock was actually received.")
|
||||
planned_date = fields.Date('Planned Date', states={
|
||||
'readonly': Eval('state') != 'draft',
|
||||
}, depends=['state'],
|
||||
},
|
||||
help="When the stock is expected to be received.")
|
||||
company = fields.Many2One(
|
||||
'company.company', "Company", required=True,
|
||||
states={
|
||||
'readonly': Eval('state') != 'draft',
|
||||
},
|
||||
depends=['state'],
|
||||
help="The company the shipment is associated with.")
|
||||
reference = fields.Char("Reference", size=None, select=True,
|
||||
states={
|
||||
'readonly': Eval('state') != 'draft',
|
||||
}, depends=['state'],
|
||||
},
|
||||
help="The supplier's identifier for the shipment.")
|
||||
supplier = fields.Many2One('party.party', 'Supplier',
|
||||
states={
|
||||
@@ -155,7 +153,7 @@ class ShipmentIn(ShipmentMixin, Workflow, ModelSQL, ModelView):
|
||||
context={
|
||||
'company': Eval('company', -1),
|
||||
},
|
||||
depends=['state', 'supplier', 'company'],
|
||||
depends={'company'},
|
||||
help="The party that supplied the stock.")
|
||||
supplier_location = fields.Function(fields.Many2One('stock.location',
|
||||
'Supplier Location'),
|
||||
@@ -164,14 +162,13 @@ class ShipmentIn(ShipmentMixin, Workflow, ModelSQL, ModelView):
|
||||
states={
|
||||
'readonly': Eval('state') != 'draft',
|
||||
}, domain=[('party', '=', Eval('supplier'))],
|
||||
depends=['state', 'supplier'],
|
||||
help="The address at which the supplier can be contacted.")
|
||||
warehouse = fields.Many2One('stock.location', "Warehouse",
|
||||
required=True, domain=[('type', '=', 'warehouse')],
|
||||
states={
|
||||
'readonly': (Eval('state').in_(['cancelled', 'done'])
|
||||
| Eval('incoming_moves', [0]) | Eval('inventory_moves', [0])),
|
||||
}, depends=['state'],
|
||||
},
|
||||
help="Where the stock is received.")
|
||||
warehouse_input = fields.Function(fields.Many2One('stock.location',
|
||||
'Warehouse Input'),
|
||||
@@ -203,8 +200,6 @@ class ShipmentIn(ShipmentMixin, Workflow, ModelSQL, ModelView):
|
||||
Eval('state').in_(['received', 'done', 'cancelled'])
|
||||
| ~Eval('warehouse') | ~Eval('supplier')),
|
||||
},
|
||||
depends=['state', 'warehouse', 'supplier_location',
|
||||
'warehouse_input', 'warehouse_storage', 'company'],
|
||||
help="The moves that bring the stock into the warehouse."),
|
||||
'get_incoming_moves', setter='set_incoming_moves')
|
||||
inventory_moves = fields.Function(fields.One2Many('stock.move', 'shipment',
|
||||
@@ -226,13 +221,10 @@ class ShipmentIn(ShipmentMixin, Workflow, ModelSQL, ModelView):
|
||||
'invisible': (
|
||||
Eval('warehouse_input') == Eval('warehouse_storage')),
|
||||
},
|
||||
depends=['state', 'warehouse', 'warehouse_input',
|
||||
'warehouse_storage', 'company'],
|
||||
help="The moves that put the stock away into the storage area."),
|
||||
'get_inventory_moves', setter='set_inventory_moves')
|
||||
moves = fields.One2Many('stock.move', 'shipment', 'Moves',
|
||||
domain=[('company', '=', Eval('company'))], readonly=True,
|
||||
depends=['company'])
|
||||
domain=[('company', '=', Eval('company'))], readonly=True)
|
||||
origins = fields.Function(fields.Char('Origins'), 'get_origins')
|
||||
number = fields.Char('Number', size=None, select=True, readonly=True,
|
||||
help="The main identifier for the shipment.")
|
||||
@@ -575,26 +567,24 @@ class ShipmentInReturn(ShipmentAssignMixin, Workflow, ModelSQL, ModelView):
|
||||
states={
|
||||
'readonly': Eval('state').in_(['cancelled', 'done']),
|
||||
},
|
||||
depends=['state'],
|
||||
help="When the stock was actually returned.")
|
||||
planned_date = fields.Date('Planned Date',
|
||||
states={
|
||||
'readonly': Eval('state') != 'draft',
|
||||
}, depends=['state'],
|
||||
},
|
||||
help="When the stock is expected to be returned.")
|
||||
company = fields.Many2One(
|
||||
'company.company', "Company", required=True,
|
||||
states={
|
||||
'readonly': Eval('state') != 'draft',
|
||||
},
|
||||
depends=['state'],
|
||||
help="The company the shipment is associated with.")
|
||||
number = fields.Char('Number', size=None, select=True, readonly=True,
|
||||
help="The main identifier for the shipment.")
|
||||
reference = fields.Char("Reference", size=None, select=True,
|
||||
states={
|
||||
'readonly': Eval('state') != 'draft',
|
||||
}, depends=['state'],
|
||||
},
|
||||
help="The supplier's identifier for the shipment.")
|
||||
supplier = fields.Many2One('party.party', 'Supplier',
|
||||
states={
|
||||
@@ -605,7 +595,7 @@ class ShipmentInReturn(ShipmentAssignMixin, Workflow, ModelSQL, ModelView):
|
||||
context={
|
||||
'company': Eval('company', -1),
|
||||
},
|
||||
depends=['state', 'supplier', 'company'],
|
||||
depends={'company'},
|
||||
help="The party that supplied the stock.")
|
||||
delivery_address = fields.Many2One('party.address', 'Delivery Address',
|
||||
states={
|
||||
@@ -614,19 +604,16 @@ class ShipmentInReturn(ShipmentAssignMixin, Workflow, ModelSQL, ModelView):
|
||||
domain=[
|
||||
('party', '=', Eval('supplier'))
|
||||
],
|
||||
depends=['state', 'supplier'],
|
||||
help="Where the stock is sent to.")
|
||||
from_location = fields.Many2One('stock.location', "From Location",
|
||||
required=True, states={
|
||||
'readonly': (Eval('state') != 'draft') | Eval('moves', [0]),
|
||||
}, domain=[('type', 'in', ['storage', 'view'])],
|
||||
depends=['state'],
|
||||
help="Where the stock is moved from.")
|
||||
to_location = fields.Many2One('stock.location', "To Location",
|
||||
required=True, states={
|
||||
'readonly': (Eval('state') != 'draft') | Eval('moves', [0]),
|
||||
}, domain=[('type', '=', 'supplier')],
|
||||
depends=['state'],
|
||||
help="Where the stock is moved to.")
|
||||
moves = fields.One2Many('stock.move', 'shipment', 'Moves',
|
||||
states={
|
||||
@@ -647,7 +634,6 @@ class ShipmentInReturn(ShipmentAssignMixin, Workflow, ModelSQL, ModelView):
|
||||
[])),
|
||||
('company', '=', Eval('company')),
|
||||
],
|
||||
depends=['state', 'from_location', 'to_location', 'company'],
|
||||
help="The moves that return the stock to the supplier.")
|
||||
origins = fields.Function(fields.Char('Origins'), 'get_origins')
|
||||
assigned_by = employee_field("Assigned By")
|
||||
@@ -941,19 +927,17 @@ class ShipmentOut(ShipmentAssignMixin, Workflow, ModelSQL, ModelView):
|
||||
states={
|
||||
'readonly': Eval('state').in_(['cancelled', 'done']),
|
||||
},
|
||||
depends=['state'],
|
||||
help="When the stock was actually sent.")
|
||||
planned_date = fields.Date('Planned Date',
|
||||
states={
|
||||
'readonly': Eval('state') != 'draft',
|
||||
}, depends=['state'],
|
||||
},
|
||||
help="When the stock is expected to be sent.")
|
||||
company = fields.Many2One(
|
||||
'company.company', "Company", required=True,
|
||||
states={
|
||||
'readonly': Eval('state') != 'draft',
|
||||
},
|
||||
depends=['state'],
|
||||
help="The company the shipment is associated with.")
|
||||
customer = fields.Many2One('party.party', 'Customer', required=True,
|
||||
states={
|
||||
@@ -963,7 +947,7 @@ class ShipmentOut(ShipmentAssignMixin, Workflow, ModelSQL, ModelView):
|
||||
context={
|
||||
'company': Eval('company', -1),
|
||||
},
|
||||
depends=['state', 'company'],
|
||||
depends={'company'},
|
||||
help="The party that purchased the stock.")
|
||||
customer_location = fields.Function(fields.Many2One('stock.location',
|
||||
'Customer Location'), 'on_change_with_customer_location')
|
||||
@@ -972,19 +956,17 @@ class ShipmentOut(ShipmentAssignMixin, Workflow, ModelSQL, ModelView):
|
||||
states={
|
||||
'readonly': Eval('state') != 'draft',
|
||||
}, domain=[('party', '=', Eval('customer'))],
|
||||
depends=['state', 'customer'],
|
||||
help="Where the stock is sent to.")
|
||||
reference = fields.Char("Reference", size=None, select=True,
|
||||
states={
|
||||
'readonly': Eval('state') != 'draft',
|
||||
}, depends=['state'],
|
||||
},
|
||||
help="The customer's identifier for the shipment.")
|
||||
warehouse = fields.Many2One('stock.location', "Warehouse", required=True,
|
||||
states={
|
||||
'readonly': ((Eval('state') != 'draft')
|
||||
| Eval('outgoing_moves', [0]) | Eval('inventory_moves', [0])),
|
||||
}, domain=[('type', '=', 'warehouse')],
|
||||
depends=['state'],
|
||||
help="Where the stock is sent from.")
|
||||
warehouse_storage = fields.Function(fields.Many2One('stock.location',
|
||||
'Warehouse Storage'), 'on_change_with_warehouse_storage')
|
||||
@@ -1006,8 +988,6 @@ class ShipmentOut(ShipmentAssignMixin, Workflow, ModelSQL, ModelView):
|
||||
))
|
||||
| ~Eval('warehouse') | ~Eval('customer')),
|
||||
},
|
||||
depends=['state', 'warehouse', 'customer', 'warehouse_output',
|
||||
'customer_location', 'company'],
|
||||
help="The moves that send the stock to the customer."),
|
||||
'get_outgoing_moves', setter='set_outgoing_moves')
|
||||
inventory_moves = fields.Function(fields.One2Many('stock.move', 'shipment',
|
||||
@@ -1026,13 +1006,10 @@ class ShipmentOut(ShipmentAssignMixin, Workflow, ModelSQL, ModelView):
|
||||
'invisible': (
|
||||
Eval('warehouse_storage') == Eval('warehouse_output')),
|
||||
},
|
||||
depends=['state', 'warehouse', 'warehouse_storage',
|
||||
'warehouse_output', 'company'],
|
||||
help="The moves that pick the stock from the storage area."),
|
||||
'get_inventory_moves', setter='set_inventory_moves')
|
||||
moves = fields.One2Many('stock.move', 'shipment', 'Moves',
|
||||
domain=[('company', '=', Eval('company'))], depends=['company'],
|
||||
readonly=True)
|
||||
domain=[('company', '=', Eval('company'))], readonly=True)
|
||||
origins = fields.Function(fields.Char('Origins'), 'get_origins')
|
||||
number = fields.Char('Number', size=None, select=True, readonly=True,
|
||||
help="The main identifier for the shipment.")
|
||||
@@ -1599,19 +1576,17 @@ class ShipmentOutReturn(ShipmentMixin, Workflow, ModelSQL, ModelView):
|
||||
states={
|
||||
'readonly': Eval('state').in_(['cancelled', 'done']),
|
||||
},
|
||||
depends=['state'],
|
||||
help="When the stock was returned.")
|
||||
planned_date = fields.Date('Planned Date',
|
||||
states={
|
||||
'readonly': Eval('state') != 'draft',
|
||||
}, depends=['state'],
|
||||
},
|
||||
help="When the stock is expected to be returned.")
|
||||
company = fields.Many2One(
|
||||
'company.company', "Company", required=True,
|
||||
states={
|
||||
'readonly': Eval('state') != 'draft',
|
||||
},
|
||||
depends=['state'],
|
||||
help="The company the shipment is associated with.")
|
||||
customer = fields.Many2One('party.party', 'Customer', required=True,
|
||||
states={
|
||||
@@ -1621,7 +1596,7 @@ class ShipmentOutReturn(ShipmentMixin, Workflow, ModelSQL, ModelView):
|
||||
context={
|
||||
'company': Eval('company', -1),
|
||||
},
|
||||
depends=['state', 'company'],
|
||||
depends={'company'},
|
||||
help="The party that purchased the stock.")
|
||||
customer_location = fields.Function(fields.Many2One('stock.location',
|
||||
'Customer Location'), 'on_change_with_customer_location')
|
||||
@@ -1630,19 +1605,17 @@ class ShipmentOutReturn(ShipmentMixin, Workflow, ModelSQL, ModelView):
|
||||
states={
|
||||
'readonly': Eval('state') != 'draft',
|
||||
}, domain=[('party', '=', Eval('customer'))],
|
||||
depends=['state', 'customer'],
|
||||
help="The address the customer can be contacted at.")
|
||||
reference = fields.Char("Reference", size=None, select=True,
|
||||
states={
|
||||
'readonly': Eval('state') != 'draft',
|
||||
}, depends=['state'],
|
||||
},
|
||||
help="The customer's identifier for the shipment.")
|
||||
warehouse = fields.Many2One('stock.location', "Warehouse", required=True,
|
||||
states={
|
||||
'readonly': ((Eval('state') != 'draft')
|
||||
| Eval('incoming_moves', [0]) | Eval('inventory_moves', [0])),
|
||||
}, domain=[('type', '=', 'warehouse')],
|
||||
depends=['state'],
|
||||
help="Where the stock is returned.")
|
||||
warehouse_storage = fields.Function(fields.Many2One('stock.location',
|
||||
'Warehouse Storage'), 'on_change_with_warehouse_storage')
|
||||
@@ -1662,8 +1635,6 @@ class ShipmentOutReturn(ShipmentMixin, Workflow, ModelSQL, ModelView):
|
||||
'readonly': ((Eval('state') != 'draft')
|
||||
| ~Eval('warehouse') | ~Eval('customer')),
|
||||
},
|
||||
depends=['state', 'warehouse', 'customer', 'customer_location',
|
||||
'warehouse_input', 'warehouse_storage', 'company'],
|
||||
help="The moves that bring the stock into the warehouse."),
|
||||
'get_incoming_moves', setter='set_incoming_moves')
|
||||
inventory_moves = fields.Function(fields.One2Many('stock.move', 'shipment',
|
||||
@@ -1685,13 +1656,10 @@ class ShipmentOutReturn(ShipmentMixin, Workflow, ModelSQL, ModelView):
|
||||
'invisible': (
|
||||
Eval('warehouse_input') == Eval('warehouse_storage')),
|
||||
},
|
||||
depends=['state', 'warehouse', 'warehouse_input',
|
||||
'warehouse_storage', 'warehouse_input', 'company'],
|
||||
help="The moves that put the stock away into the storage area."),
|
||||
'get_inventory_moves', setter='set_inventory_moves')
|
||||
moves = fields.One2Many('stock.move', 'shipment', 'Moves',
|
||||
domain=[('company', '=', Eval('company'))], depends=['company'],
|
||||
readonly=True)
|
||||
domain=[('company', '=', Eval('company'))], readonly=True)
|
||||
origins = fields.Function(fields.Char('Origins'), 'get_origins')
|
||||
number = fields.Char('Number', size=None, select=True, readonly=True,
|
||||
help="The main identifier for the shipment.")
|
||||
@@ -2023,12 +1991,11 @@ class ShipmentInternal(ShipmentAssignMixin, Workflow, ModelSQL, ModelView):
|
||||
states={
|
||||
'readonly': Eval('state').in_(['cancelled', 'done']),
|
||||
},
|
||||
depends=['state'],
|
||||
help="When the shipment was actually completed.")
|
||||
planned_date = fields.Date('Planned Date',
|
||||
states={
|
||||
'readonly': ~Eval('state').in_(['request', 'draft']),
|
||||
}, depends=['state'],
|
||||
},
|
||||
help="When the shipment is expected to be completed.")
|
||||
effective_start_date = fields.Date('Effective Start Date',
|
||||
domain=[
|
||||
@@ -2039,7 +2006,6 @@ class ShipmentInternal(ShipmentAssignMixin, Workflow, ModelSQL, ModelView):
|
||||
states={
|
||||
'readonly': Eval('state').in_(['cancelled', 'shipped', 'done']),
|
||||
},
|
||||
depends=['effective_date', 'state'],
|
||||
help="When the stock was actually sent.")
|
||||
planned_start_date = fields.Date('Planned Start Date',
|
||||
domain=[
|
||||
@@ -2051,21 +2017,19 @@ class ShipmentInternal(ShipmentAssignMixin, Workflow, ModelSQL, ModelView):
|
||||
'readonly': ~Eval('state').in_(['request', 'draft']),
|
||||
'required': Bool(Eval('planned_date')),
|
||||
},
|
||||
depends=['planned_date', 'state'],
|
||||
help="When the stock is expected to be sent.")
|
||||
company = fields.Many2One(
|
||||
'company.company', "Company", required=True,
|
||||
states={
|
||||
'readonly': ~Eval('state').in_(['request', 'draft']),
|
||||
},
|
||||
depends=['state'],
|
||||
help="The company the shipment is associated with.")
|
||||
number = fields.Char('Number', size=None, select=True, readonly=True,
|
||||
help="The main identifier for the shipment.")
|
||||
reference = fields.Char("Reference", size=None, select=True,
|
||||
states={
|
||||
'readonly': ~Eval('state').in_(['request', 'draft']),
|
||||
}, depends=['state'],
|
||||
},
|
||||
help="The external identifiers for the shipment.")
|
||||
from_location = fields.Many2One('stock.location', "From Location",
|
||||
required=True, states={
|
||||
@@ -2074,7 +2038,7 @@ class ShipmentInternal(ShipmentAssignMixin, Workflow, ModelSQL, ModelView):
|
||||
},
|
||||
domain=[
|
||||
('type', 'in', ['view', 'storage', 'lost_found']),
|
||||
], depends=['state'],
|
||||
],
|
||||
help="Where the stock is moved from.")
|
||||
to_location = fields.Many2One('stock.location', "To Location",
|
||||
required=True, states={
|
||||
@@ -2082,7 +2046,7 @@ class ShipmentInternal(ShipmentAssignMixin, Workflow, ModelSQL, ModelView):
|
||||
| Eval('moves', [0])),
|
||||
}, domain=[
|
||||
('type', 'in', ['view', 'storage', 'lost_found']),
|
||||
], depends=['state'],
|
||||
],
|
||||
help="Where the stock is moved to.")
|
||||
transit_location = fields.Function(fields.Many2One('stock.location',
|
||||
'Transit Location',
|
||||
@@ -2130,8 +2094,6 @@ class ShipmentInternal(ShipmentAssignMixin, Workflow, ModelSQL, ModelView):
|
||||
[])),
|
||||
('company', '=', Eval('company')),
|
||||
],
|
||||
depends=['state', 'from_location', 'to_location', 'transit_location',
|
||||
'company'],
|
||||
help="The moves that perform the shipment.")
|
||||
outgoing_moves = fields.Function(fields.One2Many('stock.move', 'shipment',
|
||||
'Outgoing Moves',
|
||||
@@ -2152,8 +2114,6 @@ class ShipmentInternal(ShipmentAssignMixin, Workflow, ModelSQL, ModelView):
|
||||
'invisible': (~Eval('transit_location')
|
||||
| Eval('state').in_(['request', 'draft'])),
|
||||
},
|
||||
depends=['from_location', 'to_location', 'transit_location',
|
||||
'state'],
|
||||
help="The moves that send the stock out."),
|
||||
'get_outgoing_moves', setter='set_moves')
|
||||
incoming_moves = fields.Function(fields.One2Many('stock.move', 'shipment',
|
||||
@@ -2174,8 +2134,6 @@ class ShipmentInternal(ShipmentAssignMixin, Workflow, ModelSQL, ModelView):
|
||||
'invisible': (~Eval('transit_location')
|
||||
| Eval('state').in_(['request', 'draft'])),
|
||||
},
|
||||
depends=['from_location', 'to_location', 'transit_location',
|
||||
'state'],
|
||||
help="The moves that receive the stock in."),
|
||||
'get_incoming_moves', setter='set_moves')
|
||||
assigned_by = employee_field("Received By")
|
||||
@@ -2302,7 +2260,6 @@ class ShipmentInternal(ShipmentAssignMixin, Workflow, ModelSQL, ModelView):
|
||||
def default_company():
|
||||
return Transaction().context.get('company')
|
||||
|
||||
@fields.depends('planned_date', 'planned_start_date', 'company')
|
||||
def on_change_with_transit_location(self, name=None):
|
||||
pool = Pool()
|
||||
Config = pool.get('stock.configuration')
|
||||
|
||||
@@ -282,15 +282,13 @@ class Context(ModelView):
|
||||
If(Eval('to_date') & Eval('from_date'),
|
||||
('from_date', '<=', Eval('to_date')),
|
||||
()),
|
||||
],
|
||||
depends=['to_date'])
|
||||
])
|
||||
to_date = fields.Date("To Date",
|
||||
domain=[
|
||||
If(Eval('from_date') & Eval('to_date'),
|
||||
('to_date', '>=', Eval('from_date')),
|
||||
()),
|
||||
],
|
||||
depends=['from_date'])
|
||||
])
|
||||
period = fields.Selection([
|
||||
('year', "Year"),
|
||||
('month', "Month"),
|
||||
@@ -362,7 +360,7 @@ class ProductMixin:
|
||||
context={
|
||||
'company': Eval('company', -1),
|
||||
},
|
||||
depends=['company'])
|
||||
depends={'company'})
|
||||
internal_quantity = fields.Float("Internal Quantity")
|
||||
quantity = fields.Function(fields.Float(
|
||||
"Quantity", digits='unit'), 'get_quantity')
|
||||
|
||||
Reference in New Issue
Block a user