Add "unit_load" option to load_grouping_method field of the party
This commit refs #10437
This commit is contained in:
parent
3b41c318a5
commit
7d1b2e49e4
11
__init__.py
11
__init__.py
|
@ -5,10 +5,12 @@ from trytond.pool import Pool
|
|||
from .load import (Load, LoadOrder, LoadOrderLine,
|
||||
LoadUnitLoad, LoadUnitLoadOrder,
|
||||
LoadUnitLoadData, Configuration, LoadSheet, CMR,
|
||||
RoadTransportNote, LoadUnitLoadFailed)
|
||||
RoadTransportNote, LoadUnitLoadFailed, LoadOrderGrouping)
|
||||
from .unit_load import UnitLoad, UnitLoadLabel
|
||||
from .sale import (Sale, SaleLine, CreateLoad, CreateLoadFromSale,
|
||||
CreateLoadLineFromSale)
|
||||
from .party import Party
|
||||
from . import configuration
|
||||
|
||||
|
||||
def register():
|
||||
|
@ -36,3 +38,10 @@ def register():
|
|||
RoadTransportNote,
|
||||
UnitLoadLabel,
|
||||
module='carrier_load_ul', type_='report')
|
||||
Pool.register(
|
||||
Party,
|
||||
LoadOrderGrouping,
|
||||
configuration.Configuration,
|
||||
configuration.ConfigurationLoad,
|
||||
module='carrier_load_ul', type_='model',
|
||||
depends=['carrier_load_grouping_method'])
|
||||
|
|
|
@ -0,0 +1,23 @@
|
|||
# The COPYRIGHT file at the top level of this repository contains the full
|
||||
# copyright notices and license terms.
|
||||
from trytond.pool import PoolMeta
|
||||
|
||||
__all__ = ['Configuration', 'ConfigurationLoad']
|
||||
|
||||
|
||||
class Configuration(metaclass=PoolMeta):
|
||||
__name__ = 'party.configuration'
|
||||
|
||||
@classmethod
|
||||
def __setup__(cls):
|
||||
super().__setup__()
|
||||
cls.load_grouping_method.selection.extend([('unit_load', 'Unit load')])
|
||||
|
||||
|
||||
class ConfigurationLoad(metaclass=PoolMeta):
|
||||
__name__ = 'party.configuration.load_grouping_method'
|
||||
|
||||
@classmethod
|
||||
def __setup__(cls):
|
||||
super().__setup__()
|
||||
cls.load_grouping_method.selection.extend([('unit_load', 'Unit load')])
|
21
load.py
21
load.py
|
@ -165,7 +165,14 @@ class LoadOrder(metaclass=PoolMeta):
|
|||
def _get_load_sale_line(self, sale, key, grouped_items):
|
||||
res = super(LoadOrder, self)._get_load_sale_line(
|
||||
sale, key, grouped_items)
|
||||
pool = Pool()
|
||||
Modeldata = pool.get('ir.model.data')
|
||||
Uom = pool.get('product.uom')
|
||||
uom = Uom(Modeldata.get_id('product', 'uom_unit'))
|
||||
res.ul_quantity = len(grouped_items)
|
||||
res.ul_cases_quantity = (uom.round(
|
||||
sum(item.cases_quantity
|
||||
for item in grouped_items) / res.ul_quantity))
|
||||
return res
|
||||
|
||||
def _get_shipment_out(self, sale):
|
||||
|
@ -955,3 +962,17 @@ class CreateLoadDataLineMixin(object):
|
|||
('ul_quantity', '<=', Eval('available_ul_quantity')),
|
||||
('ul_quantity', '>=', 0)],
|
||||
depends=['available_ul_quantity'])
|
||||
|
||||
|
||||
class LoadOrderGrouping(metaclass=PoolMeta):
|
||||
__name__ = 'carrier.load.order'
|
||||
|
||||
@classmethod
|
||||
def _get_load_group_key(cls, items, item):
|
||||
res = super()._get_load_group_key(items, item)
|
||||
if (item.load_line and
|
||||
item.load_line.order.party.load_grouping_method == 'unit_load'):
|
||||
if res is None:
|
||||
res = {}
|
||||
res['unit_load'] = item.id
|
||||
return res
|
||||
|
|
15
locale/es.po
15
locale/es.po
|
@ -488,4 +488,17 @@ msgstr "Identificador"
|
|||
|
||||
msgctxt "view:carrier.load.create_from_sale:"
|
||||
msgid "Phone"
|
||||
msgstr "Teléfono"
|
||||
msgstr "Teléfono"
|
||||
|
||||
msgctxt "selection:party.party,load_grouping_method:"
|
||||
msgid "Unit load"
|
||||
msgstr "Unidad de carga"
|
||||
|
||||
msgctxt "selection:party.configuration,load_grouping_method:"
|
||||
msgid "Unit load"
|
||||
msgstr "Unidad de carga"
|
||||
|
||||
msgctxt ""
|
||||
"selection:party.configuration.load_grouping_method,load_grouping_method:"
|
||||
msgid "Unit load"
|
||||
msgstr "Unidad de carga"
|
|
@ -0,0 +1,14 @@
|
|||
# The COPYRIGHT file at the top level of this repository contains the full
|
||||
# copyright notices and license terms.
|
||||
from trytond.pool import PoolMeta
|
||||
|
||||
__all__ = ['Party']
|
||||
|
||||
|
||||
class Party(metaclass=PoolMeta):
|
||||
__name__ = 'party.party'
|
||||
|
||||
@classmethod
|
||||
def __setup__(cls):
|
||||
super().__setup__()
|
||||
cls.load_grouping_method.selection.extend([('unit_load', 'Unit load')])
|
|
@ -10,6 +10,7 @@ depends:
|
|||
extras_depend:
|
||||
stock_move_done2cancel
|
||||
sale_confirmed2quotation
|
||||
carrier_load_grouping_method
|
||||
|
||||
xml:
|
||||
load.xml
|
||||
|
|
Loading…
Reference in New Issue