Permalink
Browse files

[FIX] account_asset: asset on refund

- Create a vendor bill with a line linked to an asset category
- Validate the bill => an asset is created
- Refund the bill

The refund is also linked to an asset category. Therefore, upon
validation, a negative asset will be created.

The refund should not be linked to the asset category in a first place.
The user should cancel/modify the asset manually.

opw-775933
  • Loading branch information...
nim-odoo committed Oct 18, 2017
1 parent 0012eb4 commit d8bc8564ccc4f7683b79eb1def3ac0bde80d9edf
Showing with 9 additions and 0 deletions.
  1. +9 −0 addons/account_asset/models/account_invoice.py
@@ -12,6 +12,15 @@
class AccountInvoice(models.Model):
_inherit = 'account.invoice'
@api.model
def _refund_cleanup_lines(self, lines):
result = super(AccountInvoice, self)._refund_cleanup_lines(lines)
for i in xrange(0, len(lines)):
for name, field in lines[i]._fields.items():
if name == 'asset_category_id':
result[i][2][name] = False
return result
@api.multi
def action_cancel(self):
res = super(AccountInvoice, self).action_cancel()

0 comments on commit d8bc856

Please sign in to comment.