pass branch_id to get the right number of GI

stable
watcha.h 2016-02-24 17:49:42 +07:00
parent 464470f2af
commit b9f8fbdd46
4 changed files with 36 additions and 5 deletions

View File

@ -14,8 +14,8 @@
<field name="account_products" nolabel="1"> <field name="account_products" nolabel="1">
<list> <list>
<field name="patient_type_id"/> <field name="patient_type_id"/>
<field name="ar_debit_id"/> <field name="ar_debit_id" domain='[["type","!=","view"]]'/>
<field name="ar_credit_id"/> <field name="ar_credit_id" domain='[["type","!=","view"]]'/>
<field name="type"/> <field name="type"/>
</list> </list>
</field> </field>

View File

@ -7,5 +7,6 @@
#from . import restore_picking #from . import restore_picking
#from . import rename_dbl_hdcase_number #from . import rename_dbl_hdcase_number
#from . import reset_hdcase_number #from . import reset_hdcase_number
from . import remove_dbl_contact #from . import remove_dbl_contact
from . import update_invoice #from . import update_invoice
from . import update_pick_out_number

View File

@ -0,0 +1,29 @@
from netforce.model import get_model
from netforce import migration
from netforce.access import set_active_user, set_active_company
from netforce.database import get_connection
class Migration(migration.Migration):
_name="clinic.update.pick.out.number"
_version="2.12.5"
def migrate(self):
set_active_company(1)
set_active_user(1)
db=get_connection()
count=0
for pick in get_model('stock.picking').search_browse([]):
journal=pick.journal_id
sequence=journal.sequence_id
branch=sequence.branch_id
prefix=sequence.prefix
if prefix not in pick.number:
new_number=pick.number.replace(pick.number[0:6],prefix)
pick.write({
'number': new_number,
})
count+=1
print("update %s to %s"%(pick.number, new_number))
print("total ", count)
Migration.register()

View File

@ -866,7 +866,8 @@ 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 'date': obj.date,
'branch_id': obj.branch_id.id,
} }
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)