summaryrefslogtreecommitdiff
path: root/addons/sale/models/analytic.py
diff options
context:
space:
mode:
Diffstat (limited to 'addons/sale/models/analytic.py')
-rw-r--r--addons/sale/models/analytic.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/addons/sale/models/analytic.py b/addons/sale/models/analytic.py
index 4eeebd2f4c6..c836f337c9e 100644
--- a/addons/sale/models/analytic.py
+++ b/addons/sale/models/analytic.py
@@ -27,8 +27,8 @@ class AccountAnalyticLine(models.Model):
def write(self, values):
result = super(AccountAnalyticLine, self).write(values)
if 'so_line' not in values: # allow to force a False value for so_line
- self.sudo().filtered(lambda aal: not aal.so_line and aal.product_id and aal.product_id.expense_policy != 'no')._sale_determine_order_line()
- return result
+ # only take the AAL from expense or vendor bill, meaning having a negative amount
+ self.sudo().filtered(lambda aal: not aal.so_line and aal.product_id and aal.product_id.expense_policy != 'no' and aal.amount <= 0)._sale_determine_order_line()
# ----------------------------------------------------------
# Vendor Bill / Expense : determine the Sale Order to reinvoice