Shipment Out Export Systemlogics Modula

This commit is contained in:
resteve 2015-11-10 17:21:38 +01:00
parent 338852ae9d
commit ae512f33d9
4 changed files with 78 additions and 1 deletions

View file

@ -15,10 +15,12 @@ def register():
Product,
ShipmentIn,
ShipmentOut,
ShipmentOutSystemlogicsModulaExportStart,
ShipmentInternal,
SystemlogicsModulaArticoli,
SystemlogicsModulaArticoliResult,
module='systemlogics_modula', type_='model')
Pool.register(
ShipmentOutSystemlogicsModulaExport,
SystemlogicsModulaArticoli,
module='systemlogics_modula', type_='wizard')

View file

@ -9,5 +9,28 @@ The COPYRIGHT file at the top level of this repository contains the full copyrig
<field name="inherit" ref="stock.shipment_in_view_form"/>
<field name="name">shipment_in_form</field>
</record>
<!-- stock.shipment.out export wizard -->
<record model="ir.ui.view" id="shipment_out_export_form">
<field name="model">stock.shipment.out.systemlogics.modula.export.start</field>
<field name="type">form</field>
<field name="name">shipment_out_export_form</field>
</record>
<record model="ir.action.wizard" id="wizard_shipment_out_export">
<field name="name">Export Systemlogics Modula</field>
<field name="wiz_name">stock.shipment.out.systemlogics.modula.export</field>
<field name="model">stock.shipment.out</field>
</record>
<record model="ir.action.keyword" id="shipment_out_export_keyword">
<field name="keyword">form_action</field>
<field name="model">stock.shipment.out,-1</field>
<field name="action" ref="wizard_shipment_out_export"/>
</record>
<record model="ir.action-res.group"
id="action_group_wizard_shipment_out_export">
<field name="action" ref="wizard_shipment_out_export"/>
<field name="group" ref="group_systemlogics_modula"/>
</record>
</data>
</tryton>

View file

@ -5,8 +5,10 @@ from trytond.pool import Pool, PoolMeta
from trytond.model import ModelView, fields
from trytond.transaction import Transaction
from trytond.pyson import Eval
from trytond.wizard import Wizard, StateView, Button, StateTransition
__all__ = ['ShipmentIn', 'ShipmentOut', 'ShipmentInternal']
__all__ = ['ShipmentIn', 'ShipmentOut', 'ShipmentInternal',
'ShipmentOutSystemlogicsModulaExportStart', 'ShipmentOutSystemlogicsModulaExport']
__metaclass__ = PoolMeta
@ -198,3 +200,47 @@ class ShipmentInternal:
def assign(cls, shipments):
super(ShipmentInternal, cls).assign(shipments)
cls.generate_systemlogics_modula(shipments)
class ShipmentOutSystemlogicsModulaExportStart(ModelView):
'Customer shipments export Systemlogics Modula Start'
__name__ = 'stock.shipment.out.systemlogics.modula.export.start'
shipments = fields.Many2Many('stock.shipment.out', None, None, 'Shipments',
domain=[
('state', 'in', ['assigned']),
],
states={
'required': True,
},
help='Assigned customer shipments to export Systemlogics Modula.')
@staticmethod
def default_shipments():
ShipmentOut = Pool().get('stock.shipment.out')
active_ids = Transaction().context.get('active_ids', [])
shipments = ShipmentOut.search([
('id', 'in', active_ids),
('state', 'in', ['assigned']),
])
return [s.id for s in shipments]
class ShipmentOutSystemlogicsModulaExport(Wizard):
'Customer shipments export Systemlogics Modula'
__name__ = 'stock.shipment.out.systemlogics.modula.export'
start = StateView('stock.shipment.out.systemlogics.modula.export.start',
'systemlogics_modula.shipment_out_export_form', [
Button('Cancel', 'end', 'tryton-cancel'),
Button('Export', 'export', 'tryton-ok', True),
])
export = StateTransition()
def transition_export(self):
ShipmentOut = Pool().get('stock.shipment.out')
shipments = self.start.shipments
if shipments:
ShipmentOut.generate_systemlogics_modula(shipments)
return 'end'

View file

@ -0,0 +1,6 @@
<?xml version="1.0"?>
<!-- This file is part systemlogics_modula module for Tryton.
The COPYRIGHT file at the top level of this repository contains the full copyright notices and license terms. -->
<form string="Export Shipments Out to Modula">
<field name="shipments" colspan="4"/>
</form>