Merge lp:~javieredm/openmrp/6.0 into lp:openmrp/6.0

Proposed by Javier Duran
Status: Needs review
Proposed branch: lp:~javieredm/openmrp/6.0
Merge into: lp:openmrp/6.0
Diff against target: 145 lines (+4/-96)
3 files modified
mrp_analytics_control/production.py (+1/-93)
mrp_analytics_control/wizard/users.py (+2/-2)
mrp_manufacturing_cost/cost.py (+1/-1)
To merge this branch: bzr merge lp:~javieredm/openmrp/6.0
Reviewer Review Type Date Requested Status
OpenMRP maintainers Pending
Review via email: mp+228689@code.launchpad.net

Description of the change

Correcciones de varios bug en la rama 6.0.

To post a comment you must log in.
Revision history for this message
Daniel Campos (Avanzosc) (dani-ds) wrote :

Hola Javier, he visto que eliminas 2 funciones, la write y la create, cual es la razón?

Unmerged revisions

253. By Javier Duran

[FIX] Correccion para que no solicite la cuenta analitica al momento de calcular datos en la orden de produccion

252. By root <email address hidden>

[FIX] Corrección del bug1340368

251. By root <email address hidden>

[FIX] Corrección del bug1340407

250. By root <email address hidden>

[FIX] Corrección del bug1340396

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'mrp_analytics_control/production.py'
2--- mrp_analytics_control/production.py 2014-07-11 07:52:34 +0000
3+++ mrp_analytics_control/production.py 2014-07-29 14:37:11 +0000
4@@ -385,17 +385,6 @@
5 _inherit = 'mrp.fixed.cost'
6 _name = 'mrp.fixed.cost'
7 _description = 'MRP fixed costs'
8-#
9-# def change_name(self, cr, uid, ids, name):
10-# me = self.browse(cr, uid, ids)[0]
11-# if True:
12-# warning = {
13-# 'title': _('Warning!'),
14-# 'message': _('Not allowed to change the name of fixed costs!')
15-# }
16-# return {'warning': warning}
17-# else:
18-# return {'value': {'created': True}}
19
20 def unlink(self, cr, uid, ids, context=None):
21 if 'delete_costs' in context:
22@@ -404,87 +393,6 @@
23 raise osv.except_osv(_('Unable to perform action'), _('Not allowed to delete the fixed costs, set its quantity to 0!'))
24 return True
25
26- def write(self, cr, uid, ids, vals, context=None):
27- fix = self.browse(cr, uid, ids, context)
28- if vals['name'] != fix[0].name:
29- raise osv.except_osv(_('Unable to perform action'), _('Not allowed to change the name of fixed costs!'))
30- res = super(mrp_fixed_cost, self).write(cr, uid, ids, vals, context=context)
31-
32- account_analytic_line_obj = self.pool.get('account.analytic.line')
33- account_analytic_obj = self.pool.get('account.analytic.account')
34-
35- for cost in fix:
36- code = 'OF' + cost.production_id.name.lstrip('OF/') + '-FIX'
37- fix_acc_search = account_analytic_obj.search(cr, uid, [('code', '=', 'OF' + str(cost.production_id.id) + "FIX")])
38- if fix_acc_search:
39- line_search = account_analytic_line_obj.search(cr, uid, [
40- ('name', '=', cost.name),
41- ('account_id', '=', fix_acc_search[0])
42- ])
43- if line_search:
44- account_analytic_line_obj.write(cr, uid, line_search[0], {'amount': (cost.amount * (-1))})
45- account_analytic_obj.recalculate_result(cr, uid, fix_acc_search[0])
46- else:
47- raise osv.except_osv(_('Programming Error'), _('Error in reading the analytic account line'))
48- else:
49- raise osv.except_osv(_('Error'), _('Analytic Account with code: %s NOT FOUND') % (code))
50- return res
51-
52- def create(self, cr, uid, vals, context=None):
53- mrp_production_obj = self.pool.get('mrp.production')
54- mrp_production = mrp_production_obj.browse(cr, uid, vals['production_id'])
55- fix_created = super(mrp_fixed_cost, self).create(cr, uid, vals, context=context)
56- account_analytic_obj = self.pool.get('account.analytic.account')
57- account_analytic_jour_obj = self.pool.get('account.analytic.journal')
58- code = 'OF' + mrp_production.name.lstrip('OF/')
59- acc_search = account_analytic_obj.search(cr, uid, [('code', '=', code)])
60- if not acc_search:
61- raise osv.except_osv(_('Error'), _('Analytic Account with code: %s NOT FOUND') % (code))
62-
63- acc_id = False
64- if acc_search:
65- acc_id = acc_search[0]
66- # TODO: Change this to use code instead for translational option
67- # man_journal_search = account_analytic_jour_obj.search(cr, uid, [('code', '=', 'MRP')])
68- man_journal_search = account_analytic_jour_obj.search(cr, uid, [('name', '=', 'Manufacturing')])
69-
70- if acc_id:
71- account_analytic_line_obj = self.pool.get('account.analytic.line')
72- op_acc_code = False
73- prod_maq_name_acc_code = False
74- code = 'OF' + mrp_production.name.lstrip('OF/') + '-FIX'
75- man_fix_account = account_analytic_obj.search(cr, uid, [('code', '=', code)])[0]
76-
77- if not man_fix_account:
78- #Crear cuenta analitica de costes fijos
79- est = 0
80-
81- man_fix_account = account_analytic_obj.create(cr, uid, {
82- 'name': prod_maq_name_acc_code + " " + _('Fixed'),
83- 'code': prod_maq_name_acc_code,
84- 'currency_id': mrp_production.company_id.currency_id.id,
85- 'company_id': mrp_production.company_id.id,
86- 'state': 'open',
87- 'parent_id': acc_id,
88- 'total_estimated': est,
89- 'total_estimated_puc': 0,
90- 'total_estimated_standard': 0,
91- 'acc_type': 'FIX'
92- })
93- account_analytic_obj.recalculate_result(cr, uid, man_fix_account)
94-
95- #añadir costes reales de costes fijos
96- new_id = account_analytic_line_obj.create(cr, uid, {
97- 'amount': vals['amount'] * (-1),
98- 'name': vals['name'],
99- 'date': datetime.today(),
100- 'company_in': mrp_production.company_id.id,
101- 'account_id': man_fix_account,
102- 'general_account_id': mrp_production.company_id.material_account.id,
103- 'journal_id': man_journal_search[0],
104- })
105- account_analytic_obj.recalculate_result(cr, uid, man_fix_account)
106-
107- return True
108+
109
110 mrp_fixed_cost()
111
112=== modified file 'mrp_analytics_control/wizard/users.py'
113--- mrp_analytics_control/wizard/users.py 2014-02-14 13:49:47 +0000
114+++ mrp_analytics_control/wizard/users.py 2014-07-29 14:37:11 +0000
115@@ -162,7 +162,7 @@
116 values={
117 'name':prod_wrk_name_acc_code + " " + ' Operario '+ str(nombre),
118 'code':prod_wrk_name_acc_code ,
119- 'currency_id':1,
120+ 'currency_id'::mrp_production.company_id.currency_id.id,
121 'company_id':mrp_production.company_id.id,
122 'state':'open',
123 'parent_id':parent_account,
124@@ -208,7 +208,7 @@
125
126 #busqueda y asignación de cuenta analitica correspondiente
127
128- ope_acc_code = 'OF' + str(mrp_production.name.lstrip('OF/')) + '-OP' + str(mrp_production_operation.sequence) + 'WK'+ str(in_user)
129+ ope_acc_code = 'OF' + str(mrp_production.name.lstrip('OF/')) + '-OP' + str(mrp_production_operation.sequence) + '-WK'+ str(in_user)
130
131 ope_account_id = False
132
133
134=== modified file 'mrp_manufacturing_cost/cost.py'
135--- mrp_manufacturing_cost/cost.py 2014-02-14 13:49:47 +0000
136+++ mrp_manufacturing_cost/cost.py 2014-07-29 14:37:11 +0000
137@@ -67,7 +67,7 @@
138
139 aux_prod = self.pool.get('mrp.production')
140 aux_prod_op = self.pool.get('mrp.production.operation')
141- op = aux_prod_op.browse(cr , uid, context['operation'])
142+ op = aux_prod_op.browse(cr , uid, data['operation'])
143
144 if 'production' in data:
145 op = self.pool.get('mrp.production').browse(cr, uid, data['production'])

Subscribers

People subscribed via source and target branches