diff --git a/models/account_move.py b/models/account_move.py
index a3bb1e4..a6f57b0 100755
--- a/models/account_move.py
+++ b/models/account_move.py
@@ -15,13 +15,15 @@ class AccountMove(models.Model):
transaction_amount=fields.Float(compute='_compute_transaction_amount')
systempay_ref=fields.Text(compute='_compute_systempay_ref')
date_compta=fields.Datetime('date import',default=False)
+ date_compta_end_of_stay=fields.Datetime('date import',default=False)
date_compta_out_refund=fields.Datetime('date import',default=False)
out_invoice_id=fields.Many2one('account.move' ,ondelete="cascade",domain="[('partner_id','=',partner_id),('move_type','=','out_invoice'),('state','!=','paid')]")
def _compute_description(self):
for a in self:
- description=''
+
+ a.description=''
for line in a.line_ids:
a.description=line.product_id.name
break
@@ -55,5 +57,23 @@ class AccountMove(models.Model):
if r_s[0]==" 'vads_order_id'":
a.systempay_ref=r_s[1].replace("'","")
break
+ def button_event_registration(self):
+ reg=self.env['event.registration'].search(['|','|','|',('invoice_id','=',self.id),\
+ ('down_payment_invoice_id','=',self.id),\
+ ('balance_invoice_id','=',self.id),\
+ ('end_of_stay_invoice_id','=',self.id)])
+
+ if reg :
+ event_id=reg.event_id
+ action=self.env.ref('event.action_registration').read()[0]
+ action.update({
+ 'view_mode': 'form',
+ 'res_id': reg.id,
+ 'view_type':'form',
+ "views": [[False, "form"]],
+
+
+ })
+ return action
diff --git a/views/account.xml b/views/account.xml
index a772215..44dfd45 100644
--- a/views/account.xml
+++ b/views/account.xml
@@ -36,6 +36,9 @@
+
+
+
diff --git a/wizard/accounting_file_wizard.py b/wizard/accounting_file_wizard.py
index 5dc05c9..93b4de4 100644
--- a/wizard/accounting_file_wizard.py
+++ b/wizard/accounting_file_wizard.py
@@ -12,14 +12,14 @@ code_journal='IN'
date_compta=fields.datetime.now()
total_debit=total_credit=0
no_mvt=1
-debug=True
+
class AccountingFileWizard(models.TransientModel):
_name = 'accounting.file.wizard'
_description = 'accounting file wizard'
start_date=fields.Datetime('start date',required=True,default=lambda self: self._compute_start_date())
-
+ debug_mode=fields.Boolean('debug mode',default=True)
def _compute_start_date(self):
date_max=[]
#recherche de la date d'export d'écriture la plus récente
@@ -100,6 +100,7 @@ class AccountingFileWizard(models.TransientModel):
self.event_lines(f)
self.booking_event_lines(f)
self.out_refund_lines(f)
+ self.end_of_stay_lines(f)
fic_line="TOTAL_DEBIT="+str(total_debit)+ " TOTAL CREDIT="+str(total_credit)
f.write(fic_line)
@@ -128,38 +129,7 @@ class AccountingFileWizard(models.TransientModel):
}
- #rajouter en fin de fichier un total DEBIT et un total CREDIT
-
- f.close
-
- #création de l'export en base
- vals={}
-
-
- f = open(filename, "r")
- data = str.encode(f.read(), 'utf-8')
-
- vals['accounting_file']=base64.encodebytes(data)
- vals['document_fname']='export_comptable.csv'
- vals['exported_date']=fields.Date.context_today(self)
- res=self.env['accounting.file'].create(vals)
-
- f.close
- os.unlink(filename)
-
- #affichage de l'export
- return {
- 'name': 'Account file form',
- 'view_type': 'form',
- 'view_mode': 'form',
- 'res_model': 'accounting.file',
- 'res_id': int(res.id),
- 'type': 'ir.actions.act_window',
- 'target': 'current'
- }
-
- return True
def donation_lines(self,f):
global total_debit
global total_credit
@@ -179,7 +149,7 @@ class AccountingFileWizard(models.TransientModel):
#on ne prend pas en compte les dons liés à une retraite
#car traité avec les retraites
if d.invoice_id: continue
- if not debug: d.date_compta=date_compta
+ if not self.debug_mode: d.date_compta=date_compta
#if not d.payment_mode_id: raise UserError(_("no payment mode found for donation %r ",donation.number))
#if not d.payment_mode_id.fixed_journal_id: raise UserError(_("no account found for payment mode %r",d.payment_mode_id.name))
account_debit_number=self._file_format(str(d.payment_mode_id.fixed_journal_id.default_account_id.code),6)
@@ -237,7 +207,7 @@ class AccountingFileWizard(models.TransientModel):
for m in membership:
if datetime(m.start_date.year,m.start_date.month,m.start_date.day)=self.start_date:
return True
diff --git a/wizard/accounting_file_wizard.xml b/wizard/accounting_file_wizard.xml
index 837ea46..7e4119f 100644
--- a/wizard/accounting_file_wizard.xml
+++ b/wizard/accounting_file_wizard.xml
@@ -6,6 +6,7 @@