parent
da4ad4ab8a
commit
7386fc192d
|
@ -11,6 +11,7 @@ def register():
|
|||
product_limit.ShipmentOutReturn,
|
||||
product_limit.Location,
|
||||
product_limit.PrintProductLimitNoteParam,
|
||||
product_limit.Configuration,
|
||||
module='stock_location_product_limit', type_='model')
|
||||
Pool.register(
|
||||
product_limit.PrintProductLimitNote,
|
||||
|
|
10
locale/es.po
10
locale/es.po
|
@ -224,4 +224,12 @@ msgstr "Disponible"
|
|||
|
||||
msgctxt "report:stock.shipment.out.return.restocking_list:"
|
||||
msgid "Limit"
|
||||
msgstr "Límite"
|
||||
msgstr "Límite"
|
||||
|
||||
msgctxt "field:stock.configuration,show_limit:"
|
||||
msgid "Show product limits"
|
||||
msgstr "Mostrar límites producto"
|
||||
|
||||
msgctxt "help:stock.configuration,show_limit:"
|
||||
msgid "If checked a summary of product limits is shown in shipment reports."
|
||||
msgstr "Mostrará un resumen de límites de producto en los informes de albarán."
|
|
@ -12,7 +12,8 @@ from trytond.wizard import Wizard, StateTransition, StateView, Button
|
|||
|
||||
__all__ = ['ProductLimit', 'ShipmentOut', 'ShipmentOutReturn', 'Location',
|
||||
'ProductLimitNote', 'PrintProductLimitNote',
|
||||
'PrintProductLimitNoteParam', 'DeliveryNote', 'RestockingList']
|
||||
'PrintProductLimitNoteParam', 'DeliveryNote', 'RestockingList',
|
||||
'Configuration']
|
||||
|
||||
|
||||
class ProductLimit(ModelSQL, ModelView):
|
||||
|
@ -339,9 +340,17 @@ class DeliveryNote:
|
|||
|
||||
@classmethod
|
||||
def get_context(cls, records, data):
|
||||
Conf = Pool().get('stock.configuration')
|
||||
|
||||
report_context = super(DeliveryNote, cls).get_context(records, data)
|
||||
report_context['product_limits'] = {
|
||||
r.id: r.product_limits_by_location() for r in records}
|
||||
|
||||
show_limit = Conf(1).show_limit
|
||||
report_context['product_limits'] = {}
|
||||
for r in records:
|
||||
values = []
|
||||
if show_limit:
|
||||
values = r.product_limits_by_location()
|
||||
report_context['product_limits'][r.id] = values
|
||||
return report_context
|
||||
|
||||
|
||||
|
@ -351,7 +360,28 @@ class RestockingList:
|
|||
|
||||
@classmethod
|
||||
def get_context(cls, records, data):
|
||||
Conf = Pool().get('stock.configuration')
|
||||
|
||||
report_context = super(RestockingList, cls).get_context(records, data)
|
||||
report_context['product_limits'] = {
|
||||
r.id: r.product_limits_by_location() for r in records}
|
||||
|
||||
show_limit = Conf(1).show_limit
|
||||
report_context['product_limits'] = {}
|
||||
for r in records:
|
||||
values = []
|
||||
if show_limit:
|
||||
values = r.product_limits_by_location()
|
||||
report_context['product_limits'][r.id] = values
|
||||
return report_context
|
||||
|
||||
|
||||
class Configuration:
|
||||
__name__ = 'stock.configuration'
|
||||
__metaclass__ = PoolMeta
|
||||
|
||||
show_limit = fields.Boolean('Show product limits', help=(
|
||||
'If checked a summary of product limits is shown in shipment reports.')
|
||||
)
|
||||
|
||||
@staticmethod
|
||||
def default_show_limit():
|
||||
return True
|
||||
|
|
|
@ -84,6 +84,13 @@ this repository contains the full copyright notices and license terms. -->
|
|||
<field name="type">form</field>
|
||||
<field name="name">product_limit_print_params_form</field>
|
||||
</record>
|
||||
|
||||
<!-- Configuration -->
|
||||
<record model="ir.ui.view" id="configuration_view_form">
|
||||
<field name="model">stock.configuration</field>
|
||||
<field name="inherit" ref="stock.stock_configuration_view_form"/>
|
||||
<field name="name">configuration_form</field>
|
||||
</record>
|
||||
</data>
|
||||
</tryton>
|
||||
|
||||
|
|
|
@ -139,6 +139,11 @@ Testing the reports::
|
|||
u'odt'
|
||||
>>> name
|
||||
u'Delivery Note'
|
||||
>>> conf = Model.get('stock.configuration')(1)
|
||||
>>> conf.show_limit = False
|
||||
>>> conf.save()
|
||||
>>> delivery_note = Report('stock.shipment.out.delivery_note')
|
||||
>>> ext, _, _, name = delivery_note.execute([shipment_out], {})
|
||||
|
||||
Testing note print wizard::
|
||||
|
||||
|
|
Loading…
Reference in New Issue