Reviewers: bch_b2ck.com,


Please review this at http://codereview.appspot.com/116100

Affected files:
   M sale.py


Index: sale.py
===================================================================
--- a/sale.py
+++ b/sale.py
@@ -1932,3 +1932,32 @@
                  'invoice_ok', context=context)

  HandleInvoiceException()
+
+
+class WorkflowTrigger(ModelSQL, ModelView):
+    _name = 'workflow.trigger'
+
+    def search(self, cursor, user, domain, offset=0, limit=None,  
order=None,
+            context=None, count=False):
+        domain = domain[:]
+
+        def process(domain):
+            i = 0
+            while i < len(domain):
+                if isinstance(domain[i], list):
+                    domain[i] = process(domain[i])
+                if isinstance(domain[i], tuple):
+                    if domain[i][0] == 'trigger_model':
+                        if domain[i][2] == 'account.invoice':
+                            domain[i] = ['OR', domain[i], domain[i][:]]
+                            domain[i][2][2] = 'accont.invoice'
+                        elif isinstance(domain[i][2], list) \
+                                and 'account.invoice' in domain[i][2]:
+                            domain[i][2].append('accont.invoice')
+                i += 1
+            return domain
+        return super(WorkflowTrigger, self).search(cursor, user,
+                process(domain), offset=offset, limit=limit, order=order,
+                context=context, count=count)
+
+WorkflowTrigger()



--~--~---------~--~----~------------~-------~--~----~
[email protected] mailing list
-~----------~----~----~----~------~----~------~--~---

Reply via email to