[MERGE]: Merge with lp:~openerp-dev/openobject-addons/ksa-dev-addons2

bzr revid: rpa@tinyerp.com-20100607061934-xduupe5nmsrjv5ta
This commit is contained in:
rpa (Open ERP)
2010-06-07 11:49:34 +05:30
8 changed files with 48 additions and 28 deletions
+12 -2
View File
@@ -863,7 +863,6 @@ class account_invoice(osv.osv):
# make the invoice point to that move
self.write(cr, uid, [inv.id], {'move_id': move_id,'period_id':period_id, 'move_name':new_move_name})
self.pool.get('account.move').post(cr, uid, [move_id])
self._log_event(cr, uid, ids)
return True
def line_get_convert(self, cr, uid, x, part, date, context=None):
@@ -917,6 +916,7 @@ class account_invoice(osv.osv):
'WHERE account_move_line.move_id = %s ' \
'AND account_analytic_line.move_id = account_move_line.id',
(ref, move_id))
self._log_event(cr, uid, ids)
return True
def action_cancel(self, cr, uid, ids, *args):
@@ -952,7 +952,17 @@ class account_invoice(osv.osv):
return taxes.values()
def _log_event(self, cr, uid, ids, factor=1.0, name='Open Invoice'):
#TODO: implement messages system
for (invoice_id,number) in self.name_get(cr, uid, ids):
invoice = self.browse(cr,uid,invoice_id)
message = ("%s %s %s %s %s %s %s") % (
_('Invoice'),
_("INV/"),
number.split('/')[-1],
_("Opened,"),
_('journal entries'),
invoice.move_id.name,
_("Created"))
self.log(cr, uid, invoice_id, message)
return True
def name_get(self, cr, uid, ids, context=None):
@@ -37,11 +37,11 @@ class account_invoice_confirm(osv.osv_memory):
context = {}
pool_obj = pooler.get_pool(cr.dbname)
data_inv = pool_obj.get('account.invoice').read(cr, uid, context['active_ids'], ['state'], context=context)
for record in data_inv:
if record['state'] not in ('draft','proforma','proforma2'):
raise osv.except_osv(_('Warning'), _("Selected Invoice(s) cannot be confirmed as they are not in 'Draft' or 'Pro-Forma' state!"))
wf_service.trg_validate(uid, 'account.invoice', id, 'invoice_open', cr)
wf_service.trg_validate(uid, 'account.invoice', record['id'], 'invoice_open', cr)
return {}
account_invoice_confirm()
@@ -61,7 +61,7 @@ class account_invoice_cancel(osv.osv_memory):
wf_service = netsvc.LocalService('workflow')
pool_obj = pooler.get_pool(cr.dbname)
data_inv = pool_obj.get('account.invoice').read(cr, uid, context['active_ids'], ['state'], context=context)
for record in data_inv:
if record['state'] in ('cancel','paid'):
raise osv.except_osv(_('Warning'), _("Selected Invoice(s) cannot be cancelled as they are already in 'Cancelled' or 'Done' state!"))
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
##############################################################################
#
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
#
@@ -15,7 +15,7 @@
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
@@ -48,7 +48,7 @@ PEP-8 Test , copyright of py files check, method can not call from loops
list_files.append(os.path.join(i, j))
py_list = []
for file_py in list_files:
if file_py.split('.')[-1] == 'py' and not file_py.endswith('__init__.py') and not file_py.endswith('__terp__.py'):
if file_py.split('.')[-1] == 'py' and not file_py.endswith('__init__.py') and not file_py.endswith('__openerp__.py'):
file_path = os.path.join(module_path, file_py)
py_list.append(file_path)
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
##############################################################################
#
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
#
@@ -15,7 +15,7 @@
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
@@ -50,7 +50,7 @@ class quality_test(base_module_quality.abstract_quality_check):
flag = False
self.result_details += '''<html><body><head>%s</head>'''%(self.get_style())
for file_py in list_files:
if file_py.split('.')[-1] == 'py' and not file_py.endswith('__init__.py') and not file_py.endswith('__terp__.py'):
if file_py.split('.')[-1] == 'py' and not file_py.endswith('__init__.py') and not file_py.endswith('__openerp__.py'):
if not flag:
flag = True
file_path = os.path.join(module_path, file_py)
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
##############################################################################
#
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
#
@@ -15,7 +15,7 @@
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
@@ -82,7 +82,7 @@ This test checks if the module satisfy tiny structure
# module files calculation (module.py,module_view.xml,etc..)
com_list = ['_unit_test.xml', '.py', '_view.xml', '_workflow.xml' , '_wizard.xml', '_report.xml', '_data.xml', '_demo.xml', '_security.xml', '_sequence.xml', '_graph.xml']
com_list = map(lambda x: module_name + x, com_list)
main_file = ['__init__.py', '__terp__.py']
main_file = ['__init__.py', '__openerp__.py']
com_list.extend(main_file)
module_dict['module'] = filter(lambda x: len(x.split(".")) > 1, module_dict['module'])
score = self.get_score(module_dict['module'], com_list)
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
##############################################################################
#
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
#
@@ -15,7 +15,7 @@
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
@@ -49,13 +49,13 @@ class quality_test(base_module_quality.abstract_quality_check):
score = 1.0
feel_good_factor = 0
feel_bad_factor = 0
if '__terp__.py' not in list_files:
if '__openerp__.py' not in list_files:
self.no_terp = True
self.result += _("The module does not contain the __terp__.py file")
self.result += _("The module does not contain the __openerp__.py file")
return None
result_dict = {}
result_dict1 = {}
terp_file = os.path.join(module_path,'__terp__.py')
terp_file = os.path.join(module_path,'__openerp__.py')
res = eval(tools.file_open(terp_file).read())
terp_keys = ['category', 'name', 'description', 'author', 'website', 'update_xml', 'init_xml', 'depends', 'version', 'active', 'installable', 'demo_xml']
for key in terp_keys:
@@ -117,7 +117,7 @@ class quality_test(base_module_quality.abstract_quality_check):
self.result_details += self.get_result_details(result_dict)
self.result_details += self.get_result_details(result_dict1)
return [_('__terp__.py file'), score]
return [_('__openerp__.pyfile'), score]
def run_test(self, cr, uid, module_path):
terp_score = self.run_test_terp(cr, uid, module_path)
@@ -125,7 +125,7 @@ class quality_test(base_module_quality.abstract_quality_check):
if self.score*100 < self.min_score:
self.message = 'Score is below than minimal score(%s%%)' % self.min_score
if terp_score:
self.result = self.get_result({'__terp__.py': terp_score})
self.result = self.get_result({'__openerp__.py': terp_score})
return None
def get_result(self, dict_terp):
+2
View File
@@ -264,6 +264,8 @@
<field name="type"/>
<field name="datas_fname"/>
<field name="user_id"/>
<field name="partner_id" invisible="1"/>
<field name="parent_id" invisible="1"/>
<field name="create_date"/>
<field name="write_date"/>
</tree>
+15 -7
View File
@@ -20,6 +20,7 @@
##############################################################################
from mx import DateTime
from datetime import datetime, timedelta
from osv import fields
from osv import osv
from tools.translate import _
@@ -117,9 +118,9 @@ class mrp_bom(osv.osv):
"""
Defines bills of material for a product.
"""
_name = 'mrp.bom'
_name = 'mrp.bom'
_description = 'Bill of Material'
def _child_compute(self, cr, uid, ids, name, arg, context={}):
""" Gets child bom.
@param self: The object pointer
@@ -419,7 +420,6 @@ class mrp_production(osv.osv):
_name = 'mrp.production'
_description = 'Manufacturing Order'
_date_name = 'date_planned'
_log_create = True
def _production_calc(self, cr, uid, ids, prop, unknow_none, context={}):
""" Calculates total hours and total no. of cycles for a production order.
@@ -647,15 +647,23 @@ class mrp_production(osv.osv):
""" Changes the production state to Ready and location id of stock move.
@return: True
"""
for (id,name) in self.name_get(cr, uid, ids):
message = _('Manufacturing Order ') + " '" + name + "' "+ _("is ready to produce.")
self.log(cr, uid, id, message)
move_obj = self.pool.get('stock.move')
self.write(cr, uid, ids, {'state': 'ready'})
for production in self.browse(cr, uid, ids):
for (production_id,name) in self.name_get(cr, uid, ids):
production = self.browse(cr, uid, production_id)
if production.move_prod_id:
move_obj.write(cr, uid, [production.move_prod_id.id],
{'location_id': production.location_dest_id.id})
message = ("%s %s %s %s %s %s") % (
_('Manufacturing Order '),
name,
_("scheduled the"),
datetime.strptime(production.date_planned,'%Y-%m-%d %H:%M:%S').strftime('%Y-%m-%d'),
_("for"),
production.product_id.default_code)
self.log(cr, uid, production_id, message)
return True
def action_production_end(self, cr, uid, ids):