prevent do gen picking from hdcase and dlz
parent
c31cd0ce8d
commit
4326614a04
|
@ -10,6 +10,7 @@
|
||||||
<separator string="Visit"/>
|
<separator string="Visit"/>
|
||||||
<group form_layout="stacked">
|
<group form_layout="stacked">
|
||||||
<field name="find_dlz"/>
|
<field name="find_dlz"/>
|
||||||
|
<field name="picking_auto"/>
|
||||||
</group>
|
</group>
|
||||||
<separator string="HD Case"/>
|
<separator string="HD Case"/>
|
||||||
<group form_layout="stacked">
|
<group form_layout="stacked">
|
||||||
|
|
|
@ -2,4 +2,5 @@
|
||||||
#from . import repost_invoice
|
#from . import repost_invoice
|
||||||
#from . import conv_bal
|
#from . import conv_bal
|
||||||
#from . import tb_ap_import
|
#from . import tb_ap_import
|
||||||
from . import check_seq
|
#from . import check_seq
|
||||||
|
from . import del_gi
|
||||||
|
|
|
@ -0,0 +1,50 @@
|
||||||
|
import time
|
||||||
|
|
||||||
|
from netforce.model import get_model
|
||||||
|
from netforce import migration
|
||||||
|
from netforce.access import set_active_user, set_active_company
|
||||||
|
|
||||||
|
class Migration(migration.Migration):
|
||||||
|
_name="clinic.del.gi"
|
||||||
|
_version="2.12.0"
|
||||||
|
|
||||||
|
def migrate(self):
|
||||||
|
set_active_user(1)
|
||||||
|
set_active_company(1)
|
||||||
|
#fmt='%Y-%m-%d %H:%M:%S'
|
||||||
|
#datenow=time.strftime(fmt)
|
||||||
|
dom=[
|
||||||
|
['date','>=','2015-01-01 00:00:00'],
|
||||||
|
['date','<=','2015-06-30 23:59:59'],
|
||||||
|
['type','=','out'],
|
||||||
|
]
|
||||||
|
count=0
|
||||||
|
for pick in get_model('stock.picking').search_browse(dom):
|
||||||
|
print('del ', pick.date, pick.id, pick.number)
|
||||||
|
pick.delete()
|
||||||
|
count+=1
|
||||||
|
|
||||||
|
print("Delete From 2015-01-01 to 2015-06-30 Total is: ", count)
|
||||||
|
|
||||||
|
rows=open("/tmp/del_gi.csv","r").read()
|
||||||
|
ids=[]
|
||||||
|
for row in rows.split("\n"):
|
||||||
|
try:
|
||||||
|
r=row.split(",")
|
||||||
|
idtxt=r[1]
|
||||||
|
if idtxt.isnumeric():
|
||||||
|
ids.append(int(idtxt))
|
||||||
|
except Exception as e:
|
||||||
|
print("ERROR ", e)
|
||||||
|
count=0
|
||||||
|
for id in ids:
|
||||||
|
pick=get_model('stock.picking').browse(id)
|
||||||
|
try:
|
||||||
|
print('del ', pick.date, pick.id, pick.number)
|
||||||
|
pick.delete()
|
||||||
|
except Exception as e:
|
||||||
|
print("ERROR ",e)
|
||||||
|
count+=1
|
||||||
|
print("Delete from file Total: ",count)
|
||||||
|
|
||||||
|
Migration.register()
|
|
@ -117,6 +117,7 @@ class Dialyzer(Model):
|
||||||
st=get_model("clinic.setting").browse(1)
|
st=get_model("clinic.setting").browse(1)
|
||||||
stock_journal=st.stock_journal_id
|
stock_journal=st.stock_journal_id
|
||||||
|
|
||||||
|
if st.picking_auto:
|
||||||
wh_loc_id=None
|
wh_loc_id=None
|
||||||
cust_loc_id=None
|
cust_loc_id=None
|
||||||
department=obj.department_id
|
department=obj.department_id
|
||||||
|
@ -129,7 +130,6 @@ class Dialyzer(Model):
|
||||||
|
|
||||||
if not stock_journal:
|
if not stock_journal:
|
||||||
raise Exception("Not found stock journal")
|
raise Exception("Not found stock journal")
|
||||||
|
|
||||||
pick_vals={
|
pick_vals={
|
||||||
"type": "out",
|
"type": "out",
|
||||||
'journal_id': stock_journal.id,
|
'journal_id': stock_journal.id,
|
||||||
|
@ -174,6 +174,7 @@ class Dialyzer(Model):
|
||||||
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)
|
||||||
pick.set_done([pick_id])
|
pick.set_done([pick_id])
|
||||||
|
|
||||||
number=obj.number.replace("/","")
|
number=obj.number.replace("/","")
|
||||||
if not number:
|
if not number:
|
||||||
department=obj.department_id
|
department=obj.department_id
|
||||||
|
|
|
@ -757,6 +757,10 @@ class HDCase(Model):
|
||||||
})
|
})
|
||||||
|
|
||||||
def make_pickings(self,ids,context={}):
|
def make_pickings(self,ids,context={}):
|
||||||
|
st=get_model('clinic.setting').browse(1)
|
||||||
|
if not st.picking_auto:
|
||||||
|
return
|
||||||
|
|
||||||
obj=self.browse(ids[0])
|
obj=self.browse(ids[0])
|
||||||
# no picking
|
# no picking
|
||||||
if not obj.lines:
|
if not obj.lines:
|
||||||
|
|
|
@ -64,6 +64,7 @@ class ClinicSetting(Model):
|
||||||
'staff_from_id': fields.Many2One("clinic.staff","Staff From"),
|
'staff_from_id': fields.Many2One("clinic.staff","Staff From"),
|
||||||
'staff_to_id': fields.Many2One("clinic.staff","Staff To"),
|
'staff_to_id': fields.Many2One("clinic.staff","Staff To"),
|
||||||
'product_categ_view': fields.Many2Many("product.categ","Product Category View"),
|
'product_categ_view': fields.Many2Many("product.categ","Product Category View"),
|
||||||
|
'picking_auto': fields.Boolean("Picking Auto"),
|
||||||
}
|
}
|
||||||
|
|
||||||
_defaults={
|
_defaults={
|
||||||
|
|
|
@ -86,6 +86,7 @@ class VisitBoard(Model):
|
||||||
defaults=self.default_get(context=context)
|
defaults=self.default_get(context=context)
|
||||||
department_id=defaults.get("department_id",None)
|
department_id=defaults.get("department_id",None)
|
||||||
branch_id=defaults.get("branch_id",None)
|
branch_id=defaults.get("branch_id",None)
|
||||||
|
context['branch_id']=branch_id
|
||||||
state=defaults.get("state",'pending')
|
state=defaults.get("state",'pending')
|
||||||
if ids:
|
if ids:
|
||||||
obj=self.browse(ids)[0]
|
obj=self.browse(ids)[0]
|
||||||
|
@ -96,6 +97,7 @@ class VisitBoard(Model):
|
||||||
doctor_id=obj.doctor_id.id
|
doctor_id=obj.doctor_id.id
|
||||||
department_id=obj.department_id.id
|
department_id=obj.department_id.id
|
||||||
branch_id=obj.branch_id.id
|
branch_id=obj.branch_id.id
|
||||||
|
context['branch_id']=branch_id
|
||||||
state=obj.state
|
state=obj.state
|
||||||
# auto generate visit day to day
|
# auto generate visit day to day
|
||||||
def auto_gen_visit(dom=[]):
|
def auto_gen_visit(dom=[]):
|
||||||
|
@ -147,7 +149,7 @@ class VisitBoard(Model):
|
||||||
'visit_date': date_txt,
|
'visit_date': date_txt,
|
||||||
'state': 'pending',
|
'state': 'pending',
|
||||||
}
|
}
|
||||||
visit_id=get_model("clinic.visit").create(vals)
|
visit_id=get_model("clinic.visit").create(vals,context=context)
|
||||||
print('create new visit %s for %s'%(visit_id,pt.name))
|
print('create new visit %s for %s'%(visit_id,pt.name))
|
||||||
time_start='%s 00:00:00'%(date_from)
|
time_start='%s 00:00:00'%(date_from)
|
||||||
time_stop='%s 23:59:59'%(date_to)
|
time_stop='%s 23:59:59'%(date_to)
|
||||||
|
|
Loading…
Reference in New Issue