Revert "If stock_lot is installed, allow computing lot quantites based on party."
This reverts commit 77f08d8d82
.
This commit is contained in:
parent
8fed7d59a0
commit
87340dc018
|
@ -24,7 +24,3 @@ def register():
|
|||
Pool.register(
|
||||
product.ProductByParty,
|
||||
module='stock_external_party', type_='wizard')
|
||||
Pool.register(
|
||||
stock.Lot,
|
||||
depends=['stock_lot'],
|
||||
module='stock_external_party', type_='model')
|
||||
|
|
36
stock.py
36
stock.py
|
@ -7,7 +7,6 @@ from trytond.modules.stock.move import STATES, DEPENDS
|
|||
from trytond.modules.stock import StockMixin
|
||||
from trytond.i18n import gettext
|
||||
from trytond.exceptions import UserError
|
||||
from trytond.pyson import Eval
|
||||
|
||||
|
||||
class Party(StockMixin, metaclass=PoolMeta):
|
||||
|
@ -64,34 +63,6 @@ class Location(metaclass=PoolMeta):
|
|||
return grouping, key
|
||||
|
||||
|
||||
class Lot(metaclass=PoolMeta):
|
||||
__name__ = 'stock.lot'
|
||||
|
||||
@classmethod
|
||||
def _get_quantity(cls, records, name, location_ids,
|
||||
grouping=('product',), grouping_filter=None, position=-1):
|
||||
if 'party' in Transaction().context:
|
||||
party_id = Transaction().context.get('party')
|
||||
grouping = grouping + ('party',)
|
||||
grouping_filter = grouping_filter + ([], [party_id],)
|
||||
# Must use position = -2 because we want to get the quantity from the
|
||||
# lot key, not the party
|
||||
position = -2
|
||||
with Transaction().set_context(exclude_party_quantities=True):
|
||||
return super()._get_quantity(records, name, location_ids, grouping,
|
||||
grouping_filter, position)
|
||||
|
||||
#@classmethod
|
||||
#def _search_quantity(cls, name, location_ids, domain=None,
|
||||
#grouping=('product',), position=-1):
|
||||
#party_id = Transaction().context.get('party')
|
||||
#if party_id:
|
||||
#grouping = grouping + ('party',)
|
||||
#position = -2
|
||||
#return super()._search_quantity(name, location_ids, domain, grouping,
|
||||
#position)
|
||||
|
||||
|
||||
class Move(metaclass=PoolMeta):
|
||||
__name__ = 'stock.move'
|
||||
party = fields.Many2One('party.party', 'Party')
|
||||
|
@ -102,13 +73,6 @@ class Move(metaclass=PoolMeta):
|
|||
party_to_check = fields.Function(fields.Many2One('party.party', 'Party'),
|
||||
'get_party_to_check')
|
||||
|
||||
@classmethod
|
||||
def __setup__(cls):
|
||||
super().__setup__()
|
||||
if hasattr(cls, 'lot'):
|
||||
cls.lot.context['party'] = Eval('party_used', 0)
|
||||
cls.lot.depends.append('party_used')
|
||||
|
||||
|
||||
@fields.depends('party')
|
||||
def on_change_with_party_used(self, name=None):
|
||||
|
|
Loading…
Reference in New Issue