parent
cb62684d92
commit
f0469b75a6
11
load.py
11
load.py
|
@ -10,8 +10,6 @@ from trytond.pyson import Eval, Bool, Not
|
|||
from trytond.transaction import Transaction
|
||||
from trytond.wizard import Wizard, StateTransition, StateView, Button
|
||||
|
||||
__metaclass__ = PoolMeta
|
||||
|
||||
__all__ = ['Configuration', 'Load', 'LoadOrder', 'LoadOrderLine',
|
||||
'LoadUnitLoad', 'LoadUnitLoadOrder', 'LoadUnitLoadData',
|
||||
'LoadSheet', 'CMR', 'RoadTransportNote', 'EditLoadOrderLine',
|
||||
|
@ -20,6 +18,7 @@ __all__ = ['Configuration', 'Load', 'LoadOrder', 'LoadOrderLine',
|
|||
|
||||
class Configuration:
|
||||
__name__ = 'carrier.configuration'
|
||||
__metaclass__ = PoolMeta
|
||||
|
||||
ul_origin_restrict = fields.Boolean('Restrict UL origin',
|
||||
help='Restricts origin of UL when loading in a Load order.')
|
||||
|
@ -31,6 +30,7 @@ class Configuration:
|
|||
|
||||
class Load:
|
||||
__name__ = 'carrier.load'
|
||||
__metaclass__ = PoolMeta
|
||||
|
||||
unit_loads = fields.Function(
|
||||
fields.One2Many('stock.unit_load', None, 'Unit loads'),
|
||||
|
@ -48,6 +48,7 @@ class Load:
|
|||
|
||||
class LoadOrder:
|
||||
__name__ = 'carrier.load.order'
|
||||
__metaclass__ = PoolMeta
|
||||
|
||||
unit_loads = fields.Function(
|
||||
fields.One2Many('stock.unit_load', None, 'Unit loads',
|
||||
|
@ -388,6 +389,7 @@ class LoadOrder:
|
|||
|
||||
class LoadOrderLine:
|
||||
__name__ = 'carrier.load.order.line'
|
||||
__metaclass__ = PoolMeta
|
||||
|
||||
ul_quantity = fields.Float('ULs', digits=(16, 0),
|
||||
domain=[('ul_quantity', '>=', Eval('loaded_uls'))],
|
||||
|
@ -404,7 +406,7 @@ class LoadOrderLine:
|
|||
@fields.depends('quantity', 'ul_quantity', 'uom')
|
||||
def on_change_with_quantity_per_ul(self, name=None):
|
||||
if self.quantity and self.ul_quantity:
|
||||
return self.uom.round(self.quantity / self.ul_quantity, self.uom.rounding)
|
||||
return self.uom.round(self.quantity / self.ul_quantity)
|
||||
return None
|
||||
|
||||
@classmethod
|
||||
|
@ -557,6 +559,7 @@ class LoadUnitLoad(Wizard):
|
|||
|
||||
class LoadSheet:
|
||||
__name__ = 'carrier.load.sheet'
|
||||
__metaclass__ = PoolMeta
|
||||
|
||||
@classmethod
|
||||
def get_context(cls, records, data):
|
||||
|
@ -582,6 +585,7 @@ class LoadSheet:
|
|||
|
||||
class CMR:
|
||||
__name__ = 'carrier.load.order.cmr'
|
||||
__metaclass__ = PoolMeta
|
||||
|
||||
@classmethod
|
||||
def _get_products(cls, order):
|
||||
|
@ -608,6 +612,7 @@ class CMR:
|
|||
|
||||
class RoadTransportNote:
|
||||
__name__ = 'carrier.load.order.road_note'
|
||||
__metaclass__ = PoolMeta
|
||||
|
||||
@classmethod
|
||||
def _get_products(cls, order):
|
||||
|
|
4
load.xml
4
load.xml
|
@ -15,14 +15,12 @@ this repository contains the full copyright notices and license terms. -->
|
|||
<!-- Configuration -->
|
||||
<record model="ir.ui.view" id="carrier_configuration_view_form">
|
||||
<field name="model">carrier.configuration</field>
|
||||
<field name="type">form</field>
|
||||
<field name="name">configuration_form</field>
|
||||
<field name="inherit" ref="carrier_configuration.configuration_view_form"/>
|
||||
</record>
|
||||
<!-- Order -->
|
||||
<record model="ir.ui.view" id="load_order_view_form">
|
||||
<field name="model">carrier.load.order</field>
|
||||
<field name="type">form</field>
|
||||
<field name="name">load_order_form</field>
|
||||
<field name="inherit" ref="carrier_load.load_order_view_form"/>
|
||||
</record>
|
||||
|
@ -37,13 +35,11 @@ this repository contains the full copyright notices and license terms. -->
|
|||
<!-- Order line -->
|
||||
<record model="ir.ui.view" id="load_order_line_view_form">
|
||||
<field name="model">carrier.load.order.line</field>
|
||||
<field name="type">form</field>
|
||||
<field name="name">load_order_line_form</field>
|
||||
<field name="inherit" ref="carrier_load.load_order_line_view_form"/>
|
||||
</record>
|
||||
<record model="ir.ui.view" id="load_order_line_view_tree">
|
||||
<field name="model">carrier.load.order.line</field>
|
||||
<field name="type">tree</field>
|
||||
<field name="name">load_order_line_list</field>
|
||||
<field name="inherit" ref="carrier_load.load_order_line_view_tree"/>
|
||||
</record>
|
||||
|
|
|
@ -25,12 +25,12 @@ Create database::
|
|||
|
||||
Install agro Module::
|
||||
|
||||
>>> Module = Model.get('ir.module.module')
|
||||
>>> Module = Model.get('ir.module')
|
||||
>>> module, = Module.find([('name', '=', 'carrier_load_ul')])
|
||||
>>> module.click('install')
|
||||
>>> module, = Module.find([('name', '=', 'stock_move_done2cancel')])
|
||||
>>> module.click('install')
|
||||
>>> Wizard('ir.module.module.install_upgrade').execute('upgrade')
|
||||
>>> Wizard('ir.module.install_upgrade').execute('upgrade')
|
||||
|
||||
Create company::
|
||||
|
||||
|
@ -195,7 +195,7 @@ Add other products to unit load::
|
|||
>>> product = Product()
|
||||
>>> template = ProductTemplate()
|
||||
>>> template.name = 'Plastic Case 30x30'
|
||||
>>> template.category = category
|
||||
>>> template.categories.append(category)
|
||||
>>> template.default_uom = unit
|
||||
>>> template.type = 'goods'
|
||||
>>> template.salable = True
|
||||
|
@ -355,7 +355,7 @@ Check sale::
|
|||
True
|
||||
>>> order.sale.state
|
||||
u'quotation'
|
||||
>>> order.sale.reference != None
|
||||
>>> order.sale.number != None
|
||||
True
|
||||
>>> len(order.sale.lines)
|
||||
1
|
||||
|
|
|
@ -25,10 +25,10 @@ Create database::
|
|||
|
||||
Install agro Module::
|
||||
|
||||
>>> Module = Model.get('ir.module.module')
|
||||
>>> Module = Model.get('ir.module')
|
||||
>>> module, = Module.find([('name', '=', 'carrier_load_ul')])
|
||||
>>> module.click('install')
|
||||
>>> Wizard('ir.module.module.install_upgrade').execute('upgrade')
|
||||
>>> Wizard('ir.module.install_upgrade').execute('upgrade')
|
||||
|
||||
Create company::
|
||||
|
||||
|
@ -193,7 +193,7 @@ Add other products to unit load::
|
|||
>>> product = Product()
|
||||
>>> template = ProductTemplate()
|
||||
>>> template.name = 'Plastic Case 30x30'
|
||||
>>> template.category = category
|
||||
>>> template.categories.append(category)
|
||||
>>> template.default_uom = unit
|
||||
>>> template.type = 'goods'
|
||||
>>> template.salable = True
|
||||
|
@ -353,7 +353,7 @@ Check sale::
|
|||
True
|
||||
>>> order.sale.state
|
||||
u'quotation'
|
||||
>>> order.sale.reference != None
|
||||
>>> order.sale.number != None
|
||||
True
|
||||
>>> len(order.sale.lines)
|
||||
1
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
[tryton]
|
||||
version=3.6.1
|
||||
version=4.0.3
|
||||
depends:
|
||||
carrier_load
|
||||
ir
|
||||
|
|
|
@ -5,13 +5,12 @@ from trytond.pool import PoolMeta, Pool
|
|||
from trytond.pyson import Eval, Bool
|
||||
from trytond.transaction import Transaction
|
||||
|
||||
__metaclass__ = PoolMeta
|
||||
|
||||
__all__ = ['UnitLoad']
|
||||
|
||||
|
||||
class UnitLoad:
|
||||
__name__ = 'stock.unit_load'
|
||||
__metaclass__ = PoolMeta
|
||||
|
||||
load_line = fields.Many2One('carrier.load.order.line', 'Load line',
|
||||
select=True, readonly=True,
|
||||
|
|
|
@ -12,7 +12,6 @@ this repository contains the full copyright notices and license terms. -->
|
|||
<!-- Extend unit load form view -->
|
||||
<record model="ir.ui.view" id="unit_load_view_form">
|
||||
<field name="model">stock.unit_load</field>
|
||||
<field name="type">form</field>
|
||||
<field name="name">unit_load_form</field>
|
||||
<field name="inherit" ref="stock_unit_load.unit_load_view_form"/>
|
||||
</record>
|
||||
|
|
Loading…
Reference in New Issue