mirror of
https://github.com/NaN-tic/trytond-stock_lot_quantity.git
synced 2023-12-14 03:12:59 +01:00
Upgrade last changes from 3.4
This commit is contained in:
parent
51f7447a5b
commit
8cdfaae16f
|
@ -2,10 +2,15 @@
|
||||||
# copyright notices and license terms.
|
# copyright notices and license terms.
|
||||||
from trytond.pool import Pool
|
from trytond.pool import Pool
|
||||||
from .stock import *
|
from .stock import *
|
||||||
|
from .location import *
|
||||||
|
|
||||||
|
|
||||||
def register():
|
def register():
|
||||||
Pool.register(
|
Pool.register(
|
||||||
Lot,
|
Lot,
|
||||||
Move,
|
Move,
|
||||||
|
LotsByLocationStart,
|
||||||
module='stock_lot_quantity', type_='model')
|
module='stock_lot_quantity', type_='model')
|
||||||
|
Pool.register(
|
||||||
|
LotsByLocation,
|
||||||
|
module='stock_lot_quantity', type_='wizard')
|
||||||
|
|
49
locale/ca_ES.po
Normal file
49
locale/ca_ES.po
Normal file
|
@ -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"
|
49
locale/es_ES.po
Normal file
49
locale/es_ES.po
Normal file
|
@ -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"
|
60
location.py
Normal file
60
location.py
Normal file
|
@ -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, {}
|
9
view/lot_list_qty.xml
Normal file
9
view/lot_list_qty.xml
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
<?xml version="1.0"?>
|
||||||
|
<!-- The COPYRIGHT file at the top level of this repository contains the full
|
||||||
|
copyright notices and license terms. -->
|
||||||
|
<tree string="Lots">
|
||||||
|
<field name="number"/>
|
||||||
|
<field name="product"/>
|
||||||
|
<field name="quantity"/>
|
||||||
|
<field name="forecast_quantity"/>
|
||||||
|
</tree>
|
7
view/lots_by_location_start_form.xml
Normal file
7
view/lots_by_location_start_form.xml
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
<?xml version="1.0"?>
|
||||||
|
<!-- This file is part of Tryton. The COPYRIGHT file at the top level of
|
||||||
|
this repository contains the full copyright notices and license terms. -->
|
||||||
|
<form string="Lots by Location">
|
||||||
|
<label name="forecast_date"/>
|
||||||
|
<field name="forecast_date"/>
|
||||||
|
</form>
|
8
view/move_form.xml
Normal file
8
view/move_form.xml
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
<?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="/form/field[@name='lot']" position="replace_attributes">
|
||||||
|
<field name="lot" view_ids="stock_lot_quantity.lot_view_list_qty"/>
|
||||||
|
</xpath>
|
||||||
|
</data>
|
Loading…
Reference in a new issue