Merge lp:~inddiana/sisb/josbel-sisb-fix-stock-journal into lp:sisb

Proposed by Josbel Caraballo
Status: Work in progress
Proposed branch: lp:~inddiana/sisb/josbel-sisb-fix-stock-journal
Merge into: lp:sisb
Diff against target: 102 lines (+81/-0)
4 files modified
sisb_fix_stock_journal/__init__.py (+2/-0)
sisb_fix_stock_journal/__openerp__.py (+20/-0)
sisb_fix_stock_journal/model/__init__.py (+2/-0)
sisb_fix_stock_journal/model/stock_move.py (+57/-0)
To merge this branch: bzr merge lp:~inddiana/sisb/josbel-sisb-fix-stock-journal
Reviewer Review Type Date Requested Status
Aristóbulo Meneses (community) Needs Fixing
[SISB] Edgar Rivero Pending
Review via email: mp+106008@code.launchpad.net

Description of the change

[ADD] Inserta el numero correlativo al diario
de inventario, en el 'name' de los asientos contables,
al procesarse un albaran.

To post a comment you must log in.
Revision history for this message
Aristóbulo Meneses (aristobulo) wrote :

Concatenar la referencia/descripción del albarán junto a la secuencia que corresponde.

Ej. [INVT-000001] Albarán: IN/0000532

review: Needs Fixing

Unmerged revisions

207. By Josbel Caraballo

[ADD] Inserta el numero correlativo al diario
de inventario, en el 'name' de los asientos contables,
al procesarse un albaran.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== added directory 'sisb_fix_stock_journal'
=== added file 'sisb_fix_stock_journal/__init__.py'
--- sisb_fix_stock_journal/__init__.py 1970-01-01 00:00:00 +0000
+++ sisb_fix_stock_journal/__init__.py 2012-05-16 15:45:23 +0000
@@ -0,0 +1,2 @@
1# -*- coding: utf-8 -*-
2import model
03
=== added file 'sisb_fix_stock_journal/__openerp__.py'
--- sisb_fix_stock_journal/__openerp__.py 1970-01-01 00:00:00 +0000
+++ sisb_fix_stock_journal/__openerp__.py 2012-05-16 15:45:23 +0000
@@ -0,0 +1,20 @@
1# -*- coding: utf-8 -*-
2{
3 'name' : 'SISB Fix Stock Journal',
4 'version' : '0.1',
5 'author' : 'Industrias Diana, C.A. <sisb@industriasdiana.gob.ve>',
6 'description' : """
7 Inserta el numero correlativo al diario
8 de inventario, en el 'name' de los asientos contables,
9 al procesarse un albaran.
10 """,
11 'category' : 'accounting',
12 'website' : 'www.industriasdiana.gob.ve',
13 'depends' : ['account','stock'],
14 'update_xml' : [
15 ],
16 'active' : False,
17 'installable' : True,
18 'data' : [],
19
20}
021
=== added directory 'sisb_fix_stock_journal/model'
=== added file 'sisb_fix_stock_journal/model/__init__.py'
--- sisb_fix_stock_journal/model/__init__.py 1970-01-01 00:00:00 +0000
+++ sisb_fix_stock_journal/model/__init__.py 2012-05-16 15:45:23 +0000
@@ -0,0 +1,2 @@
1# -*- coding: utf-8 -*-
2import stock_move
03
=== added file 'sisb_fix_stock_journal/model/stock_move.py'
--- sisb_fix_stock_journal/model/stock_move.py 1970-01-01 00:00:00 +0000
+++ sisb_fix_stock_journal/model/stock_move.py 2012-05-16 15:45:23 +0000
@@ -0,0 +1,57 @@
1# -*- coding: utf-8 -*-
2from osv import osv, fields
3import netsvc
4import pooler
5from tools.translate import _
6
7class stock_move(osv.osv):
8
9 _inherit = "stock.move"
10
11 def _create_product_valuation_moves(self, cr, uid, move, context=None):
12 """
13 Generate the appropriate accounting moves if the product being moves is subject
14 to real_time valuation tracking, and the source or destination location is
15 a transit location or is outside of the company.
16 """
17
18 if move.product_id.valuation == 'real_time': # FIXME: product valuation should perhaps be a property?
19 if context is None:
20 context = {}
21 src_company_ctx = dict(context,force_company=move.location_id.company_id.id)
22 dest_company_ctx = dict(context,force_company=move.location_dest_id.company_id.id)
23 account_moves = []
24 # Outgoing moves (or cross-company output part)
25 if move.location_id.company_id \
26 and (move.location_id.usage == 'internal' and move.location_dest_id.usage != 'internal'\
27 or move.location_id.company_id != move.location_dest_id.company_id):
28 journal_id, acc_src, acc_dest, acc_variation = self._get_accounting_data_for_valuation(cr, uid, move, src_company_ctx)
29 reference_amount, reference_currency_id = self._get_reference_accounting_values_for_valuation(cr, uid, move, src_company_ctx)
30 account_moves += [(journal_id, self._create_account_move_line(cr, uid, move, acc_variation, acc_dest, reference_amount, reference_currency_id, context))]
31
32 # Incoming moves (or cross-company input part)
33 if move.location_dest_id.company_id \
34 and (move.location_id.usage != 'internal' and move.location_dest_id.usage == 'internal'\
35 or move.location_id.company_id != move.location_dest_id.company_id):
36 journal_id, acc_src, acc_dest, acc_variation = self._get_accounting_data_for_valuation(cr, uid, move, dest_company_ctx)
37 reference_amount, reference_currency_id = self._get_reference_accounting_values_for_valuation(cr, uid, move, src_company_ctx)
38 account_moves += [(journal_id, self._create_account_move_line(cr, uid, move, acc_src, acc_variation, reference_amount, reference_currency_id, context))]
39
40 obj_sequence = self.pool.get('ir.sequence')
41 move_obj = self.pool.get('account.move')
42 ids_account_moves = []
43 for j_id, move_lines in account_moves:
44 id_acc_move = move_obj.create(cr, uid,
45 {'name': move.name,
46 'journal_id': j_id,
47 'line_id': move_lines,
48 'ref': move.picking_id and move.picking_id.name})
49 ids_account_moves.append(id_acc_move)
50 acc_moves = move_obj.browse(cr,uid,ids_account_moves)
51 for n in acc_moves:
52 c = {'fiscalyear_id': n.period_id.fiscalyear_id.id}
53 new_name = obj_sequence.get_id(cr, uid, n.journal_id.sequence_id.id, context=c)
54 move_obj.write(cr, uid, [n.id], {'name':new_name})
55 return True
56
57stock_move()

Subscribers

People subscribed via source and target branches