| 
						
						
							
								
							
						
						
					 | 
				
				 | 
				
					@ -5,24 +5,55 @@ import logging | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					from werkzeug import utils | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import re | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					_logger = logging.getLogger(__name__) | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import json | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					class AccountMove(models.Model): | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    _inherit = 'account.move' | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    def write(self,vals): | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            res=super(AccountMove, self).write(vals) | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					             | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            m=self.env['kalachakra.membership'].sudo().search([('invoice_id','=',int(self.id))]) | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					             | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            if m: | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                if self.payment_state == 'not_paid': | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    m.payment_state='not paid' | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    m.state='draft' | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                else: | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    m.payment_state='paid' | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    m.state='done' | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                _logger.error("errK2"+str(m.payment_state)) | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					             | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            return res | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					             | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    description=fields.Char(compute='_compute_description') | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    transaction_date=fields.Datetime(compute='_compute_transaction_date') | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    transaction_amount=fields.Float(compute='_compute_transaction_amount') | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    systempay_ref=fields.Text(compute='_compute_systempay_ref') | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    def _compute_description(self): | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					         | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        for a in self: | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            description='' | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            for line in a.line_ids: | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    a.description=line.product_id.name | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    break | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					     | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    def _compute_transaction_date(self): | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					         | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        for a in self: | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            a.transaction_date=False | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            for t in a.transaction_ids: | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    a.transaction_date=t.date | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    break | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    def _compute_transaction_amount(self): | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					         | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        for a in self: | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            a.transaction_amount=False | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            for t in a.transaction_ids: | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    a.transaction_amount=t.amount | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    break | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    def _compute_systempay_ref(self): | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					         | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        for a in self: | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            a.systempay_ref=False | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            for t in a.transaction_ids: | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    if t.systempay_raw_data: | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                        raw1=t.systempay_raw_data.split(",") | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                        vads_order_id_s=raw1[21].split(":") | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                        # raw1=raw1.replace("\r", "") | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                        # raw1=raw1.replace("'","\"") | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                        # raise Warning(raw1) | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                        # raw=json.loads(raw1) | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                         | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                        a.systempay_ref=vads_order_id_s[1].replace("'","") | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    break | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                 |