Skip to content

Commit

Permalink
Now it insert new address
Browse files Browse the repository at this point in the history
  • Loading branch information
tuxskar committed Mar 25, 2013
1 parent 7f9c825 commit 2bad45a
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
7 changes: 7 additions & 0 deletions ordenley/db/db_manager.py
Expand Up @@ -130,8 +130,15 @@ def get_address_columns(self):

def insert(self, a):
"""Method to insert a new address a """
if a.id != None:
a.id = None
print "clientes de a "
print a.clients
for c in a.clients:
self.insert_address_to_client(c,a)
self.session.add(a)
self.session.commit()
print "hecho"

def modify(self, a, b_id):
"""Method to modify the address _a_ using the _b_ address instead"""
Expand Down
7 changes: 4 additions & 3 deletions ordenley/views/client.py
Expand Up @@ -138,6 +138,7 @@ def save_apply(self, apply_button):
#to add new address
for n in self.to_new_add:
a = self.get_address_from_page(n)
a.clients.append(self.client)
self.controller.client_returned_values("address","new",a,None)
for mod in self.to_modify_add:
a = self.get_address_from_page_with_id(mod)
Expand Down Expand Up @@ -312,7 +313,7 @@ def new_address(self, widget_button):
return None
else:
n_pages = self.address_notebook.get_n_pages()
self.to_new_add.append(n_pages)
#self.to_new_add.append(n_pages)
add_v = self.add_address_tab(add=None, num=n_pages)
current = self.address_notebook.get_current_page()
#get focus on the just inserted tab
Expand Down Expand Up @@ -431,11 +432,11 @@ def create_pack(self, address=None):
if address != None:
self.add_id = address.id
self.street_entry.set_text(_None_to_str(address.street))
self.street_number_entry.set_text(_None_to_str(str(address.number)))
self.street_number_entry.set_text(_None_to_str(address.number))
self.city_entry.set_text(_None_to_str(address.city))
self.state_entry.set_text(_None_to_str(address.state))
self.country_entry.set_text(_None_to_str(address.country))
self.postal_code_entry.set_text(_None_to_str(str(address.postal_code)))
self.postal_code_entry.set_text(_None_to_str(address.postal_code))
self.id_address_label.set_text(str(address.id))
vbox.show_all()
if not debbuging:
Expand Down

0 comments on commit 2bad45a

Please sign in to comment.