migrate picking
parent
dbf0d685c3
commit
210ddcc5a8
|
@ -9,8 +9,9 @@
|
|||
</head>
|
||||
<separator string="Visit"/>
|
||||
<group form_layout="stacked">
|
||||
<field name="find_dlz"/>
|
||||
<field name="picking_auto"/>
|
||||
<field name="find_dlz" span="3"/>
|
||||
<field name="hdcase_picking_auto" span="3"/>
|
||||
<field name="dlz_picking_auto" span="3"/>
|
||||
</group>
|
||||
<separator string="HD Case"/>
|
||||
<group form_layout="stacked">
|
||||
|
|
|
@ -3,4 +3,5 @@
|
|||
#from . import conv_bal
|
||||
#from . import tb_ap_import
|
||||
#from . import check_seq
|
||||
from . import del_gi
|
||||
#from . import del_gi
|
||||
from . import restore_picking
|
||||
|
|
|
@ -0,0 +1,33 @@
|
|||
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.restore.picking"
|
||||
_version="2.12.1"
|
||||
|
||||
def migrate(self):
|
||||
set_active_user(1)
|
||||
set_active_company(1)
|
||||
#remove all good issued from dlz
|
||||
total_del=0
|
||||
for dlz in get_model('clinic.dialyzer').search_browse([]):
|
||||
for pick in dlz.pickings:
|
||||
print('del pick ',pick.number)
|
||||
pick.delete()
|
||||
total_del+=1
|
||||
print('total delete ', total_del)
|
||||
fmt='%Y-%m-%d %H:%M:%S'
|
||||
datenow=time.strftime(fmt)
|
||||
dom=[
|
||||
['date','>=','2015-01-01'],
|
||||
['date','<=',datenow],
|
||||
]
|
||||
for hdcase in get_model("clinic.hd.case").search_browse(dom):
|
||||
if not hdcase.pickings:
|
||||
print('gen picking for %s in %s'%(hdcase.number, hdcase.date))
|
||||
hdcase.make_pickings()
|
||||
|
||||
Migration.register()
|
|
@ -117,7 +117,7 @@ class Dialyzer(Model):
|
|||
st=get_model("clinic.setting").browse(1)
|
||||
stock_journal=st.stock_journal_id
|
||||
|
||||
if st.picking_auto:
|
||||
if st.dlz_picking_auto:
|
||||
wh_loc_id=None
|
||||
cust_loc_id=None
|
||||
department=obj.department_id
|
||||
|
|
|
@ -758,14 +758,11 @@ class HDCase(Model):
|
|||
|
||||
def make_pickings(self,ids,context={}):
|
||||
st=get_model('clinic.setting').browse(1)
|
||||
if not st.picking_auto:
|
||||
if not st.hdcase_picking_auto:
|
||||
return
|
||||
|
||||
obj=self.browse(ids[0])
|
||||
# no picking
|
||||
if not obj.lines:
|
||||
return
|
||||
|
||||
patient=obj.patient_id
|
||||
partner=patient.partner_id
|
||||
if not partner:
|
||||
|
@ -777,7 +774,6 @@ class HDCase(Model):
|
|||
break
|
||||
if not ship_address_id:
|
||||
patient.simple_address()
|
||||
#raise Exception("contact %s dont'have address with type shipping"%partner.name)
|
||||
# default journal
|
||||
cust_loc_id=None
|
||||
wh_loc_id=None
|
||||
|
@ -789,7 +785,6 @@ class HDCase(Model):
|
|||
if stock_journal:
|
||||
wh_loc_id=stock_journal.location_from_id.id
|
||||
cust_loc_id=stock_journal.location_to_id.id
|
||||
print("get location from stock journal %s "%(stock_journal.name))
|
||||
pick_vals={
|
||||
"type": "out",
|
||||
'journal_id': stock_journal.id,
|
||||
|
@ -806,8 +801,6 @@ class HDCase(Model):
|
|||
if not res:
|
||||
raise Exception("Customer location not found")
|
||||
cust_loc_id=res[0]
|
||||
|
||||
#XXX
|
||||
no_lines=context.get('no_line') or False
|
||||
if no_lines:
|
||||
return
|
||||
|
@ -832,13 +825,10 @@ class HDCase(Model):
|
|||
if prod_ids and prod.id not in prod_ids or prod.id in prod_exist_ids:
|
||||
continue
|
||||
prod_exist_ids.append(prod.id)
|
||||
#XXX
|
||||
dpt_prods=get_model('clinic.department.product').get_location(obj.department_id.id,prod.id)
|
||||
if dpt_prods:
|
||||
print("get location from menu department products")
|
||||
wh_loc_id=dpt_prods.get('wh_loc_id')
|
||||
cust_loc_id=dpt_prods.get('cust_loc_id')
|
||||
#pick_vals['journal_id']=dpt_prods.get('journal_id')
|
||||
if not wh_loc_id:
|
||||
wh_loc_id=prod.location_id.id
|
||||
if wh_loc_id:
|
||||
|
|
|
@ -64,7 +64,8 @@ class ClinicSetting(Model):
|
|||
'staff_from_id': fields.Many2One("clinic.staff","Staff From"),
|
||||
'staff_to_id': fields.Many2One("clinic.staff","Staff To"),
|
||||
'product_categ_view': fields.Many2Many("product.categ","Product Category View"),
|
||||
'picking_auto': fields.Boolean("Picking Auto"),
|
||||
'hdcase_picking_auto': fields.Boolean("HDCase Auto Picking"),
|
||||
'dlz_picking_auto': fields.Boolean("DLZ Auto Picking"),
|
||||
}
|
||||
|
||||
_defaults={
|
||||
|
|
Loading…
Reference in New Issue