Membuat stock move

1. saya ingin membuat stock move ke inventory saya. setelah stock terbuat saya ingin memindahkan stock ke inventory saya yang lain dengan mengurangi stock di inventory lama, bagaimana cara menguranginya? function apa yang di gunakan?.

2. ini method saya untuk membuat ctock move

" batch_ids = set()

for itembatch in self.cullingline_ids:

if itembatch.culling_location_id and itembatch.batch_id and itembatch.total_qty_abnormal_batch > 0: location_ids.add(itembatch.culling_location_id) batch_ids.add(itembatch.batch_id)

for locationbatch in batch_ids: qty_total_cullingbatch = 0 trash = self.env['estate.nursery.cullinglinebatch'].search([('batch_id', '=', locationbatch.id), ('culling_id', '=', self.id)])

for i in trash: qty_total_cullingbatch = i.total_qty_abnormal_batch

move_data = { 'product_id': itembatch.product_id.id,

'product_uom_qty': itembatch.total_qty_abnormal_batch,

'product_uom': itembatch.product_id.uom_id.id,

'name': 'Culling Abnormal Kecambah for %s:'%(self.culling_code),

'date_expected': self.culling_date,

'location_id': itembatch.culling_location_id.id,

'location_dest_id': self.location_type.id,

'state': 'confirmed', # set to done if no approval required

'restrict_lot_id': itembatch.lot_id.id # required by check tracking product }

move = self.env['stock.move'].create(move_data)

move.action_confirm()

move.action_done()

return True"

dengan fungsi yang saya buat saya hanya dapat menambahkan stock ke inventory, tapi tidak mengurangi stock yang lama. bagamana cara pengurangan stocknya?

mahroza pradana
mahroza pradana
4
| 0 1 1
Asked on 1/25/16, 6:44 AM
0
vote
1079 Views

Your answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

Buat Pertanyaan

Ikuti Berita

Tujuan Forum

Forum ini bertujuan untuk membahas masalah teknikal Odoo

Baca Panduan

Question tools

6 follower(s)

Stats

Asked: 1/25/16, 6:44 AM
Seen: 1079 times
Last updated: 1/25/16, 6:44 AM