Create commission only the first time invoice is posted

The invoice can go back to posted state when paid if the payment is
unreconciled.

issue4682
review12071002
This commit is contained in:
Cédric Krier committed 2015-03-31 10:03:28 +02:00
1 parent f46ae7020d
commit ed5b129685
1 file changed
+4 -1
+4 -1
View File
@@ -29,8 +29,11 @@ class Invoice:
@ModelView.button
@Workflow.transition('posted')
def post(cls, invoices):
# Create commission only the first time the invoice is posted
to_commission = [i for i in invoices
if i.state not in ['posted', 'paid']]
super(Invoice, cls).post(invoices)
cls.create_commissions(invoices)
cls.create_commissions(to_commission)
@classmethod
def create_commissions(cls, invoices):