[POS-commit] r7078 - stoqlib/trunk/stoqlib/domain
Johan Dahlin
jdahlin at async.com.br
Fri Aug 3 13:01:04 BRT 2007
Author: jdahlin
Date: Fri Aug 3 13:01:04 2007
New Revision: 7078
Modified:
stoqlib/trunk/stoqlib/domain/person.py
stoqlib/trunk/stoqlib/domain/product.py
Log:
It's not necessary to create stock items manually for a branch if they don't exist, they're created on the fly when adding the stock
Modified: stoqlib/trunk/stoqlib/domain/person.py
==============================================================================
--- stoqlib/trunk/stoqlib/domain/person.py (original)
+++ stoqlib/trunk/stoqlib/domain/person.py Fri Aug 3 13:01:04 2007
@@ -327,13 +327,9 @@
return adapter_klass(self, **kwargs)
def facet_IBranch_add(self, **kwargs):
- from stoqlib.domain.product import storables_set_branch
ICompany(self)
adapter_klass = self.getAdapterClass(IBranch)
branch = adapter_klass(self, **kwargs)
- # XXX I'm not sure yet if this is the right place to update stocks
- # probably a hook called inside commit could be better...
- storables_set_branch(self._connection, branch)
return branch
def facet_ISalesPerson_add(self, **kwargs):
Modified: stoqlib/trunk/stoqlib/domain/product.py
==============================================================================
--- stoqlib/trunk/stoqlib/domain/product.py (original)
+++ stoqlib/trunk/stoqlib/domain/product.py Fri Aug 3 13:01:04 2007
@@ -415,15 +415,3 @@
connection=self.get_connection())
Product.registerFacet(ProductAdaptToStorable, IStorable)
-
-#
-# Auxiliary functions
-#
-
-
-def storables_set_branch(conn, branch):
- """A method that must be called always when a new branch company is
- created. It creates a new stock reference for all the products.
- """
- for storable in ProductAdaptToStorable.select(connection=conn):
- storable._add_stock_item(branch)
More information about the POS-commit
mailing list