mirror of
https://github.com/NaN-tic/trytond-stock_distribution_in.git
synced 2023-12-14 06:03:03 +01:00
Move productions to wait state before assign_try.
This commit is contained in:
parent
d683b57701
commit
07791112a5
|
@ -264,12 +264,17 @@ class Distribution(Workflow, ModelSQL, ModelView):
|
|||
cls.write([x for x in distributions if not x.effective_date], {
|
||||
'effective_date': Date.today(),
|
||||
})
|
||||
Production.assign_try(Production.browse(list(productions)))
|
||||
productions = Production.browse(list(productions))
|
||||
Production.wait(productions)
|
||||
for production in productions:
|
||||
# We must assign production by production as assign_try()
|
||||
# only updates production states if all moves of all productions
|
||||
# are assigned
|
||||
Production.assign_try([production])
|
||||
|
||||
Purchase.process(Purchase.browse(purchase_ids))
|
||||
|
||||
|
||||
|
||||
class DistributionLine(ModelSQL, ModelView):
|
||||
'Distribution In Line'
|
||||
__name__ = 'stock.distribution.in.line'
|
||||
|
|
|
@ -102,7 +102,7 @@ Create payment term::
|
|||
>>> payment_term = create_payment_term()
|
||||
>>> payment_term.save()
|
||||
|
||||
Create productions::
|
||||
Create one production in wait state::
|
||||
|
||||
>>> Production = Model.get('production')
|
||||
>>> production1 = Production()
|
||||
|
@ -117,7 +117,12 @@ Create productions::
|
|||
>>> input_move.company = company
|
||||
>>> input_move.unit_price = Decimal('1')
|
||||
>>> input_move.currency = company.currency
|
||||
>>> production1.save()
|
||||
>>> production1.click('wait')
|
||||
>>> production1.state
|
||||
u'waiting'
|
||||
|
||||
Create another production in draft state::
|
||||
|
||||
>>> production2 = Production()
|
||||
>>> input_move = production2.inputs.new()
|
||||
>>> input_move.product = product
|
||||
|
@ -131,6 +136,8 @@ Create productions::
|
|||
>>> input_move.unit_price = Decimal('1')
|
||||
>>> input_move.currency = company.currency
|
||||
>>> production2.save()
|
||||
>>> production2.state
|
||||
u'draft'
|
||||
|
||||
Create purchase::
|
||||
|
||||
|
@ -233,8 +240,18 @@ Check that when the distribution is done, everything is correct::
|
|||
|
||||
Check invoice lines exist::
|
||||
|
||||
>> purchase.reload()
|
||||
>> purchase.shipment_state
|
||||
>>> purchase.reload()
|
||||
>>> purchase.shipment_state
|
||||
u'received'
|
||||
>> len(purchase.invoices)
|
||||
>>> len(purchase.invoices)
|
||||
1
|
||||
|
||||
Check both productions have been reserved::
|
||||
|
||||
>>> [x.state for x in Production.find([])]
|
||||
>>> production1.reload()
|
||||
>>> production1.state
|
||||
u'assigned'
|
||||
>>> production2.reload()
|
||||
>>> production2.state
|
||||
u'assigned'
|
||||
|
|
Loading…
Reference in a new issue