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
1=== added directory 'sisb_fix_stock_journal'
2=== added file 'sisb_fix_stock_journal/__init__.py'
3--- sisb_fix_stock_journal/__init__.py 1970-01-01 00:00:00 +0000
4+++ sisb_fix_stock_journal/__init__.py 2012-05-16 15:45:23 +0000
5@@ -0,0 +1,2 @@
6+# -*- coding: utf-8 -*-
7+import model
8
9=== added file 'sisb_fix_stock_journal/__openerp__.py'
10--- sisb_fix_stock_journal/__openerp__.py 1970-01-01 00:00:00 +0000
11+++ sisb_fix_stock_journal/__openerp__.py 2012-05-16 15:45:23 +0000
12@@ -0,0 +1,20 @@
13+# -*- coding: utf-8 -*-
14+{
15+ 'name' : 'SISB Fix Stock Journal',
16+ 'version' : '0.1',
17+ 'author' : 'Industrias Diana, C.A. <sisb@industriasdiana.gob.ve>',
18+ 'description' : """
19+ Inserta el numero correlativo al diario
20+ de inventario, en el 'name' de los asientos contables,
21+ al procesarse un albaran.
22+ """,
23+ 'category' : 'accounting',
24+ 'website' : 'www.industriasdiana.gob.ve',
25+ 'depends' : ['account','stock'],
26+ 'update_xml' : [
27+ ],
28+ 'active' : False,
29+ 'installable' : True,
30+ 'data' : [],
31+
32+}
33
34=== added directory 'sisb_fix_stock_journal/model'
35=== added file 'sisb_fix_stock_journal/model/__init__.py'
36--- sisb_fix_stock_journal/model/__init__.py 1970-01-01 00:00:00 +0000
37+++ sisb_fix_stock_journal/model/__init__.py 2012-05-16 15:45:23 +0000
38@@ -0,0 +1,2 @@
39+# -*- coding: utf-8 -*-
40+import stock_move
41
42=== added file 'sisb_fix_stock_journal/model/stock_move.py'
43--- sisb_fix_stock_journal/model/stock_move.py 1970-01-01 00:00:00 +0000
44+++ sisb_fix_stock_journal/model/stock_move.py 2012-05-16 15:45:23 +0000
45@@ -0,0 +1,57 @@
46+# -*- coding: utf-8 -*-
47+from osv import osv, fields
48+import netsvc
49+import pooler
50+from tools.translate import _
51+
52+class stock_move(osv.osv):
53+
54+ _inherit = "stock.move"
55+
56+ def _create_product_valuation_moves(self, cr, uid, move, context=None):
57+ """
58+ Generate the appropriate accounting moves if the product being moves is subject
59+ to real_time valuation tracking, and the source or destination location is
60+ a transit location or is outside of the company.
61+ """
62+
63+ if move.product_id.valuation == 'real_time': # FIXME: product valuation should perhaps be a property?
64+ if context is None:
65+ context = {}
66+ src_company_ctx = dict(context,force_company=move.location_id.company_id.id)
67+ dest_company_ctx = dict(context,force_company=move.location_dest_id.company_id.id)
68+ account_moves = []
69+ # Outgoing moves (or cross-company output part)
70+ if move.location_id.company_id \
71+ and (move.location_id.usage == 'internal' and move.location_dest_id.usage != 'internal'\
72+ or move.location_id.company_id != move.location_dest_id.company_id):
73+ journal_id, acc_src, acc_dest, acc_variation = self._get_accounting_data_for_valuation(cr, uid, move, src_company_ctx)
74+ reference_amount, reference_currency_id = self._get_reference_accounting_values_for_valuation(cr, uid, move, src_company_ctx)
75+ account_moves += [(journal_id, self._create_account_move_line(cr, uid, move, acc_variation, acc_dest, reference_amount, reference_currency_id, context))]
76+
77+ # Incoming moves (or cross-company input part)
78+ if move.location_dest_id.company_id \
79+ and (move.location_id.usage != 'internal' and move.location_dest_id.usage == 'internal'\
80+ or move.location_id.company_id != move.location_dest_id.company_id):
81+ journal_id, acc_src, acc_dest, acc_variation = self._get_accounting_data_for_valuation(cr, uid, move, dest_company_ctx)
82+ reference_amount, reference_currency_id = self._get_reference_accounting_values_for_valuation(cr, uid, move, src_company_ctx)
83+ account_moves += [(journal_id, self._create_account_move_line(cr, uid, move, acc_src, acc_variation, reference_amount, reference_currency_id, context))]
84+
85+ obj_sequence = self.pool.get('ir.sequence')
86+ move_obj = self.pool.get('account.move')
87+ ids_account_moves = []
88+ for j_id, move_lines in account_moves:
89+ id_acc_move = move_obj.create(cr, uid,
90+ {'name': move.name,
91+ 'journal_id': j_id,
92+ 'line_id': move_lines,
93+ 'ref': move.picking_id and move.picking_id.name})
94+ ids_account_moves.append(id_acc_move)
95+ acc_moves = move_obj.browse(cr,uid,ids_account_moves)
96+ for n in acc_moves:
97+ c = {'fiscalyear_id': n.period_id.fiscalyear_id.id}
98+ new_name = obj_sequence.get_id(cr, uid, n.journal_id.sequence_id.id, context=c)
99+ move_obj.write(cr, uid, [n.id], {'name':new_name})
100+ return True
101+
102+stock_move()

Subscribers

People subscribed via source and target branches