Fix mistake last commit

This commit is contained in:
Bernat Brunet 2020-07-02 15:43:59 +02:00
parent c3e90b10c2
commit 74adeb39f1
4 changed files with 10 additions and 34 deletions

View File

@ -124,10 +124,6 @@ msgctxt "model:ir.ui.menu,name:menu_move_out_form"
msgid "Moves Out"
msgstr "Moviments de sortida"
msgctxt "view:stock.move:"
msgid "Move Out Quantity"
msgstr "Quantitat moviment sortida"
msgctxt "view:stock.move:"
msgid "Move Out State"
msgstr "Estat moviment sortida"

View File

@ -124,10 +124,6 @@ msgctxt "model:ir.ui.menu,name:menu_move_out_form"
msgid "Moves Out"
msgstr "Movimentos de salida"
msgctxt "view:stock.move:"
msgid "Move Out Quantity"
msgstr "Cantidad movimiento salida"
msgctxt "view:stock.move:"
msgid "Move Out State"
msgstr "Estado movimiento salida"

33
move.py
View File

@ -27,9 +27,6 @@ class Move(metaclass=PoolMeta):
('cancel', 'Canceled'),
], 'Move Inventori State'), 'get_origin_move_field',
searcher='search_origin_move_field')
origin_quantity = fields.Function(fields.Float("Move Inventory Quantity",
digits=(16, Eval('unit_digits', 2))), 'get_origin_move_field',
searcher='search_origin_move_field')
@classmethod
def get_sale_relation(cls, moves, names):
@ -95,22 +92,14 @@ class Move(metaclass=PoolMeta):
('sale.party',) + tuple(clause[1:]),
]
@classmethod
def get_origin_move_field(cls, moves, names):
result = {
'origin_state': {},
'origin_quantity': {},
}
for move in moves:
origins = cls.search([
('origin', '=', 'stock.move,' + str(move.id)),
])
origin = origins[0] if origins else None
result['origin_state'][move.id] = (origin.state
if origin else None)
result['origin_quantity'][move.id] = (origin.quantity
if origin else None)
return result
def get_origin_move_field(self, name):
pool = Pool()
Move = pool.get('stock.move')
origins = Move.search([
('origin', '=', 'stock.move,' + str(self.id)),
])
return origins[0].state if origins else None
@classmethod
def search_origin_move_field(cls, name, clause):
@ -120,11 +109,7 @@ class Move(metaclass=PoolMeta):
move = Move.__table__()
column, operator, value = clause
res = {
'origin_state': 'state',
'origin_quantity': 'quantity',
}
column = Column(move, res[column])
column = Column(move, 'state')
Operator = fields.SQL_OPERATORS[operator]
_, move_type = Move.origin.sql_type()
query = sql_table.join(move,

View File

@ -7,8 +7,7 @@ this repository contains the full copyright notices and license terms. -->
<field name="shipment" expand="1"/>
<field name="production_input"/>
<field name="product"/>
<field name="quantity" string="Move Out Quantity"/>
<field name="origin_quantity"/>
<field name="quantity"/>
<field name="uom"/>
<field name="planned_date"/>
<field name="effective_date"/>