Link backorder moves with existing invoices lines on order shipment method
issue7022 review36921002
This commit is contained in:
1 parent
23e8c66cd3
commit
d64a73479a
2 files changed
+44
-1
No files matched your search
+4
-1
@@ -1551,7 +1551,10 @@ class PurchaseLine(sequence_ordered(), ModelSQL, ModelView):
|
||||
|
||||
def _get_move_invoice_lines(self, move_type):
|
||||
'Return the invoice lines that should be shipped'
|
||||
return [l for l in self.invoice_lines if not l.stock_moves]
|
||||
if self.purchase.invoice_method == 'order':
|
||||
return [l for l in self.invoice_lines]
|
||||
else:
|
||||
return [l for l in self.invoice_lines if not l.stock_moves]
|
||||
|
||||
def get_rec_name(self, name):
|
||||
if self.product:
|
||||
|
||||
@@ -548,6 +548,46 @@ linked to invoices::
|
||||
>>> stock_move.state
|
||||
u'done'
|
||||
|
||||
Create a purchase to be invoiced on order, partially send it and check
|
||||
correctly linked to invoices::
|
||||
|
||||
>>> purchase = Purchase()
|
||||
>>> purchase.party = supplier
|
||||
>>> purchase.payment_term = payment_term
|
||||
>>> purchase.invoice_method = 'order'
|
||||
>>> line = purchase.lines.new()
|
||||
>>> line.product = product
|
||||
>>> line.quantity = 10.0
|
||||
>>> purchase.click('quote')
|
||||
>>> purchase.click('confirm')
|
||||
>>> purchase.click('process')
|
||||
>>> shipment = ShipmentIn()
|
||||
>>> shipment.supplier = supplier
|
||||
>>> for move in purchase.moves:
|
||||
... incoming_move = Move(id=move.id)
|
||||
... incoming_move.quantity = 8.0
|
||||
... shipment.incoming_moves.append(incoming_move)
|
||||
>>> shipment.save()
|
||||
>>> for move in shipment.inventory_moves:
|
||||
... move.quantity = 8.0
|
||||
>>> shipment.click('receive')
|
||||
>>> shipment.click('done')
|
||||
>>> purchase.reload()
|
||||
>>> invoice, = purchase.invoices
|
||||
>>> invoice_line, = invoice.lines
|
||||
>>> invoice_line.quantity
|
||||
10.0
|
||||
>>> draft_stock_move, stock_move = sorted(
|
||||
... invoice_line.stock_moves, key=lambda m: m.quantity)
|
||||
>>> draft_stock_move.quantity
|
||||
2.0
|
||||
>>> draft_stock_move.state
|
||||
u'draft'
|
||||
>>> stock_move.quantity
|
||||
8.0
|
||||
>>> stock_move.state
|
||||
u'done'
|
||||
|
||||
Deleting a line from a invoice should recreate it::
|
||||
|
||||
>>> purchase = Purchase()
|
||||
|
||||
Reference in new issue
Block a user