Merge branch 'fix_acc' of dev.netforce.com:netforce-customized/clinic into fix_acc
commit
3987ee2b8b
|
@ -1,3 +1,3 @@
|
||||||
from . import clinic_setting
|
#from . import clinic_setting
|
||||||
#from . import conv_bal
|
from . import conv_bal
|
||||||
from . import repost_invoice
|
#from . import repost_invoice
|
||||||
|
|
|
@ -22,12 +22,18 @@ class Migration(migration.Migration):
|
||||||
get_model("conv.bal").import_acc_file([cbv.id],context={})
|
get_model("conv.bal").import_acc_file([cbv.id],context={})
|
||||||
get_model("conv.bal").import_acc([cbv.id],context={})
|
get_model("conv.bal").import_acc([cbv.id],context={})
|
||||||
|
|
||||||
|
print("import sale file (step 2)running ...")
|
||||||
|
del_ids=get_model("conv.sale.invoice").search([["conv_id","=",cbv.id]])
|
||||||
|
get_model('conv.sale.invoice').delete(del_ids)
|
||||||
|
for ar_file in ['ar_fee','ar_epo','ar_srv','ar_other']:
|
||||||
cbv.write({
|
cbv.write({
|
||||||
'date_fmt': '%d/%m/%Y',
|
'date_fmt': '%d/%m/%Y',
|
||||||
'file': 'ar.csv',
|
'file': '%s.csv'%(ar_file),
|
||||||
})
|
})
|
||||||
print("import sale file (step 2)running ...")
|
ctx={
|
||||||
get_model("conv.bal").import_sale_file([cbv.id],context={})
|
'is_append': True,
|
||||||
|
}
|
||||||
|
get_model("conv.bal").import_sale_file([cbv.id],context=ctx)
|
||||||
get_model("conv.bal").import_sale([cbv.id],context={})
|
get_model("conv.bal").import_sale([cbv.id],context={})
|
||||||
|
|
||||||
print("import purch file (step 3) running ...")
|
print("import purch file (step 3) running ...")
|
||||||
|
|
|
@ -18,7 +18,17 @@ class Migration(migration.Migration):
|
||||||
for hdcase in get_model('clinic.hd.case').search_browse(dom):
|
for hdcase in get_model('clinic.hd.case').search_browse(dom):
|
||||||
reset=False
|
reset=False
|
||||||
for inv in hdcase.invoices:
|
for inv in hdcase.invoices:
|
||||||
if inv.state=='waiting_payment':
|
if inv.state=='paid':
|
||||||
|
inv.write({
|
||||||
|
'state': 'waiting_payment',
|
||||||
|
})
|
||||||
|
for pm_line in get_model("account.payment.line").search_browse([['invoice_id','=',inv.id]]):
|
||||||
|
pm=pm_line.payment_id
|
||||||
|
pm.to_draft()
|
||||||
|
pm.delete()
|
||||||
|
inv.to_draft()
|
||||||
|
inv.delete()
|
||||||
|
elif inv.state=='waiting_payment':
|
||||||
inv.to_draft()
|
inv.to_draft()
|
||||||
inv.delete()
|
inv.delete()
|
||||||
reset=True
|
reset=True
|
||||||
|
@ -29,12 +39,22 @@ class Migration(migration.Migration):
|
||||||
'state': 'draft',
|
'state': 'draft',
|
||||||
})
|
})
|
||||||
ids=list(hdcase_ids)
|
ids=list(hdcase_ids)
|
||||||
for hdcase in get_model('clinic.hd.case').browse(ids):
|
|
||||||
|
for seq in get_model("sequence").search_browse([['type','in',['cust_invoice','clinic_invoice_noclaim']]]):
|
||||||
|
for run in seq.running:
|
||||||
|
run.delete()
|
||||||
|
dom2=[
|
||||||
|
['date','>=','2015-07-01'],
|
||||||
|
['state','=','waiting_payment'],
|
||||||
|
]
|
||||||
|
#for hdcase in get_model('clinic.hd.case').browse(ids):
|
||||||
|
for hdcase in get_model('clinic.hd.case').search_browse(dom2):
|
||||||
print('remake_invoice ---> ', hdcase.number)
|
print('remake_invoice ---> ', hdcase.number)
|
||||||
ctx={
|
ctx={
|
||||||
'is_migrate': True,
|
'is_migrate': True,
|
||||||
}
|
}
|
||||||
hdcase.make_invoices(context=ctx)
|
hdcase.make_invoices(context=ctx)
|
||||||
|
hdcase.post_invoices()
|
||||||
print("Done!")
|
print("Done!")
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
|
@ -54,7 +54,7 @@ class ConvBal(Model):
|
||||||
else:
|
else:
|
||||||
get_model("account.invoice").create(vals)
|
get_model("account.invoice").create(vals)
|
||||||
|
|
||||||
def import_sale_file(self,ids,context):
|
def _import_sale_file(self,ids,context):
|
||||||
obj=self.browse(ids)[0]
|
obj=self.browse(ids)[0]
|
||||||
path=get_file_path(obj.file)
|
path=get_file_path(obj.file)
|
||||||
data=open(path).read()
|
data=open(path).read()
|
||||||
|
|
|
@ -559,6 +559,7 @@ class HDCase(Model):
|
||||||
context={
|
context={
|
||||||
'type': 'in',
|
'type': 'in',
|
||||||
'branch_id': obj.branch_id.id,
|
'branch_id': obj.branch_id.id,
|
||||||
|
'date': obj.date,
|
||||||
}
|
}
|
||||||
payment_id=get_model("account.payment").create(vals,context=context)
|
payment_id=get_model("account.payment").create(vals,context=context)
|
||||||
obj.write({
|
obj.write({
|
||||||
|
@ -714,6 +715,7 @@ class HDCase(Model):
|
||||||
'account_id':account_receiveable_id ,
|
'account_id':account_receiveable_id ,
|
||||||
'lines':lines,
|
'lines':lines,
|
||||||
}
|
}
|
||||||
|
context['date']=obj.date
|
||||||
inv_id=get_model("account.invoice").create(vals,context=context)
|
inv_id=get_model("account.invoice").create(vals,context=context)
|
||||||
inv=get_model("account.invoice").browse(inv_id)
|
inv=get_model("account.invoice").browse(inv_id)
|
||||||
|
|
||||||
|
@ -726,6 +728,7 @@ class HDCase(Model):
|
||||||
|
|
||||||
invoices=group_invoice_line(normb_lines)
|
invoices=group_invoice_line(normb_lines)
|
||||||
for account_receiveable_id, lines in invoices.items():
|
for account_receiveable_id, lines in invoices.items():
|
||||||
|
context['date']=obj.date
|
||||||
number=self._get_number_invoice_noclaim(context=context)
|
number=self._get_number_invoice_noclaim(context=context)
|
||||||
vals={
|
vals={
|
||||||
'number': number,
|
'number': number,
|
||||||
|
@ -855,6 +858,7 @@ class HDCase(Model):
|
||||||
context={
|
context={
|
||||||
'pick_type': 'out',
|
'pick_type': 'out',
|
||||||
'journal_id': pick_vals['journal_id'],
|
'journal_id': pick_vals['journal_id'],
|
||||||
|
'date': obj.date
|
||||||
}
|
}
|
||||||
pick_id=picking_obj.create(pick_vals,context=context)
|
pick_id=picking_obj.create(pick_vals,context=context)
|
||||||
pick=picking_obj.browse(pick_id)
|
pick=picking_obj.browse(pick_id)
|
||||||
|
@ -878,6 +882,7 @@ class HDCase(Model):
|
||||||
}
|
}
|
||||||
if obj.number=='/':
|
if obj.number=='/':
|
||||||
context['branch_id']=obj.branch_id.id
|
context['branch_id']=obj.branch_id.id
|
||||||
|
context['date']=obj.date
|
||||||
number=self._get_number(context=context)
|
number=self._get_number(context=context)
|
||||||
vals['number']=number
|
vals['number']=number
|
||||||
|
|
||||||
|
|
|
@ -345,6 +345,7 @@ class Shop(Model):
|
||||||
return invoice_vals
|
return invoice_vals
|
||||||
invoices=group_invoice_line(inv_lines)
|
invoices=group_invoice_line(inv_lines)
|
||||||
for account_receiveable_id, lines in invoices.items():
|
for account_receiveable_id, lines in invoices.items():
|
||||||
|
context['date']=obj.date
|
||||||
number=self._get_credit_number(context=context),
|
number=self._get_credit_number(context=context),
|
||||||
vals={
|
vals={
|
||||||
'number': number,
|
'number': number,
|
||||||
|
@ -445,6 +446,7 @@ class Shop(Model):
|
||||||
'pick_type': 'out',
|
'pick_type': 'out',
|
||||||
'journal_id': pick_vals['journal_id'],
|
'journal_id': pick_vals['journal_id'],
|
||||||
'branch_id': obj.branch_id.id,
|
'branch_id': obj.branch_id.id,
|
||||||
|
'date': obj.date,
|
||||||
}
|
}
|
||||||
pick_id=picking_obj.create(pick_vals,context=context)
|
pick_id=picking_obj.create(pick_vals,context=context)
|
||||||
pick=picking_obj.browse(pick_id)
|
pick=picking_obj.browse(pick_id)
|
||||||
|
@ -463,6 +465,7 @@ class Shop(Model):
|
||||||
raise Exception("No Income Account")
|
raise Exception("No Income Account")
|
||||||
company_id=get_active_company()
|
company_id=get_active_company()
|
||||||
context['branch_id']=obj.branch_id.id
|
context['branch_id']=obj.branch_id.id
|
||||||
|
context['date']=obj.date
|
||||||
number=self._get_cash_number(context=context),
|
number=self._get_cash_number(context=context),
|
||||||
vals={
|
vals={
|
||||||
'number': number,
|
'number': number,
|
||||||
|
@ -500,6 +503,7 @@ class Shop(Model):
|
||||||
context={
|
context={
|
||||||
'type': 'in',
|
'type': 'in',
|
||||||
'branch_id': obj.branch_id.id,
|
'branch_id': obj.branch_id.id,
|
||||||
|
'date': obj.date,
|
||||||
}
|
}
|
||||||
payment_id=get_model("account.payment").create(vals,context=context)
|
payment_id=get_model("account.payment").create(vals,context=context)
|
||||||
payment=get_model('account.payment').browse(payment_id)
|
payment=get_model('account.payment').browse(payment_id)
|
||||||
|
|
Loading…
Reference in New Issue