parent
fcc644078f
commit
77e4c290f2
|
@ -5,8 +5,8 @@ from .load import (Load, LoadOrder, LoadOrderLine, LoadOrderIncoterm,
|
||||||
LoadSheet, CMR, RoadTransportNote, PrintLoadOrderShipment)
|
LoadSheet, CMR, RoadTransportNote, PrintLoadOrderShipment)
|
||||||
from .configuration import Configuration
|
from .configuration import Configuration
|
||||||
from .sale import (Sale, CostType, CostTemplate, CostSale, CostSaleLine)
|
from .sale import (Sale, CostType, CostTemplate, CostSale, CostSaleLine)
|
||||||
from .stock import (Move, ShipmentOut, ShipmentInternal, LoadShipmentInternal,
|
from .stock import (Move, ShipmentOut, ShipmentInternal, LoadShipment,
|
||||||
ShipmentOutReturn)
|
ShipmentOutReturn, ShipmentInReturn)
|
||||||
from .purchase import Purchase
|
from .purchase import Purchase
|
||||||
from .carrier import Carrier
|
from .carrier import Carrier
|
||||||
|
|
||||||
|
@ -29,6 +29,7 @@ def register():
|
||||||
ShipmentOut,
|
ShipmentOut,
|
||||||
ShipmentInternal,
|
ShipmentInternal,
|
||||||
ShipmentOutReturn,
|
ShipmentOutReturn,
|
||||||
|
ShipmentInReturn,
|
||||||
module='carrier_load', type_='model')
|
module='carrier_load', type_='model')
|
||||||
Pool.register(
|
Pool.register(
|
||||||
LoadSheet,
|
LoadSheet,
|
||||||
|
@ -37,5 +38,5 @@ def register():
|
||||||
module='carrier_load', type_='report')
|
module='carrier_load', type_='report')
|
||||||
Pool.register(
|
Pool.register(
|
||||||
PrintLoadOrderShipment,
|
PrintLoadOrderShipment,
|
||||||
LoadShipmentInternal,
|
LoadShipment,
|
||||||
module='carrier_load', type_='wizard')
|
module='carrier_load', type_='wizard')
|
||||||
|
|
27
load.py
27
load.py
|
@ -129,6 +129,13 @@ class Load(Workflow, ModelView, ModelSQL, DockMixin):
|
||||||
Purchase = pool.get('purchase.purchase')
|
Purchase = pool.get('purchase.purchase')
|
||||||
cls.purchase_state._field.selection.extend(Purchase.state.selection)
|
cls.purchase_state._field.selection.extend(Purchase.state.selection)
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def view_attributes(cls):
|
||||||
|
if Transaction().context.get('loading_shipment', False):
|
||||||
|
return [('//group[@id="state_buttons"]', 'states',
|
||||||
|
{'invisible': True})]
|
||||||
|
return []
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def default_code_readonly():
|
def default_code_readonly():
|
||||||
Configuration = Pool().get('carrier.configuration')
|
Configuration = Pool().get('carrier.configuration')
|
||||||
|
@ -381,13 +388,13 @@ class LoadOrder(Workflow, ModelView, ModelSQL, IncotermDocumentMixin):
|
||||||
lines = fields.One2Many('carrier.load.order.line', 'order', 'Lines',
|
lines = fields.One2Many('carrier.load.order.line', 'order', 'Lines',
|
||||||
states={'readonly': Eval('state') != 'draft'},
|
states={'readonly': Eval('state') != 'draft'},
|
||||||
depends=['state'])
|
depends=['state'])
|
||||||
party = fields.Many2One('party.party', 'Party', select=True,
|
party = fields.Many2One('party.party', 'Party', select=True, states={
|
||||||
states={'readonly': (Eval('state') != 'draft') |
|
'readonly': (Eval('state') != 'draft') |
|
||||||
(Eval('lines', [0])),
|
(Eval('lines', [0])),
|
||||||
'required': (Eval('state') == 'done') &
|
'required': (Eval('state') == 'done') &
|
||||||
(Eval('type') == 'out'),
|
(Eval('type') != 'internal'),
|
||||||
'invisible': Eval('type') == 'internal'},
|
'invisible': Eval('type') == 'internal'},
|
||||||
depends=['state', 'lines', 'type'])
|
depends=['state', 'lines', 'type'])
|
||||||
incoterms = fields.One2Many('carrier.load.order.incoterm', 'order', 'Incoterms',
|
incoterms = fields.One2Many('carrier.load.order.incoterm', 'order', 'Incoterms',
|
||||||
states={'readonly': ~Eval('state').in_(['draft', 'waiting']),
|
states={'readonly': ~Eval('state').in_(['draft', 'waiting']),
|
||||||
'invisible': ~Eval('party')},
|
'invisible': ~Eval('party')},
|
||||||
|
@ -416,7 +423,8 @@ class LoadOrder(Workflow, ModelView, ModelSQL, IncotermDocumentMixin):
|
||||||
'get_carrier_amount')
|
'get_carrier_amount')
|
||||||
type = fields.Selection([
|
type = fields.Selection([
|
||||||
('out', 'Out'),
|
('out', 'Out'),
|
||||||
('internal', 'Internal')], 'Type', required=True, select=True,
|
('internal', 'Internal'),
|
||||||
|
('in_return', 'In return')], 'Type', required=True, select=True,
|
||||||
states={'readonly': Bool(Eval('lines', [])) |
|
states={'readonly': Bool(Eval('lines', [])) |
|
||||||
Bool(Eval('shipment', None)) |
|
Bool(Eval('shipment', None)) |
|
||||||
(Eval('state') != 'draft')},
|
(Eval('state') != 'draft')},
|
||||||
|
@ -586,7 +594,8 @@ class LoadOrder(Workflow, ModelView, ModelSQL, IncotermDocumentMixin):
|
||||||
def _get_shipments(cls):
|
def _get_shipments(cls):
|
||||||
return ['stock.shipment.out',
|
return ['stock.shipment.out',
|
||||||
'stock.shipment.out.return',
|
'stock.shipment.out.return',
|
||||||
'stock.shipment.internal']
|
'stock.shipment.internal',
|
||||||
|
'stock.shipment.in.return']
|
||||||
|
|
||||||
@fields.depends('load')
|
@fields.depends('load')
|
||||||
def on_change_with_date(self, name=None):
|
def on_change_with_date(self, name=None):
|
||||||
|
|
25
locale/es.po
25
locale/es.po
|
@ -286,6 +286,10 @@ msgctxt "selection:carrier.load.order,type:"
|
||||||
msgid "Internal"
|
msgid "Internal"
|
||||||
msgstr "Interna"
|
msgstr "Interna"
|
||||||
|
|
||||||
|
msgctxt "selection:carrier.load.order,type:"
|
||||||
|
msgid "In return"
|
||||||
|
msgstr "Devolución entrada"
|
||||||
|
|
||||||
msgctxt "field:carrier.load.order.incoterm,create_date:"
|
msgctxt "field:carrier.load.order.incoterm,create_date:"
|
||||||
msgid "Create Date"
|
msgid "Create Date"
|
||||||
msgstr "Fecha creación"
|
msgstr "Fecha creación"
|
||||||
|
@ -967,19 +971,30 @@ msgctxt "field:stock.shipment.internal,load:"
|
||||||
msgid "Load"
|
msgid "Load"
|
||||||
msgstr "Carga"
|
msgstr "Carga"
|
||||||
|
|
||||||
|
msgctxt "field:stock.shipment.in.return,load:"
|
||||||
|
msgid "Load"
|
||||||
|
msgstr "Carga"
|
||||||
|
|
||||||
|
msgctxt "field:stock.shipment,load:"
|
||||||
|
msgid "Load"
|
||||||
|
msgstr "Carga"
|
||||||
|
|
||||||
msgctxt "model:ir.action,name:wizard_load_shipment_internal"
|
msgctxt "model:ir.action,name:wizard_load_shipment_internal"
|
||||||
msgid "Load Shipments"
|
msgid "Load Shipments"
|
||||||
msgstr "Cargar albaranes"
|
msgstr "Cargar albaranes"
|
||||||
|
|
||||||
msgctxt "model:stock.shipment.internal.load,name:"
|
msgctxt "model:stock.shipment.load,name:"
|
||||||
msgid "Load Shipment internal"
|
msgid "Load Shipment"
|
||||||
msgstr "Cargar albarán interno"
|
msgstr "Cargar albarán"
|
||||||
|
|
||||||
msgctxt "wizard_button:stock.shipment.internal.load,load,end:"
|
msgctxt "wizard_button:stock.shipment.load,load,end:"
|
||||||
msgid "Cancel"
|
msgid "Cancel"
|
||||||
msgstr "Cancelar"
|
msgstr "Cancelar"
|
||||||
|
|
||||||
msgctxt "wizard_button:stock.shipment.internal.load,load,associate:"
|
msgctxt "wizard_button:stock.shipment.load,load,associate:"
|
||||||
msgid "Associate"
|
msgid "Associate"
|
||||||
msgstr "Asociar"
|
msgstr "Asociar"
|
||||||
|
|
||||||
|
msgctxt "model:ir.action,name:wizard_load_shipment_in_return"
|
||||||
|
msgid "Load Shipments"
|
||||||
|
msgstr "Cargar albaranes"
|
36
stock.py
36
stock.py
|
@ -6,7 +6,7 @@ from trytond.wizard import Wizard, StateTransition, StateView, Button
|
||||||
from trytond.transaction import Transaction
|
from trytond.transaction import Transaction
|
||||||
|
|
||||||
__all__ = ['Move', 'ShipmentOut', 'ShipmentInternal',
|
__all__ = ['Move', 'ShipmentOut', 'ShipmentInternal',
|
||||||
'LoadShipmentInternal', 'ShipmentOutReturn']
|
'LoadShipment', 'ShipmentOutReturn', 'ShipmentInReturn']
|
||||||
|
|
||||||
|
|
||||||
class Move:
|
class Move:
|
||||||
|
@ -74,12 +74,25 @@ class ShipmentInternal(ShipmentLoadMixin):
|
||||||
__name__ = 'stock.shipment.internal'
|
__name__ = 'stock.shipment.internal'
|
||||||
|
|
||||||
|
|
||||||
class LoadShipmentInternal(Wizard):
|
class ShipmentInReturn(ShipmentLoadMixin):
|
||||||
"""Load Shipment internal"""
|
__metaclass__ = PoolMeta
|
||||||
__name__ = 'stock.shipment.internal.load'
|
__name__ = 'stock.shipment.in.return'
|
||||||
|
|
||||||
|
|
||||||
|
class LoadStateView(StateView):
|
||||||
|
|
||||||
|
def get_view(self, wizard, state_name):
|
||||||
|
with Transaction().set_context(loading_shipment=True):
|
||||||
|
return super(LoadStateView, self).get_view(
|
||||||
|
wizard, state_name)
|
||||||
|
|
||||||
|
|
||||||
|
class LoadShipment(Wizard):
|
||||||
|
"""Load Shipment"""
|
||||||
|
__name__ = 'stock.shipment.load'
|
||||||
|
|
||||||
start = StateTransition()
|
start = StateTransition()
|
||||||
load = StateView('carrier.load',
|
load = LoadStateView('carrier.load',
|
||||||
'carrier_load.load_view_form',
|
'carrier_load.load_view_form',
|
||||||
[Button('Cancel', 'end', 'tryton-cancel'),
|
[Button('Cancel', 'end', 'tryton-cancel'),
|
||||||
Button('Associate', 'associate', 'tryton-ok')])
|
Button('Associate', 'associate', 'tryton-ok')])
|
||||||
|
@ -87,7 +100,7 @@ class LoadShipmentInternal(Wizard):
|
||||||
|
|
||||||
def transition_start(self):
|
def transition_start(self):
|
||||||
pool = Pool()
|
pool = Pool()
|
||||||
Shipment = pool.get('stock.shipment.internal')
|
Shipment = pool.get(Transaction().context['active_model'])
|
||||||
|
|
||||||
shipments = Shipment.browse(Transaction().context['active_ids'])
|
shipments = Shipment.browse(Transaction().context['active_ids'])
|
||||||
for shipment in shipments:
|
for shipment in shipments:
|
||||||
|
@ -97,7 +110,7 @@ class LoadShipmentInternal(Wizard):
|
||||||
|
|
||||||
def default_load(self, fields):
|
def default_load(self, fields):
|
||||||
pool = Pool()
|
pool = Pool()
|
||||||
Shipment = pool.get('stock.shipment.internal')
|
Shipment = pool.get(Transaction().context['active_model'])
|
||||||
shipments = Shipment.browse(
|
shipments = Shipment.browse(
|
||||||
Transaction().context.get('active_ids'))
|
Transaction().context.get('active_ids'))
|
||||||
|
|
||||||
|
@ -110,7 +123,7 @@ class LoadShipmentInternal(Wizard):
|
||||||
def transition_associate(self):
|
def transition_associate(self):
|
||||||
pool = Pool()
|
pool = Pool()
|
||||||
LoadOrder = pool.get('carrier.load.order')
|
LoadOrder = pool.get('carrier.load.order')
|
||||||
Shipment = pool.get('stock.shipment.internal')
|
Shipment = pool.get(Transaction().context['active_model'])
|
||||||
|
|
||||||
shipments = Shipment.browse(Transaction().context['active_ids'])
|
shipments = Shipment.browse(Transaction().context['active_ids'])
|
||||||
|
|
||||||
|
@ -119,9 +132,12 @@ class LoadShipmentInternal(Wizard):
|
||||||
order = LoadOrder(
|
order = LoadOrder(
|
||||||
shipment=shipment,
|
shipment=shipment,
|
||||||
load=self.load,
|
load=self.load,
|
||||||
type='internal',
|
type=Shipment.__name__[15:].replace('.', '_'),
|
||||||
to_location=shipment.to_location.id,
|
|
||||||
state='draft')
|
state='draft')
|
||||||
|
if order.type == 'internal':
|
||||||
|
order.to_location = shipment.to_location.id
|
||||||
|
elif order.type == 'in_return':
|
||||||
|
order.party = shipment.supplier.id
|
||||||
orders.append(order)
|
orders.append(order)
|
||||||
self.load.orders = orders
|
self.load.orders = orders
|
||||||
self.load.save()
|
self.load.save()
|
||||||
|
|
27
stock.xml
27
stock.xml
|
@ -4,28 +4,35 @@
|
||||||
<!-- Shipment out -->
|
<!-- Shipment out -->
|
||||||
<record model="ir.ui.view" id="shipment_out_view_tree">
|
<record model="ir.ui.view" id="shipment_out_view_tree">
|
||||||
<field name="model">stock.shipment.out</field>
|
<field name="model">stock.shipment.out</field>
|
||||||
<field name="name">shipment_out_view_tree</field>
|
<field name="name">shipment_view_tree</field>
|
||||||
<field name="inherit" ref="stock.shipment_out_view_tree"/>
|
<field name="inherit" ref="stock.shipment_out_view_tree"/>
|
||||||
</record>
|
</record>
|
||||||
|
|
||||||
<!-- Shipment out return -->
|
<!-- Shipment out return -->
|
||||||
<record model="ir.ui.view" id="shipment_out_return_view_tree">
|
<record model="ir.ui.view" id="shipment_out_return_view_tree">
|
||||||
<field name="model">stock.shipment.out.return</field>
|
<field name="model">stock.shipment.out.return</field>
|
||||||
<field name="name">shipment_out_view_tree</field>
|
<field name="name">shipment_view_tree</field>
|
||||||
<field name="inherit" ref="stock.shipment_out_return_view_tree"/>
|
<field name="inherit" ref="stock.shipment_out_return_view_tree"/>
|
||||||
</record>
|
</record>
|
||||||
|
|
||||||
<!-- Shipment internal -->
|
<!-- Shipment internal -->
|
||||||
<record model="ir.ui.view" id="shipment_internal_view_tree">
|
<record model="ir.ui.view" id="shipment_internal_view_tree">
|
||||||
<field name="model">stock.shipment.internal</field>
|
<field name="model">stock.shipment.internal</field>
|
||||||
<field name="name">shipment_internal_view_tree</field>
|
<field name="name">shipment_view_tree</field>
|
||||||
<field name="inherit" ref="stock.shipment_internal_view_tree"/>
|
<field name="inherit" ref="stock.shipment_internal_view_tree"/>
|
||||||
</record>
|
</record>
|
||||||
|
|
||||||
|
<!-- Shipment in return -->
|
||||||
|
<record model="ir.ui.view" id="shipment_in_return_view_tree">
|
||||||
|
<field name="model">stock.shipment.in.return</field>
|
||||||
|
<field name="name">shipment_view_tree</field>
|
||||||
|
<field name="inherit" ref="stock.shipment_in_return_view_tree"/>
|
||||||
|
</record>
|
||||||
|
|
||||||
<!-- Wizard Load Shipment internal -->
|
<!-- Wizard Load Shipment internal -->
|
||||||
<record model="ir.action.wizard" id="wizard_load_shipment_internal">
|
<record model="ir.action.wizard" id="wizard_load_shipment_internal">
|
||||||
<field name="name">Load Shipments</field>
|
<field name="name">Load Shipments</field>
|
||||||
<field name="wiz_name">stock.shipment.internal.load</field>
|
<field name="wiz_name">stock.shipment.load</field>
|
||||||
<field name="model">stock.shipment.internal</field>
|
<field name="model">stock.shipment.internal</field>
|
||||||
</record>
|
</record>
|
||||||
<record model="ir.action.keyword" id="act_load_shipment_internal_keyword1">
|
<record model="ir.action.keyword" id="act_load_shipment_internal_keyword1">
|
||||||
|
@ -33,5 +40,17 @@
|
||||||
<field name="model">stock.shipment.internal,-1</field>
|
<field name="model">stock.shipment.internal,-1</field>
|
||||||
<field name="action" ref="wizard_load_shipment_internal"/>
|
<field name="action" ref="wizard_load_shipment_internal"/>
|
||||||
</record>
|
</record>
|
||||||
|
|
||||||
|
<!-- Wizard Load Shipment in return -->
|
||||||
|
<record model="ir.action.wizard" id="wizard_load_shipment_in_return">
|
||||||
|
<field name="name">Load Shipments</field>
|
||||||
|
<field name="wiz_name">stock.shipment.load</field>
|
||||||
|
<field name="model">stock.shipment.in.return</field>
|
||||||
|
</record>
|
||||||
|
<record model="ir.action.keyword" id="act_load_shipment_in_return_keyword1">
|
||||||
|
<field name="keyword">form_action</field>
|
||||||
|
<field name="model">stock.shipment.in.return,-1</field>
|
||||||
|
<field name="action" ref="wizard_load_shipment_in_return"/>
|
||||||
|
</record>
|
||||||
</data>
|
</data>
|
||||||
</tryton>
|
</tryton>
|
|
@ -1,8 +0,0 @@
|
||||||
<?xml version="1.0"?>
|
|
||||||
<!-- The COPYRIGHT file at the top level of
|
|
||||||
this repository contains the full copyright notices and license terms. -->
|
|
||||||
<data>
|
|
||||||
<xpath expr="/tree/field[@name='reference']" position="after">
|
|
||||||
<field name="load"/>
|
|
||||||
</xpath>
|
|
||||||
</data>
|
|
Loading…
Reference in New Issue