mirror of
https://github.com/NaN-tic/trytond-sale_farm.git
synced 2023-12-14 03:23:03 +01:00
Fix tests
This commit is contained in:
parent
4277d8ec3f
commit
6fa83746e0
8
sale.py
8
sale.py
|
@ -54,10 +54,10 @@ class MoveEvent:
|
||||||
cls.raise_user_error('weight_required_in_sale_move_event',
|
cls.raise_user_error('weight_required_in_sale_move_event',
|
||||||
(event.rec_name,))
|
(event.rec_name,))
|
||||||
sales_to_process.add(event.origin.sale.id)
|
sales_to_process.add(event.origin.sale.id)
|
||||||
super(MoveEvent, cls).validate_event(events)
|
with Transaction().set_user(0, set_context=True):
|
||||||
if sales_to_process:
|
super(MoveEvent, cls).validate_event(events)
|
||||||
with Transaction().set_user(0, set_context=True):
|
if sales_to_process:
|
||||||
Sale.process(Sale.browse(list(sales_to_process)))
|
Sale.process(Sale.browse(list(sales_to_process)))
|
||||||
|
|
||||||
|
|
||||||
class Sale:
|
class Sale:
|
||||||
|
|
|
@ -299,6 +299,7 @@ state::
|
||||||
|
|
||||||
>>> config.user = farm_user.id
|
>>> config.user = farm_user.id
|
||||||
>>> MoveEvent = Model.get('farm.move.event')
|
>>> MoveEvent = Model.get('farm.move.event')
|
||||||
|
>>> move_event = MoveEvent(move_event.id)
|
||||||
>>> move_event.weight = Decimal('2365.0')
|
>>> move_event.weight = Decimal('2365.0')
|
||||||
>>> move_event.save()
|
>>> move_event.save()
|
||||||
>>> MoveEvent.validate_event([move_event.id], config.context)
|
>>> MoveEvent.validate_event([move_event.id], config.context)
|
||||||
|
@ -309,17 +310,19 @@ state::
|
||||||
>>> sale.reload()
|
>>> sale.reload()
|
||||||
>>> sale.shipment_state
|
>>> sale.shipment_state
|
||||||
u'sent'
|
u'sent'
|
||||||
|
>>> invoice, = sale.invoices
|
||||||
|
|
||||||
|
|
||||||
Post invoice::
|
Post invoice::
|
||||||
|
|
||||||
>>> config.user = account_user.id
|
>>> config.user = account_user.id
|
||||||
>>> Invoice = Model.get('account.invoice')
|
>>> Invoice = Model.get('account.invoice')
|
||||||
>>> Invoice.post([i.id for i in sale.invoices], config.context)
|
>>> invoice = Invoice(invoice.id)
|
||||||
|
>>> Invoice.post([invoice.id], config.context)
|
||||||
>>> config.user = sale_user.id
|
>>> config.user = sale_user.id
|
||||||
>>> sale.reload()
|
>>> sale.reload()
|
||||||
>>> len(sale.shipments), len(sale.shipment_returns), len(sale.invoices)
|
>>> len(sale.shipments), len(sale.shipment_returns), len(sale.invoices)
|
||||||
(1, 0, 1)
|
(0, 0, 1)
|
||||||
|
|
||||||
Pay invoice (TODO) and check unit price of Move event and Lot cost price is
|
Pay invoice (TODO) and check unit price of Move event and Lot cost price is
|
||||||
updated::
|
updated::
|
||||||
|
|
Loading…
Reference in a new issue