mirror of
https://github.com/NaN-tic/trytond-purchase_from_openerp.git
synced 2023-12-14 03:33:01 +01:00
Fix cancel invoice+reinvoice moves
This commit is contained in:
parent
bb9e611ed4
commit
55e3ba33df
1 changed files with 18 additions and 1 deletions
19
purchase.py
19
purchase.py
|
@ -22,7 +22,7 @@ class StockMove:
|
|||
if self.from_openerp_to_invoice:
|
||||
return 0.0
|
||||
return self.quantity
|
||||
return super(StockMove, self).invoiced_quantity()
|
||||
return super(StockMove, self).invoiced_quantity
|
||||
|
||||
|
||||
class Purchase:
|
||||
|
@ -49,10 +49,27 @@ class Purchase:
|
|||
return 'paid'
|
||||
return state
|
||||
|
||||
@classmethod
|
||||
def copy(cls, purchases, default=None):
|
||||
if default is None:
|
||||
default = {}
|
||||
else:
|
||||
default = default.copy()
|
||||
default['from_openerp'] = False
|
||||
return super(Purchase, cls).copy(purchases, default=default)
|
||||
|
||||
|
||||
class PurchaseLine:
|
||||
__name__ = 'purchase.line'
|
||||
|
||||
def get_move(self):
|
||||
move = super(PurchaseLine, self).get_move()
|
||||
if move and self.purchase.from_openerp:
|
||||
move.from_openerp = True
|
||||
if self.purchase.invoice_method == 'shipment':
|
||||
move.from_openerp_to_invoice = True
|
||||
return move
|
||||
|
||||
def get_invoice_line(self, invoice_type):
|
||||
pool = Pool()
|
||||
InvoiceLine = pool.get('account.invoice.line')
|
||||
|
|
Loading…
Reference in a new issue