Make card_number more central for CORE API -> Rattail importers
				
					
				
			let's track that as (effectively) `Customer.corepos_card_number` and use that when possible for importer key
This commit is contained in:
		
							parent
							
								
									c1276c998a
								
							
						
					
					
						commit
						bfc52a6fb3
					
				
					 6 changed files with 179 additions and 65 deletions
				
			
		|  | @ -2,7 +2,7 @@ | |||
| ################################################################################ | ||||
| # | ||||
| #  Rattail -- Retail Software Framework | ||||
| #  Copyright © 2010-2020 Lance Edgar | ||||
| #  Copyright © 2010-2023 Lance Edgar | ||||
| # | ||||
| #  This file is part of Rattail. | ||||
| # | ||||
|  | @ -28,8 +28,8 @@ from corepos.db.office_op import model as corepos, Session as CoreSession | |||
| 
 | ||||
| from rattail.importing.handlers import FromFileHandler | ||||
| from rattail.importing.csv import FromCSVToSQLAlchemyMixin | ||||
| from rattail_corepos.corepos.importing.db.model import ToCore | ||||
| from rattail_corepos.corepos.importing.db.corepos import ToCoreHandler | ||||
| from rattail_corepos.corepos.office.importing.db.model import ToCore | ||||
| from rattail_corepos.corepos.office.importing.db.corepos import ToCoreHandler | ||||
| 
 | ||||
| 
 | ||||
| class FromCSVToCore(FromCSVToSQLAlchemyMixin, FromFileHandler, ToCoreHandler): | ||||
|  |  | |||
|  | @ -46,7 +46,9 @@ def get_core_members(config, api, progress=None): | |||
| 
 | ||||
|     # first we fetch all customer records from CORE DB | ||||
|     with app.short_session(factory=CoreSession) as s: | ||||
|         db_customers = s.query(corepos.CustData).all() | ||||
|         db_customers = s.query(corepos.CustData)\ | ||||
|                         .order_by(corepos.CustData.card_number)\ | ||||
|                         .all() | ||||
|         s.expunge_all() | ||||
| 
 | ||||
|     # now we must fetch each customer account individually from API | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Lance Edgar
						Lance Edgar