From 8cdfaae16f39af9bf1704748c2815a9ece51e248 Mon Sep 17 00:00:00 2001 From: Raimon Esteve Date: Wed, 29 Jun 2016 10:01:31 +0200 Subject: [PATCH] Upgrade last changes from 3.4 --- __init__.py | 5 +++ locale/ca_ES.po | 49 +++++++++++++++++++++++ locale/es_ES.po | 49 +++++++++++++++++++++++ location.py | 60 ++++++++++++++++++++++++++++ view/lot_list_qty.xml | 9 +++++ view/lots_by_location_start_form.xml | 7 ++++ view/move_form.xml | 8 ++++ 7 files changed, 187 insertions(+) create mode 100644 locale/ca_ES.po create mode 100644 locale/es_ES.po create mode 100644 location.py create mode 100644 view/lot_list_qty.xml create mode 100644 view/lots_by_location_start_form.xml create mode 100644 view/move_form.xml diff --git a/__init__.py b/__init__.py index 1be3f67..5087587 100644 --- a/__init__.py +++ b/__init__.py @@ -2,10 +2,15 @@ # copyright notices and license terms. from trytond.pool import Pool from .stock import * +from .location import * def register(): Pool.register( Lot, Move, + LotsByLocationStart, module='stock_lot_quantity', type_='model') + Pool.register( + LotsByLocation, + module='stock_lot_quantity', type_='wizard') diff --git a/locale/ca_ES.po b/locale/ca_ES.po new file mode 100644 index 0000000..af7d861 --- /dev/null +++ b/locale/ca_ES.po @@ -0,0 +1,49 @@ +# +msgid "" +msgstr "Content-Type: text/plain; charset=utf-8\n" + +msgctxt "field:stock.lots_by_location.start,forecast_date:" +msgid "At Date" +msgstr "A data" + +msgctxt "field:stock.lots_by_location.start,id:" +msgid "ID" +msgstr "ID" + +msgctxt "help:stock.lots_by_location.start,forecast_date:" +msgid "" +"Allow to compute expected stock quantities for this date.\n" +"* An empty value is an infinite date in the future.\n" +"* A date in the past will provide historical values." +msgstr "" +"Permet calcular les quantitats previstes d'estoc per a aquesta data.\n" +"* Un valor buit és un data infinita en el futur.\n" +"* Una data en el passat proporcionarà valors històrics." + +msgctxt "model:ir.action,name:act_lots_by_location" +msgid "Lots" +msgstr "Lots" + +msgctxt "model:ir.action,name:wizard_lots_by_location" +msgid "Lots by Location" +msgstr "Lots per ubicació" + +msgctxt "model:stock.lots_by_location.start,name:" +msgid "Lots by Location" +msgstr "Lots per ubicació" + +msgctxt "view:stock.lot:" +msgid "Lots" +msgstr "Lots" + +msgctxt "view:stock.lots_by_location.start:" +msgid "Lots by Location" +msgstr "Lots per ubicació" + +msgctxt "wizard_button:stock.lots_by_location,start,end:" +msgid "Cancel" +msgstr "Cancel·lat" + +msgctxt "wizard_button:stock.lots_by_location,start,open:" +msgid "Open" +msgstr "Obre" diff --git a/locale/es_ES.po b/locale/es_ES.po new file mode 100644 index 0000000..54c83e8 --- /dev/null +++ b/locale/es_ES.po @@ -0,0 +1,49 @@ +# +msgid "" +msgstr "Content-Type: text/plain; charset=utf-8\n" + +msgctxt "field:stock.lots_by_location.start,forecast_date:" +msgid "At Date" +msgstr "A fecha" + +msgctxt "field:stock.lots_by_location.start,id:" +msgid "ID" +msgstr "ID" + +msgctxt "help:stock.lots_by_location.start,forecast_date:" +msgid "" +"Allow to compute expected stock quantities for this date.\n" +"* An empty value is an infinite date in the future.\n" +"* A date in the past will provide historical values." +msgstr "" +"Permite calcular las cantidades previstas de stock para esta fecha.\n" +"* Un valor vacío es un fecha infinita en el futuro.\n" +"* Una fecha en el pasado proporcionará valores históricos." + +msgctxt "model:ir.action,name:act_lots_by_location" +msgid "Lots" +msgstr "Lotes" + +msgctxt "model:ir.action,name:wizard_lots_by_location" +msgid "Lots by Location" +msgstr "Lotes por ubicación" + +msgctxt "model:stock.lots_by_location.start,name:" +msgid "Lots by Location" +msgstr "Lotes por ubicación" + +msgctxt "view:stock.lot:" +msgid "Lots" +msgstr "Lotes" + +msgctxt "view:stock.lots_by_location.start:" +msgid "Lots by Location" +msgstr "Lotes por ubicación" + +msgctxt "wizard_button:stock.lots_by_location,start,end:" +msgid "Cancel" +msgstr "Cancelar" + +msgctxt "wizard_button:stock.lots_by_location,start,open:" +msgid "Open" +msgstr "Abrir" diff --git a/location.py b/location.py new file mode 100644 index 0000000..83a8f97 --- /dev/null +++ b/location.py @@ -0,0 +1,60 @@ +import datetime +from trytond.model import ModelView, fields +from trytond.wizard import Wizard, StateView, StateAction, Button +from trytond.transaction import Transaction +from trytond.pyson import PYSONEncoder, Date +from trytond.pool import Pool + +__all__ = ['LotsByLocationStart', 'LotsByLocation'] + + +class LotsByLocationStart(ModelView): + 'Lots by Location' + __name__ = 'stock.lots_by_location.start' + forecast_date = fields.Date( + 'At Date', help=('Allow to compute expected ' + 'stock quantities for this date.\n' + '* An empty value is an infinite date in the future.\n' + '* A date in the past will provide historical values.')) + + @staticmethod + def default_forecast_date(): + Date_ = Pool().get('ir.date') + return Date_.today() + + +class LotsByLocation(Wizard): + 'Lots by Location' + __name__ = 'stock.lots_by_location' + start = StateView('stock.lots_by_location.start', + 'stock_lot_quantity.lots_by_location_start_view_form', [ + Button('Cancel', 'end', 'tryton-cancel'), + Button('Open', 'open', 'tryton-ok', True), + ]) + open = StateAction('stock_lot_quantity.act_lots_by_location') + + def do_open(self, action): + pool = Pool() + Location = pool.get('stock.location') + Lang = pool.get('ir.lang') + + context = {} + context['locations'] = Transaction().context.get('active_ids') + date = self.start.forecast_date or datetime.date.max + context['stock_date_end'] = Date(date.year, date.month, date.day) + action['pyson_context'] = PYSONEncoder().encode(context) + + locations = Location.browse(context['locations']) + + for code in [Transaction().language, 'en_US']: + langs = Lang.search([ + ('code', '=', code), + ]) + if langs: + break + lang = langs[0] + date = Lang.strftime(date, lang.code, lang.date) + + action['name'] += ' - (%s) @ %s' % ( + ','.join(l.name for l in locations), date) + return action, {} diff --git a/view/lot_list_qty.xml b/view/lot_list_qty.xml new file mode 100644 index 0000000..520d2d0 --- /dev/null +++ b/view/lot_list_qty.xml @@ -0,0 +1,9 @@ + + + + + + + + diff --git a/view/lots_by_location_start_form.xml b/view/lots_by_location_start_form.xml new file mode 100644 index 0000000..4ef90e6 --- /dev/null +++ b/view/lots_by_location_start_form.xml @@ -0,0 +1,7 @@ + + +
+