[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
This commit is contained in:
Nicolas Martinelli
2017-10-19 09:26:44 +02:00
parent 3f3e41e9f5
commit 4f921d668a
@@ -12,6 +12,16 @@ import odoo.addons.decimal_precision as dp
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, line in enumerate(lines):
for name, field in line._fields.items():
if name == 'asset_category_id':
result[i][2][name] = False
break
return result
@api.multi
def action_cancel(self):
res = super(AccountInvoice, self).action_cancel()