*merge of the ~activity/openobject-addons/trunk branch. Improvement of translatability and small bugfixes
*small modifs on mrp_repair module bzr revid: qdp@tinyerp.com-20081208170840-ryh5435c5heqsngl
This commit is contained in:
parent
66b97cdc41
commit
7f9fe360f3
|
@ -1442,7 +1442,8 @@ class account_model(osv.osv):
|
|||
}
|
||||
|
||||
_defaults = {
|
||||
'legend':lambda *a:'''You can specify year, month and date in the name of the model using the following labels:\n\n%(year)s : To Specify Year \n%(month)s : To Specify Month \n%(date)s : Current Date\n\ne.g. My model on %(date)s''',
|
||||
'legend': lambda self, cr, uid, context:_('You can specify year, month and date in the name of the model using the following labels:\n\n%(year)s : To Specify Year \n%(month)s : To Specify Month \n%(date)s : Current Date\n\ne.g. My model on %(date)s'),
|
||||
|
||||
}
|
||||
|
||||
account_model()
|
||||
|
|
|
@ -82,8 +82,8 @@ class account_invoice(osv.osv):
|
|||
res[id] = self.test_paid(cr, uid, [id])
|
||||
return res
|
||||
|
||||
def _get_reference_type(self, cursor, user, context=None):
|
||||
return [('none', 'Free Reference')]
|
||||
def _get_reference_type(self, cr, uid, context=None):
|
||||
return [('none', _('Free Reference'))]
|
||||
|
||||
def _amount_residual(self, cr, uid, ids, name, args, context={}):
|
||||
res = {}
|
||||
|
|
|
@ -23,6 +23,7 @@
|
|||
import wizard
|
||||
import pooler
|
||||
import time
|
||||
from tools.translate import _
|
||||
|
||||
def _action_open_window(self, cr, uid, data, context):
|
||||
domain=[]
|
||||
|
@ -35,7 +36,7 @@ def _action_open_window(self, cr, uid, data, context):
|
|||
elif to_date:
|
||||
domain=[('date','<=',to_date)]
|
||||
return {
|
||||
'name': 'Analytic Entries',
|
||||
'name': _('Analytic Entries'),
|
||||
'view_type': 'form',
|
||||
"view_mode": 'tree,form',
|
||||
'res_model': 'account.analytic.line',
|
||||
|
|
|
@ -60,6 +60,11 @@ class wizard_account_chart(wizard.interface):
|
|||
result = mod_obj._get_id(cr, uid, 'account', 'action_account_tree')
|
||||
id = mod_obj.read(cr, uid, [result], ['res_id'])[0]['res_id']
|
||||
result = act_obj.read(cr, uid, [id])[0]
|
||||
if 'lang' in context:
|
||||
import tools
|
||||
trans_name = tools.translate(cr, 'ir.actions.act_window,name', 'model', context['lang'], result['name'])
|
||||
if trans_name:
|
||||
result['name'] = trans_name
|
||||
result['context'] = str({'fiscalyear': data['form']['fiscalyear'],'target_move':data['form']['target_move']})
|
||||
if data['form']['fiscalyear']:
|
||||
result['name']+=':'+pooler.get_pool(cr.dbname).get('account.fiscalyear').read(cr,uid,[data['form']['fiscalyear']])[0]['code']
|
||||
|
|
|
@ -40,7 +40,8 @@ def _action_open_window(self, cr, uid, data, context):
|
|||
raise Exception, _('You have to define the bank account\nin the journal definition for reconciliation.')
|
||||
return {
|
||||
'domain': "[('journal_id','=',%d), ('account_id','=',%d), ('state','<>','draft')]" % (form['journal_id'],account_id),
|
||||
'name': 'Saisie Standard',
|
||||
'name': _('Standard Encoding'),
|
||||
|
||||
'view_type': 'form',
|
||||
'view_mode': 'tree,form',
|
||||
'res_model': 'account.move.line',
|
||||
|
|
|
@ -25,32 +25,6 @@ import pooler
|
|||
import locale
|
||||
import time
|
||||
|
||||
#report_type = '''<?xml version="1.0"?>
|
||||
#<form string="Select Report Type">
|
||||
#</form>'''
|
||||
#
|
||||
#dates_form = '''<?xml version="1.0"?>
|
||||
#<form string="Select period ">
|
||||
# <field name="date_from" colspan="4"/>
|
||||
# <field name="date_to" colspan="4"/>
|
||||
# <field name="sortbydate" colspan="4"/>
|
||||
# <field name="display_account" colspan="4"/>
|
||||
# <field name="landscape" colspan="4"/>
|
||||
# <field name="soldeinit"/>
|
||||
# <field name="amount_currency" colspan="4"/>
|
||||
#</form>'''
|
||||
#
|
||||
#dates_fields = {
|
||||
# 'date_from': {'string':"Start date",'type':'date','required':True ,'default': lambda *a: time.strftime('%Y-01-01')},
|
||||
# 'date_to': {'string':"End date",'type':'date','required':True, 'default': lambda *a: time.strftime('%Y-%m-%d')},
|
||||
# 'sortbydate':{'string':"Sort by",'type':'selection','selection':[('sort_date','Date'),('sort_mvt','Mouvement')]},
|
||||
# 'display_account':{'string':"Display accounts ",'type':'selection','selection':[('bal_mouvement','With movements'),('bal_all','All'),('bal_solde','With balance is not equal to 0')]},
|
||||
# 'landscape':{'string':"Print in Landscape Mode",'type':'boolean'},
|
||||
# 'soldeinit':{'string':"Inclure les soldes initiaux",'type':'boolean'},
|
||||
# 'amount_currency':{'string':"with amount in currency",'type':'boolean'}
|
||||
#
|
||||
#}
|
||||
|
||||
account_form = '''<?xml version="1.0"?>
|
||||
<form string="Select Chart">
|
||||
<field name="Account_list" colspan="4"/>
|
||||
|
@ -108,11 +82,10 @@ period_fields = {
|
|||
'sortbydate':{'string':"Sort by:",'type':'selection','selection':[('sort_date','Date'),('sort_mvt','Movement')]},
|
||||
'display_account':{'string':"Display accounts ",'type':'selection','selection':[('bal_mouvement','With movements'),('bal_all','All'),('bal_solde','With balance is not equal to 0')]},
|
||||
'landscape':{'string':"Landscape Mode",'type':'boolean'},
|
||||
'soldeinit':{'string':"Inclure les soldes initiaux",'type':'boolean'},
|
||||
'soldeinit':{'string':"Include initial balances",'type':'boolean'},
|
||||
'amount_currency':{'string':"With Currency",'type':'boolean'},
|
||||
'date_from': {'string':" Start date",'type':'date','required':True ,'default': lambda *a: time.strftime('%Y-01-01')},
|
||||
'date_to': {'string':"End date",'type':'date','required':True, 'default': lambda *a: time.strftime('%Y-%m-%d')},
|
||||
|
||||
}
|
||||
def _check_path(self, cr, uid, data, context):
|
||||
if data['model'] == 'account.account':
|
||||
|
|
|
@ -68,7 +68,7 @@ period_fields = {
|
|||
'selection':[('customer','Receivable Accounts'),('supplier','Payable Accounts'),('all','Receivable and Payable Accounts')],
|
||||
'required':True
|
||||
},
|
||||
'soldeinit':{'string':" Inclure les soldes initiaux",'type':'boolean'},
|
||||
'soldeinit':{'string':"Include initial balances",'type':'boolean'},
|
||||
'date1': {'string':' Start date', 'type':'date', 'required':True,'default': lambda *a: time.strftime('%Y-01-01')},
|
||||
'date2': {'string':'End date', 'type':'date', 'required':True,'default': lambda *a: time.strftime('%Y-%m-%d')},
|
||||
}
|
||||
|
|
|
@ -21,6 +21,8 @@
|
|||
##############################################################################
|
||||
|
||||
import wizard
|
||||
from tools.translate import _
|
||||
|
||||
|
||||
_journal_form = '''<?xml version="1.0"?>
|
||||
<form string="%s">
|
||||
|
@ -34,7 +36,7 @@ _journal_fields = {
|
|||
def _action_open_window(self, cr, uid, data, context):
|
||||
return {
|
||||
'domain': "[('account_id','=',%d),('reconcile_id','=',False),('state','<>','draft')]" % data['form']['account_id'],
|
||||
'name': 'Reconciliation',
|
||||
'name': _('Reconciliation'),
|
||||
'view_type': 'form',
|
||||
'view_mode': 'tree,form',
|
||||
'view_id': False,
|
||||
|
|
|
@ -74,7 +74,7 @@ period_fields = {
|
|||
'selection':[('customer','Receivable Accounts'),('supplier','Payable Accounts'),('all','Receivable and Payable Accounts')],
|
||||
'required':True
|
||||
},
|
||||
'soldeinit':{'string':"Inclure les soldes initiaux",'type':'boolean'},
|
||||
'soldeinit':{'string':"Include initial balances",'type':'boolean'},
|
||||
'reconcil':{'string':" Include Reconciled Entries",'type':'boolean'},
|
||||
'page_split':{'string':"One Partner Per Page",'type':'boolean'},
|
||||
'date1': {'string':' Start date', 'type':'date', 'required':True, 'default': lambda *a: time.strftime('%Y-01-01')},
|
||||
|
|
|
@ -144,17 +144,16 @@ def get_value_text(cr, uid, field_name,values,object, context={}):
|
|||
if values:
|
||||
if type(values)==tuple:
|
||||
values=values[0]
|
||||
val=pool.get(model).read(cr,uid,[values],['name'])
|
||||
val=pool.get(model).read(cr,uid,[values],[pool.get(model)._rec_name])
|
||||
if len(val):
|
||||
return val[0]['name']
|
||||
|
||||
return val[0][pool.get(model)._rec_name]
|
||||
elif field['ttype'] == 'many2many':
|
||||
value=[]
|
||||
if values:
|
||||
for id in values:
|
||||
val=pool.get(model).read(cr,uid,[id],['name'])
|
||||
val=pool.get(model).read(cr,uid,[id],[pool.get(model)._rec_name])
|
||||
if len(val):
|
||||
value.append(val[0]['name'])
|
||||
value.append(val[0][pool.get(model)._rec_name])
|
||||
return value
|
||||
|
||||
elif field['ttype'] == 'one2many':
|
||||
|
@ -162,9 +161,10 @@ def get_value_text(cr, uid, field_name,values,object, context={}):
|
|||
if values:
|
||||
value=[]
|
||||
for id in values:
|
||||
val=pool.get(model).read(cr,uid,[id],['name'])
|
||||
val=pool.get(model).read(cr,uid,[id],[pool.get(model)._rec_name])
|
||||
|
||||
if len(val):
|
||||
value.append(val[0]['name'])
|
||||
value.append(val[0][pool.get(model)._rec_name])
|
||||
return value
|
||||
return values
|
||||
|
||||
|
|
|
@ -223,6 +223,7 @@ class crm_case_rule(osv.osv):
|
|||
('create','Creation Date'),
|
||||
('action_last','Last Action Date'),
|
||||
('deadline','Deadline'),
|
||||
('date','Date'),
|
||||
], 'Trigger Date', size=16),
|
||||
'trg_date_range': fields.integer('Delay after trigger date'),
|
||||
'trg_date_range_type': fields.selection([('minutes', 'Minutes'),('hour','Hours'),('day','Days'),('month','Months')], 'Delay type'),
|
||||
|
@ -435,6 +436,8 @@ class crm_case(osv.osv):
|
|||
base = mx.DateTime.strptime(case.create_date[:19], '%Y-%m-%d %H:%M:%S')
|
||||
elif action.trg_date_type=='deadline' and case.date_deadline:
|
||||
base = mx.DateTime.strptime(case.date_deadline, '%Y-%m-%d')
|
||||
elif action.trg_date_type=='date' and case.date:
|
||||
base = mx.DateTime.strptime(case.date, '%Y-%m-%d')
|
||||
if base:
|
||||
fnct = {
|
||||
'minutes': lambda interval: mx.DateTime.RelativeDateTime(minutes=interval),
|
||||
|
@ -531,7 +534,10 @@ class crm_case(osv.osv):
|
|||
return False
|
||||
for case in cases:
|
||||
if case.partner_id:
|
||||
name = 'Case ' + keyword + ': ' + case.name
|
||||
translated_keyword = keyword
|
||||
if 'translated_keyword' in context:
|
||||
translated_keyword = context['translated_keyword']
|
||||
name = _('Case') + ' ' + translated_keyword + ': ' + case.name
|
||||
if isinstance(name, str):
|
||||
name = unicode(name, 'utf-8')
|
||||
if len(name) > 64:
|
||||
|
@ -574,7 +580,7 @@ class crm_case(osv.osv):
|
|||
res = super(crm_case, self).create(cr, uid, *args, **argv)
|
||||
cases = self.browse(cr, uid, [res])
|
||||
cases[0].state # to fill the browse record cache
|
||||
self.__log(cr,uid, cases, 'draft')
|
||||
self.__log(cr,uid, cases, 'draft', context={'translated_keyword': _('draft')})
|
||||
self._action(cr,uid, cases, 'draft')
|
||||
return res
|
||||
|
||||
|
@ -626,7 +632,7 @@ class crm_case(osv.osv):
|
|||
|
||||
def case_log(self, cr, uid, ids,context={}, email=False, *args):
|
||||
cases = self.browse(cr, uid, ids)
|
||||
self.__history(cr, uid, cases, 'Historize', history=True, email=email)
|
||||
self.__history(cr, uid, cases, _('Historize'), history=True, email=email)
|
||||
return self.write(cr, uid, ids, {'description': False, 'som': False,
|
||||
'canal_id': False})
|
||||
|
||||
|
@ -636,7 +642,7 @@ class crm_case(osv.osv):
|
|||
if not case.email_from:
|
||||
raise osv.except_osv(_('Error!'),
|
||||
_('You must put a Partner eMail to use this action!'))
|
||||
self.__history(cr, uid, cases, 'Send', history=True, email=False)
|
||||
self.__history(cr, uid, cases, _('Send'), history=True, email=False)
|
||||
for case in cases:
|
||||
self.write(cr, uid, [case.id], {
|
||||
'description': False,
|
||||
|
@ -685,8 +691,8 @@ class crm_case(osv.osv):
|
|||
def case_close(self, cr, uid, ids, *args):
|
||||
cases = self.browse(cr, uid, ids)
|
||||
cases[0].state # to fill the browse record cache
|
||||
self.__log(cr,uid, cases, 'done')
|
||||
self.__history(cr, uid, cases, 'Close')
|
||||
self.__log(cr,uid, cases, 'done', context={'translated_keyword': _('done')})
|
||||
self.__history(cr, uid, cases, _('Close'))
|
||||
self.write(cr, uid, ids, {'state':'done', 'date_closed': time.strftime('%Y-%m-%d %H:%M:%S')})
|
||||
#
|
||||
# We use the cache of cases to keep the old case state
|
||||
|
@ -705,15 +711,15 @@ class crm_case(osv.osv):
|
|||
else:
|
||||
raise osv.except_osv(_('Error !'), _('You can not escalate this case.\nYou are already at the top level.'))
|
||||
self.write(cr, uid, ids, data)
|
||||
self.__history(cr, uid, cases, 'escalate')
|
||||
self.__history(cr, uid, cases, _('Escalate'))
|
||||
self._action(cr, uid, cases, 'escalate')
|
||||
return True
|
||||
|
||||
|
||||
def case_open(self, cr, uid, ids, *args):
|
||||
cases = self.browse(cr, uid, ids)
|
||||
self.__log(cr, uid, cases, 'open')
|
||||
self.__history(cr, uid, cases, 'Open')
|
||||
self.__log(cr, uid, cases, 'open', context={'translated_keyword': _('open')})
|
||||
self.__history(cr, uid, cases, _('Open'))
|
||||
for case in cases:
|
||||
data = {'state':'open', 'active':True}
|
||||
if not case.user_id:
|
||||
|
@ -729,8 +735,8 @@ class crm_case(osv.osv):
|
|||
def case_cancel(self, cr, uid, ids, *args):
|
||||
cases = self.browse(cr, uid, ids)
|
||||
cases[0].state # to fill the browse record cache
|
||||
self.__log(cr, uid, cases, 'cancel')
|
||||
self.__history(cr, uid, cases, 'Cancel')
|
||||
self.__log(cr, uid, cases, 'cancel', context={'translated_keyword': _('cancel')})
|
||||
self.__history(cr, uid, cases, _('Cancel'))
|
||||
self.write(cr, uid, ids, {'state':'cancel', 'active':True})
|
||||
self._action(cr,uid, cases, 'cancel')
|
||||
return True
|
||||
|
@ -738,8 +744,8 @@ class crm_case(osv.osv):
|
|||
def case_pending(self, cr, uid, ids, *args):
|
||||
cases = self.browse(cr, uid, ids)
|
||||
cases[0].state # to fill the browse record cache
|
||||
self.__log(cr, uid, cases, 'pending')
|
||||
self.__history(cr, uid, cases, 'Pending')
|
||||
self.__log(cr, uid, cases, 'pending', context={'translated_keyword': _('draft')})
|
||||
self.__history(cr, uid, cases, _('Pending'))
|
||||
self.write(cr, uid, ids, {'state':'pending', 'active':True})
|
||||
self._action(cr,uid, cases, 'pending')
|
||||
return True
|
||||
|
@ -747,8 +753,8 @@ class crm_case(osv.osv):
|
|||
def case_reset(self, cr, uid, ids, *args):
|
||||
cases = self.browse(cr, uid, ids)
|
||||
cases[0].state # to fill the browse record cache
|
||||
self.__log(cr, uid, cases, 'draft')
|
||||
self.__history(cr, uid, cases, 'Draft')
|
||||
self.__log(cr, uid, cases, 'draft', context={'translated_keyword': _('draft')})
|
||||
self.__history(cr, uid, cases, _('Draft'))
|
||||
self.write(cr, uid, ids, {'state':'draft', 'active':True})
|
||||
self._action(cr, uid, cases, 'draft')
|
||||
return True
|
||||
|
|
|
@ -27,6 +27,8 @@ import netsvc
|
|||
import ir
|
||||
import pooler
|
||||
|
||||
from tools.translate import _
|
||||
|
||||
case_form = """<?xml version="1.0"?>
|
||||
<form string="Planify Meeting">
|
||||
<field name="date"/>
|
||||
|
@ -54,7 +56,7 @@ class make_meeting(wizard.interface):
|
|||
'date': data['form']['date'],
|
||||
'duration': data['form']['duration']
|
||||
}, context=context)
|
||||
case_obj._history(cr, uid, case_obj.browse(cr, uid, [data['id']]), 'meeting')
|
||||
case_obj._history(cr, uid, case_obj.browse(cr, uid, [data['id']]), _('meeting'))
|
||||
return {}
|
||||
|
||||
states = {
|
||||
|
|
|
@ -22,6 +22,8 @@
|
|||
from osv import fields,osv
|
||||
from osv import orm
|
||||
|
||||
from tools.translate import _
|
||||
|
||||
def _get_answers(cr, uid, ids):
|
||||
query = """
|
||||
select distinct(answer)
|
||||
|
@ -131,11 +133,9 @@ class questionnaire(osv.osv):
|
|||
from crm_profiling_question
|
||||
where id in ( select question from profile_questionnaire_quest_rel where questionnaire = %s)"""% data['form']['questionnaire_name']
|
||||
cr.execute(query)
|
||||
|
||||
quest_fields={}
|
||||
quest_form='''<?xml version="1.0"?>
|
||||
<form string="Questionnaire">'''
|
||||
|
||||
<form string="%s">''' % _('Questionnaire')
|
||||
for x in cr.fetchall():
|
||||
quest_form = quest_form + '''<field name="quest_form'''+str(x[1])+'''"/><newline/>'''
|
||||
quest_fields['quest_form'+str(x[1])] = {'string': str(x[0]), 'type': 'many2one', 'relation': 'crm_profiling.answer', 'domain': [('question_id','=',x[1])] }
|
||||
|
|
|
@ -36,6 +36,7 @@ import StringIO
|
|||
import random
|
||||
import string
|
||||
|
||||
from tools import config
|
||||
|
||||
def random_name():
|
||||
random.seed()
|
||||
|
@ -261,8 +262,9 @@ class document_directory(osv.osv):
|
|||
_parent(dir_id,path)
|
||||
path.append(self.pool.get(directory.ressource_type_id.model).browse(cr,uid,res_id).name)
|
||||
user=self.pool.get('res.users').browse(cr,uid,uid)
|
||||
return "ftp://%s:%s@localhost:8021/%s/%s"%(user.login,user.password,cr.dbname,'/'.join(path))
|
||||
return False
|
||||
return "ftp://%s:%s@localhost:%s/%s/%s"%(user.login,user.password,config.get('ftp_server_port',8021),cr.dbname,'/'.join(path))
|
||||
return False
|
||||
|
||||
def _check_recursion(self, cr, uid, ids):
|
||||
level = 100
|
||||
while len(ids):
|
||||
|
@ -364,7 +366,7 @@ class document_directory(osv.osv):
|
|||
ressource_id=directory.ressource_id and directory.ressource_id.id or 0
|
||||
res=self.search(cr,uid,[('id','<>',directory.id),('name','=',name),('parent_id','=',parent_id),('ressource_parent_type_id','=',ressource_parent_type_id),('ressource_id','=',ressource_id)])
|
||||
if len(res):
|
||||
return False
|
||||
return False
|
||||
if op=='create':
|
||||
res=self.search(cr,uid,[('name','=',name),('parent_id','=',parent_id),('ressource_parent_type_id','=',ressource_parent_type_id),('ressource_id','=',ressource_id)])
|
||||
if len(res):
|
||||
|
|
|
@ -4,7 +4,8 @@ import authorizer
|
|||
import abstracted_fs
|
||||
import netsvc
|
||||
|
||||
PORT = 8021
|
||||
from tools import config
|
||||
PORT = config.get('ftp_server_port', 8021)
|
||||
HOST = ''
|
||||
|
||||
class ftp_server(threading.Thread):
|
||||
|
|
|
@ -137,10 +137,12 @@ class event(osv.osv):
|
|||
'mail_confirm': fields.text('Confirmation Email', help="This email will be sent when the event gets confimed or when someone subscribes to a confirmed event. This is also the email sent to remind someone about the event."),
|
||||
'product_id':fields.many2one('product.product','Product', required=True),
|
||||
}
|
||||
|
||||
_defaults = {
|
||||
'state': lambda *args: 'draft',
|
||||
'code': lambda obj, cr, uid, context: obj.pool.get('ir.sequence').get(cr, uid, 'event.event'),
|
||||
'user_id': lambda self,cr,uid,ctx: uid,
|
||||
|
||||
}
|
||||
event()
|
||||
|
||||
|
@ -148,6 +150,8 @@ class event_registration(osv.osv):
|
|||
|
||||
def _history(self, cr, uid,ids,keyword, history=False, email=False, context={}):
|
||||
for case in self.browse(cr, uid, ids):
|
||||
if not case.case_id:
|
||||
return True
|
||||
data = {
|
||||
'name': keyword,
|
||||
'som': case.som.id,
|
||||
|
@ -333,7 +337,8 @@ class event_registration(osv.osv):
|
|||
case_data = self.browse(cr,uid,ids)
|
||||
new_ids=[]
|
||||
for case in case_data:
|
||||
new_ids.append(case.case_id.id)
|
||||
if case.case_id:
|
||||
new_ids.append(case.case_id.id)
|
||||
return getattr(self.pool.get('crm.case'),method)(cr, uid, new_ids, *args, **argv)
|
||||
|
||||
|
||||
|
|
|
@ -73,7 +73,10 @@ class ir_action_window(osv.osv):
|
|||
r['domain'] = r['domain'].replace(mystring, str(
|
||||
self.pool.get('hr.department')._get_members(cr, uid)))
|
||||
if isinstance(ids, (int, long)):
|
||||
return res[0]
|
||||
if res:
|
||||
return res[0]
|
||||
else:
|
||||
return False
|
||||
return res
|
||||
|
||||
ir_action_window()
|
||||
|
|
|
@ -24,6 +24,7 @@ import datetime
|
|||
|
||||
from report.interface import report_rml
|
||||
from report.interface import toxml
|
||||
from tools.translate import _
|
||||
|
||||
import pooler
|
||||
|
||||
|
@ -33,13 +34,23 @@ def lengthmonth(year, month):
|
|||
return [0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31][month]
|
||||
|
||||
class report_custom(report_rml):
|
||||
|
||||
def get_month_name(self, cr, uid, month):
|
||||
_months = {1:_("January"), 2:_("February"), 3:_("March"), 4:_("April"), 5:_("May"), 6:_("June"), 7:_("July"), 8:_("August"), 9:_("September"), 10:_("October"), 11:_("November"), 12:_("December")}
|
||||
return _months[month]
|
||||
def get_weekday_name(self, cr, uid, weekday):
|
||||
_weekdays = {1:_('Mon'), 2:_('Tue'), 3:_('Wed'), 4:_('Thu'), 5:_('Fri'), 6:_('Sat'), 7:_('Sun')}
|
||||
return _weekdays[weekday]
|
||||
|
||||
def create_xml(self, cr, uid, ids, data, context):
|
||||
|
||||
# Computing the dates (start of month: som, and end of month: eom)
|
||||
som = datetime.date(data['form']['year'], data['form']['month'], 1)
|
||||
eom = som + datetime.timedelta(lengthmonth(som.year, som.month))
|
||||
date_xml = ['<date month="%s" year="%d" />' % (som.strftime('%B'), som.year), '<days>']
|
||||
date_xml += ['<day number="%d" name="%s" />' % (x, som.replace(day=x).strftime('%a')) for x in range(1, lengthmonth(som.year, som.month)+1)]
|
||||
|
||||
date_xml = ['<date month="%s" year="%d" />' % (self.get_month_name(cr, uid, som.month), som.year), '<days>']
|
||||
date_xml += ['<day number="%d" name="%s" weekday="%d" />' % (x, self.get_weekday_name(cr, uid, som.replace(day=x).weekday()+1), som.replace(day=x).weekday()+1) for x in range(1, lengthmonth(som.year, som.month)+1)]
|
||||
|
||||
date_xml.append('</days>')
|
||||
date_xml.append('<cols>2.5cm%s,2cm</cols>\n' % (',0.7cm' * lengthmonth(som.year, som.month)))
|
||||
|
||||
|
|
|
@ -30,7 +30,7 @@
|
|||
<blockFont name="Helvetica" size="6" start="0,2" stop="-2,-2"/>
|
||||
<blockFont name="Helvetica-BoldOblique" size="8" start="0,-1" stop="-1,-1"/>
|
||||
<blockBackground colorName="#AAAAAA" start="1,0" stop="-2,1"/>
|
||||
<xsl:for-each select="/report/days/day[@name='Sat' or @name='Sun']">
|
||||
<xsl:for-each select="/report/days/day[@weekday=6 or @weekday=7]">
|
||||
<xsl:variable name="col" select="attribute::number" />
|
||||
<blockBackground>
|
||||
<xsl:attribute name="colorName">lightgrey</xsl:attribute>
|
||||
|
@ -131,4 +131,4 @@
|
|||
</td>
|
||||
</tr>
|
||||
</xsl:template>
|
||||
</xsl:stylesheet>
|
||||
</xsl:stylesheet>
|
||||
|
|
|
@ -24,6 +24,9 @@ import datetime
|
|||
from report.interface import report_rml
|
||||
from report.interface import toxml
|
||||
|
||||
from tools.translate import _
|
||||
|
||||
|
||||
def lengthmonth(year, month):
|
||||
if month == 2 and ((year % 4 == 0) and ((year % 100 != 0) or (year % 400 == 0))):
|
||||
return 29
|
||||
|
@ -67,13 +70,22 @@ def emp_create_xml(cr, id, som, eom):
|
|||
return xml
|
||||
|
||||
class report_custom(report_rml):
|
||||
|
||||
def get_month_name(self, cr, uid, month):
|
||||
_months = {1:_("January"), 2:_("February"), 3:_("March"), 4:_("April"), 5:_("May"), 6:_("June"), 7:_("July"), 8:_("August"), 9:_("September"), 10:_("October"), 11:_("November"), 12:_("December")}
|
||||
return _months[month]
|
||||
|
||||
def get_weekday_name(self, cr, uid, weekday):
|
||||
_weekdays = {1:_('Mon'), 2:_('Tue'), 3:_('Wed'), 4:_('Thu'), 5:_('Fri'), 6:_('Sat'), 7:_('Sun')}
|
||||
return _weekdays[weekday]
|
||||
|
||||
def create_xml(self, cr, uid, ids, data, context):
|
||||
|
||||
# Computing the dates (start of month: som, and end of month: eom)
|
||||
som = datetime.date(data['form']['year'], data['form']['month'], 1)
|
||||
eom = som + datetime.timedelta(lengthmonth(som.year, som.month))
|
||||
date_xml = ['<date month="%s" year="%d" />' % (som.strftime('%B'), som.year), '<days>']
|
||||
date_xml += ['<day number="%d" name="%s" />' % (x, som.replace(day=x).strftime('%a')) for x in range(1, lengthmonth(som.year, som.month)+1)]
|
||||
date_xml = ['<date month="%s" year="%d" />' % (self.get_month_name(cr, uid, som.month), som.year), '<days>']
|
||||
date_xml += ['<day number="%d" name="%s" weekday="%d" />' % (x, self.get_weekday_name(cr, uid, som.replace(day=x).weekday()+1), som.replace(day=x).weekday()+1) for x in range(1, lengthmonth(som.year, som.month)+1)]
|
||||
date_xml.append('</days>')
|
||||
date_xml.append('<cols>2.5cm%s,2cm</cols>\n' % (',0.7cm' * lengthmonth(som.year, som.month)))
|
||||
|
||||
|
@ -82,6 +94,9 @@ class report_custom(report_rml):
|
|||
emp_xml += emp_create_xml(cr, id, som, eom)
|
||||
|
||||
# Computing the xml
|
||||
#Without this, report don't show non-ascii characters (TO CHECK)
|
||||
date_xml = '\n'.join(date_xml)
|
||||
|
||||
xml='''<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<report>
|
||||
%s
|
||||
|
|
|
@ -30,7 +30,7 @@
|
|||
<blockFont name="Helvetica" size="6" start="0,2" stop="-2,-2"/>
|
||||
<blockFont name="Helvetica-BoldOblique" size="8" start="0,-1" stop="-1,-1"/>
|
||||
<blockBackground colorName="#AAAAAA" start="1,0" stop="-2,1"/>
|
||||
<xsl:for-each select="/report/days/day[@name='Sat' or @name='Sun']">
|
||||
<xsl:for-each select="/report/days/day[@weekday=6 or @weekday=7]">
|
||||
<xsl:variable name="col" select="attribute::number" />
|
||||
<blockBackground>
|
||||
<xsl:attribute name="colorName">lightgrey</xsl:attribute>
|
||||
|
@ -107,17 +107,17 @@
|
|||
</td>
|
||||
</xsl:for-each>
|
||||
<td>
|
||||
<xsl:value-of select="format-number(sum(//employee[@id=$id]/time-element),'##.##')"/>
|
||||
<xsl:value-of select="format-number(sum(//employee[@id=$id]/time-element),'##.##')"/>
|
||||
</td>
|
||||
</tr>
|
||||
</xsl:for-each>
|
||||
<tr>
|
||||
<td>Total</td>
|
||||
<td t="1">Total</td>
|
||||
<xsl:for-each select="report/days/day">
|
||||
<xsl:variable name="today" select="attribute::number"/>
|
||||
<td t="1"><xsl:value-of select="format-number(sum(//time-element[@date=$today]),'##.##')"/></td>
|
||||
<td><xsl:value-of select="format-number(sum(//time-element[@date=$today]),'##.##')"/></td>
|
||||
</xsl:for-each>
|
||||
<td t="1"><xsl:value-of select="format-number(sum(//time-element),'##.##')"/></td>
|
||||
<td><xsl:value-of select="format-number(sum(//time-element),'##.##')"/></td>
|
||||
</tr>
|
||||
</blockTable>
|
||||
</xsl:template>
|
||||
|
|
|
@ -117,7 +117,7 @@ class final_invoice_create(wizard.interface):
|
|||
'discount': 0.0,
|
||||
'invoice_line_tax_id': [(6,0,tax)],
|
||||
'invoice_id': last_invoice,
|
||||
'name': ref+(product and ' - '+product.name or ''),
|
||||
'name': ref or '' +(product and ' - '+product.name or ''),
|
||||
'product_id': product_id,
|
||||
'uos_id': product_uom_id,
|
||||
'account_id': account_id,
|
||||
|
@ -139,7 +139,7 @@ class final_invoice_create(wizard.interface):
|
|||
'invoice_line_tax_id': [(6,0,tax)],
|
||||
'invoice_id': last_invoice,
|
||||
'name': product.name,
|
||||
'product_id': product_id,
|
||||
'product_id': product.id,
|
||||
'uos_id': product.uom_id.id,
|
||||
'account_id': account_id,
|
||||
'account_analytic_id': account.id
|
||||
|
|
|
@ -52,8 +52,11 @@ class invoice_create(wizard.interface):
|
|||
partner = account.partner_id
|
||||
if (not partner) or not (account.pricelist_id):
|
||||
raise wizard.except_wizard(_('Analytic account incomplete'),
|
||||
_('Please fill in the partner and pricelist field '
|
||||
'in the analytic account:\n%s') % (account.name,))
|
||||
_('Please fill in the partner and pricelist field in the analytic account:\n%s') % (account.name,))
|
||||
|
||||
if not partner.address:
|
||||
raise wizard.except_wizard(_('Partner incomplete'),
|
||||
_('Please fill in the address field in the partner: %s.') % (partner.name,))
|
||||
|
||||
date_due = False
|
||||
if partner.property_payment_term:
|
||||
|
@ -150,7 +153,7 @@ class invoice_create(wizard.interface):
|
|||
|
||||
return {
|
||||
'domain': "[('id','in', ["+','.join(map(str,invoices))+"])]",
|
||||
'name': 'Invoices',
|
||||
'name': _('Invoices'),
|
||||
'view_type': 'form',
|
||||
'view_mode': 'tree,form',
|
||||
'res_model': 'account.invoice',
|
||||
|
|
|
@ -874,7 +874,7 @@ class mrp_procurement(osv.osv):
|
|||
properties = [x.id for x in procurement.property_ids]
|
||||
bom_id = self.pool.get('mrp.bom')._bom_find(cr, uid, procurement.product_id.id, procurement.product_uom.id, properties)
|
||||
if not bom_id:
|
||||
cr.execute('update mrp_procurement set message=%s where id=%d', ('No BoM defined for this product !', procurement.id))
|
||||
cr.execute('update mrp_procurement set message=%s where id=%d', (_('No BoM defined for this product !'), procurement.id))
|
||||
return False
|
||||
return True
|
||||
|
||||
|
@ -912,7 +912,7 @@ class mrp_procurement(osv.osv):
|
|||
if procurement.product_id.product_tmpl_id.supply_method<>'buy':
|
||||
return False
|
||||
if not procurement.product_id.seller_ids:
|
||||
cr.execute('update mrp_procurement set message=%s where id=%d', ('No supplier defined for this product !', procurement.id))
|
||||
cr.execute('update mrp_procurement set message=%s where id=%d', (_('No supplier defined for this product !'), procurement.id))
|
||||
return False
|
||||
partner = procurement.product_id.seller_ids[0].name
|
||||
if user.company_id and user.company_id.partner_id:
|
||||
|
@ -920,7 +920,7 @@ class mrp_procurement(osv.osv):
|
|||
return False
|
||||
address_id = self.pool.get('res.partner').address_get(cr, uid, [partner.id], ['delivery'])['delivery']
|
||||
if not address_id:
|
||||
cr.execute('update mrp_procurement set message=%s where id=%d', ('No address defined for the supplier', procurement.id))
|
||||
cr.execute('update mrp_procurement set message=%s where id=%d', (_('No address defined for the supplier'), procurement.id))
|
||||
return False
|
||||
return True
|
||||
|
||||
|
@ -956,7 +956,7 @@ class mrp_procurement(osv.osv):
|
|||
return True
|
||||
|
||||
def action_move_assigned(self, cr, uid, ids):
|
||||
self.write(cr, uid, ids, {'state':'running','message':'from stock: products assigned.'})
|
||||
self.write(cr, uid, ids, {'state':'running','message':_('from stock: products assigned.')})
|
||||
return True
|
||||
|
||||
def _check_make_to_stock_service(self, cr, uid, procurement, context={}):
|
||||
|
@ -970,7 +970,7 @@ class mrp_procurement(osv.osv):
|
|||
ok = ok and self.pool.get('stock.move').action_assign(cr, uid, [id])
|
||||
cr.execute('select count(id) from stock_warehouse_orderpoint where product_id=%d', (procurement.product_id.id,))
|
||||
if not cr.fetchone()[0]:
|
||||
cr.execute('update mrp_procurement set message=%s where id=%d', ('from stock and no minimum orderpoint rule defined', procurement.id))
|
||||
cr.execute('update mrp_procurement set message=%s where id=%d', (_('from stock and no minimum orderpoint rule defined'), procurement.id))
|
||||
return ok
|
||||
|
||||
def action_produce_assign_service(self, cr, uid, ids, context={}):
|
||||
|
|
|
@ -25,6 +25,8 @@ import pooler
|
|||
from report.interface import report_rml
|
||||
from report.interface import toxml
|
||||
|
||||
from tools.translate import _
|
||||
|
||||
|
||||
#FIXME: we should use toxml
|
||||
class report_custom(report_rml):
|
||||
|
@ -116,38 +118,38 @@ class report_custom(report_rml):
|
|||
"""
|
||||
header = """
|
||||
<header>
|
||||
<field>Product name</field>
|
||||
<field>Product supplier</field>
|
||||
<field>Product quantity</field>
|
||||
<field>Product uom</field>
|
||||
<field>Product Standard Price</field>
|
||||
<field>Unit Product Price</field>
|
||||
<field>%s</field>
|
||||
<field>%s</field>
|
||||
<field>%s</field>
|
||||
<field>%s</field>
|
||||
<field>%s</field>
|
||||
<field>%s</field>
|
||||
</header>
|
||||
"""
|
||||
""" % (_('Product name'), _('Product supplier'), _('Product quantity'), _('Product uom'), _('Product Standard Price'), _('Unit Product Price'))
|
||||
workcenter_header = """
|
||||
<lines style='header'>
|
||||
<row>
|
||||
<col>Workcenter name</col>
|
||||
<col>%s</col>
|
||||
<col/>
|
||||
<col/>
|
||||
<col/>
|
||||
<col>Cycles Cost</col>
|
||||
<col>Hours Cost</col>
|
||||
<col>%s</col>
|
||||
<col>%s</col>
|
||||
</row>
|
||||
</lines>
|
||||
"""
|
||||
""" % (_('Workcenter name'), _('Cycles Cost'), _('Hours Cost'))
|
||||
prod_header = """
|
||||
<lines style='header'>
|
||||
<row>
|
||||
<col para='yes'>Product name</col>
|
||||
<col para='yes'>Product supplier</col>
|
||||
<col para='yes'>Product Quantity</col>
|
||||
<col para='yes'>Product uom</col>
|
||||
<col para='yes'>Product Standard Price</col>
|
||||
<col para='yes'>Unit Product Price</col>
|
||||
<col para='yes'>%s</col>
|
||||
<col para='yes'>%s</col>
|
||||
<col para='yes'>%s</col>
|
||||
<col para='yes'>%s</col>
|
||||
<col para='yes'>%s</col>
|
||||
<col para='yes'>%s</col>
|
||||
</row>
|
||||
</lines>
|
||||
"""
|
||||
""" % (_('Product name'), _('Product supplier'), _('Product Quantity'), _('Product uom'), _('Product Standard Price'), _('Unit Product Price'))
|
||||
|
||||
company_currency = pooler.get_pool(cr.dbname).get('res.users').browse(cr, uid, uid).company_id.currency_id.id
|
||||
first = True
|
||||
|
@ -171,8 +173,7 @@ class report_custom(report_rml):
|
|||
if not first:
|
||||
xml += prod_header
|
||||
xml += "<lines style='lines'>" + xml_tmp + '</lines>'
|
||||
xml += "<lines style='sub_total'><row><col>SUBTOTAL : </col><col>(for " + str(number) + " products)</col><col/><col/><col>" + '%.2f' % total_strd + '</col><col>' + '%.2f' % total + '</col></row></lines>'
|
||||
|
||||
xml += "<lines style='sub_total'><row><col>%s : </col><col>(" % (_('SUBTOTAL')) + str(number) + " %s)</col><col/><col/><col>" % (_('products')) + '%.2f' % total_strd + '</col><col>' + '%.2f' % total + '</col></row></lines>'
|
||||
total2 = 0
|
||||
xml_tmp = ''
|
||||
for wrk in (sub_boms and sub_boms[1]):
|
||||
|
@ -182,11 +183,12 @@ class report_custom(report_rml):
|
|||
if xml_tmp:
|
||||
xml += workcenter_header
|
||||
xml += "<lines style='lines'>" + xml_tmp + '</lines>'
|
||||
xml += "<lines style='sub_total'><row><col>SUBTOTAL : </col><col>(for " + str(number) + " products)</col><col/><col/><col/><col>" + '%.2f' % total2 + '</col></row></lines>'
|
||||
xml += "<lines style='total'><row><col>TOTAL : </col><col>(for " + str(number) + " products)</col><col/><col/><col>" + '%.2f' % (total_strd+total2) + "</col><col>" + '%.2f' % (total+total2) + '</col></row></lines>'
|
||||
xml += "<lines style='sub_total'><row><col>%s : </col><col>(" % (_('SUBTOTAL')) + str(number) + " %s)</col><col/><col/><col/><col>" % (_('products')) + '%.2f' % total2 + '</col></row></lines>'
|
||||
xml += "<lines style='total'><row><col>%s : </col><col>(" % (_('TOTAL')) + str(number) + " %s)</col><col/><col/><col>" % (_('products')) + '%.2f' % (total_strd+total2) + "</col><col>" + '%.2f' % (total+total2) + '</col></row></lines>'
|
||||
|
||||
first = False
|
||||
|
||||
xml = '<?xml version="1.0" ?><report>' + config_start + '<report-header>Product Cost Structure\n\r' + prod.name + '</report-header>'+ config_stop + header + xml + '</report>'
|
||||
xml = '<?xml version="1.0" ?><report>' + config_start + '<report-header>%s\n\r' % (_('Product Cost Structure')) + prod.name + '</report-header>'+ config_stop + header + xml + '</report>'
|
||||
|
||||
return xml
|
||||
|
||||
|
|
|
@ -110,7 +110,7 @@ class report_custom(report_int):
|
|||
res = cr.dictfetchone()
|
||||
if not res['stop']:
|
||||
res['stop'] = time.strftime('%Y-%m-%d')
|
||||
dates = self._compute_dates(datas['form']['time_unit'], time.strftime('%Y-%m-%d'), res['stop'])
|
||||
dates = self._compute_dates(datas['form']['time_unit'], time.strftime('%Y-%m-%d'), res['stop'][:10])
|
||||
dates_list = dates.keys()
|
||||
dates_list.sort()
|
||||
x_index = []
|
||||
|
@ -151,7 +151,7 @@ class report_custom(report_int):
|
|||
AND (mrp_workcenter.id=%d) \
|
||||
AND (mrp_production.date_planned BETWEEN %s AND %s) \
|
||||
GROUP BY mrp_production_workcenter_line.workcenter_id, mrp_workcenter.name, mrp_workcenter.id \
|
||||
ORDER BY mrp_workcenter.id", (workcenter['id'], dates[date]['start'], dates[date]['stop']))
|
||||
ORDER BY mrp_workcenter.id", (workcenter['id'], dates[date]['start'] + ' 00:00:00', dates[date]['stop'] + ' 23:59:59'))
|
||||
res = cr.dictfetchall()
|
||||
if not res:
|
||||
vals.append(0.0)
|
||||
|
|
|
@ -93,7 +93,7 @@ class mrp_repair(osv.osv):
|
|||
'guarantee_limit': fields.date('Guarantee limit', help="The garantee limit is computed as: last move date + warranty defined on selected product. If the current date is below the garantee limit, each operation and fee you will add will be set as 'not to invoiced' by default. Note that you can change manually afterwards."),
|
||||
'operations' : fields.one2many('mrp.repair.line', 'repair_id', 'Operation Lines', readonly=True, states={'draft':[('readonly',False)]}),
|
||||
'pricelist_id': fields.many2one('product.pricelist', 'Pricelist', help='The pricelist comes from the selected partner, by default.'),
|
||||
'partner_invoice_id':fields.many2one('res.partner.address', 'Invoice to', domain="[('partner_id','=',partner_id)]"),
|
||||
'partner_invoice_id':fields.many2one('res.partner.address', 'Invoicing Address', domain="[('partner_id','=',partner_id)]"),
|
||||
'invoice_method':fields.selection([
|
||||
("none","No Invoice"),
|
||||
("b4repair","Before Repair"),
|
||||
|
@ -374,7 +374,6 @@ class mrp_repair(osv.osv):
|
|||
res = {}
|
||||
company = self.pool.get('res.users').browse(cr, uid, uid).company_id
|
||||
for repair in self.browse(cr, uid, ids, context=context):
|
||||
#TODO: create the moves add/remove
|
||||
for move in repair.operations:
|
||||
move_id = self.pool.get('stock.move').create(cr, uid, {
|
||||
'name': move.name,
|
||||
|
@ -385,7 +384,7 @@ class mrp_repair(osv.osv):
|
|||
'location_id': move.location_id.id,
|
||||
'location_dest_id': move.location_dest_id.id,
|
||||
'tracking_id': False,
|
||||
'state': 'assigned',
|
||||
'state': 'done',
|
||||
})
|
||||
self.pool.get('mrp.repair.line').write(cr, uid, [move.id], {'move_id': move_id})
|
||||
|
||||
|
@ -397,7 +396,7 @@ class mrp_repair(osv.osv):
|
|||
'address_id': repair.address_id and repair.address_id.id or False,
|
||||
'note': repair.internal_notes,
|
||||
'invoice_state': 'none',
|
||||
'type': 'out', # FIXME delivery ?
|
||||
'type': 'out',
|
||||
})
|
||||
wf_service = netsvc.LocalService("workflow")
|
||||
wf_service.trg_validate(uid, 'stock.picking', picking, 'button_confirm', cr)
|
||||
|
@ -499,8 +498,8 @@ class mrp_repair_line(osv.osv, ProductChangeMixin):
|
|||
'product_uom_qty': fields.float('Quantity (UoM)', digits=(16,2), required=True),
|
||||
'product_uom': fields.many2one('product.uom', 'Product UoM', required=True),
|
||||
'invoice_line_id': fields.many2one('account.invoice.line', 'Invoice Line', readonly=True),
|
||||
'location_id': fields.many2one('stock.location', 'Source Location', required=True, select=True),
|
||||
'location_dest_id': fields.many2one('stock.location', 'Dest. Location', required=True, select=True),
|
||||
'location_id': fields.many2one('stock.location', 'Source Location', domain=[('type','!=','view')], required=True, select=True),
|
||||
'location_dest_id': fields.many2one('stock.location', 'Dest. Location', domain=[('type','!=','view')], required=True, select=True),
|
||||
'move_id': fields.many2one('stock.move', 'Inventory Move', readonly=True),
|
||||
'state': fields.selection([('draft','Draft'),('confirmed','Confirmed'),('done','Done'),('cancel','Canceled')], 'Status', required=True, readonly=True),
|
||||
}
|
||||
|
|
|
@ -199,9 +199,18 @@
|
|||
<field name="res_model">mrp.repair</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_mode">tree,form</field>
|
||||
<field name="domain">[('state','=','confirmed')]</field>
|
||||
<field name="domain">[('state','=','under_repair')]</field>
|
||||
</record>
|
||||
|
||||
|
||||
<record id="action_repair_ready_tree" model="ir.actions.act_window">
|
||||
<field name="name">Repairs Ready to Start</field>
|
||||
<field name="type">ir.actions.act_window</field>
|
||||
<field name="res_model">mrp.repair</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_mode">tree,form</field>
|
||||
<field name="domain">[('state','!=','draft'),('state','!=','under_repair'),('state','!=','2binvoiced'),('state','!=','invoice_except'),('state','!=','done'),('state','!=','cancel'),]</field>
|
||||
</record>
|
||||
|
||||
<record id="action_repair_2binvoiced_tree" model="ir.actions.act_window">
|
||||
<field name="name">Repairs to be invoiced</field>
|
||||
<field name="type">ir.actions.act_window</field>
|
||||
|
@ -214,8 +223,10 @@
|
|||
<menuitem action="action_repair_order_tree" id="menu_repair_order" parent="mrp.menu_mrp_root" name="Repairs"/>
|
||||
|
||||
<menuitem action="action_repair_quotation_tree" id="menu_repair_quotation" parent="menu_repair_order"/>
|
||||
|
||||
|
||||
<menuitem action="action_repair_progress_tree" id="menu_repair_progress" parent="menu_repair_order"/>
|
||||
|
||||
<menuitem action="action_repair_ready_tree" id="menu_repair_ready" parent="menu_repair_order"/>
|
||||
|
||||
<menuitem action="action_repair_2binvoiced_tree" id="menu_repair_2binvoiced" parent="menu_repair_order"/>
|
||||
|
||||
|
|
|
@ -36,8 +36,16 @@ class price_type(osv.osv):
|
|||
sale and purchase prices based on some fields of the product.
|
||||
"""
|
||||
def _price_field_get(self, cr, uid, context={}):
|
||||
cr.execute('select name, field_description from ir_model_fields where model in (%s,%s) and ttype=%s order by name', ('product.product', 'product.template', 'float'))
|
||||
return cr.fetchall()
|
||||
import tools
|
||||
cr.execute('select name, field_description, model from ir_model_fields where model in (%s,%s) and ttype=%s order by name', ('product.product', 'product.template', 'float'))
|
||||
res = []
|
||||
for field in cr.dictfetchall():
|
||||
desc = tools.translate(cr, field['model'] + ',' + field['name'], 'field', context.get('lang', False) or 'en_US')
|
||||
if not desc:
|
||||
desc = field['field_description']
|
||||
res.append((field['name'], desc))
|
||||
return res
|
||||
|
||||
def _get_currency(self, cr, uid, ctx):
|
||||
comp = self.pool.get('res.users').browse(cr,uid,uid).company_id
|
||||
if not comp:
|
||||
|
@ -297,9 +305,16 @@ product_pricelist_version()
|
|||
class product_pricelist_item(osv.osv):
|
||||
def _price_field_get(self, cr, uid, context={}):
|
||||
cr.execute('select id,name from product_price_type where active')
|
||||
result = cr.fetchall()
|
||||
result.append((-1,'Other Pricelist'))
|
||||
result.append((-2,'Partner section of the product form'))
|
||||
import tools
|
||||
result = []
|
||||
for line in cr.fetchall():
|
||||
transl_name = tools.translate(cr, 'product.price.type,name', 'model', ('lang' in context) and context['lang'] or 'en_US', line[1])
|
||||
if not transl_name:
|
||||
transl_name = line[1]
|
||||
result.append((line[0], transl_name))
|
||||
|
||||
result.append((-1, _('Other Pricelist')))
|
||||
result.append((-2, _('Partner section of the product form')))
|
||||
return result
|
||||
|
||||
_name = "product.pricelist.item"
|
||||
|
|
|
@ -66,7 +66,7 @@
|
|||
<td>
|
||||
<para style="nospace"><xsl:value-of select="code"/></para>
|
||||
</td><td>
|
||||
<para style="nospace"><xsl:value-of select="price"/> EUR</para>
|
||||
<para style="nospace" t="1"><xsl:value-of select="price"/> EUR</para>
|
||||
</td>
|
||||
</tr><tr>
|
||||
<td>
|
||||
|
|
|
@ -24,6 +24,9 @@ import time
|
|||
from report import report_sxw
|
||||
from osv import osv
|
||||
import pooler
|
||||
|
||||
from tools.translate import _
|
||||
|
||||
parents = {
|
||||
'tr':1,
|
||||
'li':1,
|
||||
|
@ -45,16 +48,19 @@ class product_pricelist(report_sxw.rml_parse):
|
|||
'qty_header':self._qty_header,
|
||||
})
|
||||
def _qty_header(self,form):
|
||||
def _get_unit_text(obj, cr, uid, par_qty):
|
||||
if form[q]==1:
|
||||
return _('%d unit')%(par_qty)
|
||||
else:
|
||||
return _('%d units')%(par_qty)
|
||||
|
||||
qty=[]
|
||||
self.pricelist=form['price_list']
|
||||
for i in range(1,6):
|
||||
q = 'qty%d'%i
|
||||
if form[q]:
|
||||
self.quantity.append(form[q])
|
||||
if form[q]==1:
|
||||
qty.append('%d unit'%(form[q]))
|
||||
else:
|
||||
qty.append('%d units'%(form[q]))
|
||||
qty.append(_get_unit_text(self, self.cr, self.uid, form[q]))
|
||||
return qty
|
||||
|
||||
|
||||
|
|
|
@ -24,6 +24,8 @@ import wizard
|
|||
import pooler
|
||||
import time
|
||||
|
||||
from tools.translate import _
|
||||
|
||||
def _action_open_window(self, cr, uid, data, context):
|
||||
cr.execute('select id,name from ir_ui_view where name=%s and type=%s', ('product.margin.graph', 'graph'))
|
||||
view_res3 = cr.fetchone()[0]
|
||||
|
@ -32,7 +34,7 @@ def _action_open_window(self, cr, uid, data, context):
|
|||
cr.execute('select id,name from ir_ui_view where name=%s and type=%s', ('product.margin.tree', 'tree'))
|
||||
view_res = cr.fetchone()[0]
|
||||
return {
|
||||
'name': 'Product Margins',
|
||||
'name': _('Product Margins'),
|
||||
'context':{'date_from':data['form']['from_date'],'date_to':data['form']['to_date'],'invoice_state' : data['form']['invoice_state']},
|
||||
'view_type': 'form',
|
||||
"view_mode": 'tree,form,graph',
|
||||
|
|
|
@ -42,6 +42,7 @@ class GanttCanvas(object):
|
|||
user=user.replace('/', '//')
|
||||
if hasattr(name, 'replace'):
|
||||
name=name.replace('/', '//')
|
||||
name = name.encode('ascii', 'ignore')
|
||||
if user not in self._datas:
|
||||
self._datas[user] = []
|
||||
for f in datas:
|
||||
|
|
|
@ -59,11 +59,11 @@
|
|||
<xsl:template match="tasks">
|
||||
<blockTable style="tasks" colWidths="10cm,1.6cm,1.6cm,2cm,2.5cm">
|
||||
<tr>
|
||||
<td>Tasks</td>
|
||||
<td>Hours</td>
|
||||
<td>Done</td>
|
||||
<td>Deadline</td>
|
||||
<td>Responsible</td>
|
||||
<td t="True">Tasks</td>
|
||||
<td t="True">Hours</td>
|
||||
<td t="True">Done</td>
|
||||
<td t="True">Deadline</td>
|
||||
<td t="True">Responsible</td>
|
||||
</tr>
|
||||
<xsl:apply-templates select="task"/>
|
||||
</blockTable>
|
||||
|
@ -76,24 +76,24 @@
|
|||
<spacer length="1cm"/>
|
||||
<blockTable colWidths="3cm,6cm,3cm,6cm" style="project">
|
||||
<tr>
|
||||
<td>Manager:</td>
|
||||
<td t="True">Manager:</td>
|
||||
<td><para><b><xsl:value-of select="manager"/></b></para></td>
|
||||
<td>Members:</td>
|
||||
<td t="True">Members:</td>
|
||||
<td><para><xsl:apply-templates select="members"/></para></td>
|
||||
</tr><tr>
|
||||
<td>Project:</td>
|
||||
<td t="True">Project:</td>
|
||||
<td><xsl:value-of select="parent"/></td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
</tr><tr>
|
||||
<td>Date Start:</td>
|
||||
<td t="True">Date Start:</td>
|
||||
<td><xsl:value-of select="date_start"/></td>
|
||||
<td>Date Stop:</td>
|
||||
<td t="True">Date Stop:</td>
|
||||
<td><xsl:value-of select="date_stop"/></td>
|
||||
</tr><tr>
|
||||
<td>Planned Hours:</td>
|
||||
<td t="True">Planned Hours:</td>
|
||||
<td><xsl:value-of select="planned_hours"/></td>
|
||||
<td>Effective Hours:</td>
|
||||
<td t="True">Effective Hours:</td>
|
||||
<td><xsl:value-of select="effective_hours"/></td>
|
||||
</tr>
|
||||
</blockTable>
|
||||
|
|
|
@ -57,7 +57,7 @@ class project_work(osv.osv):
|
|||
if line_id in list_avail_ids:
|
||||
obj = self.pool.get('hr.analytic.timesheet')
|
||||
if 'name' in vals:
|
||||
vals_line['name']=task.name+': '+vals['name']
|
||||
vals_line['name']=task.name+': '+vals['name']
|
||||
if 'user_id' in vals:
|
||||
vals_line['user_id']=vals['user_id']
|
||||
if 'date' in vals:
|
||||
|
|
|
@ -15,6 +15,7 @@
|
|||
<field name="task_nbr" select="2"/>
|
||||
<field name="task_hrs" select="2"/>
|
||||
<field name="task_progress" select="2"/>
|
||||
<field name="task_state" select="1"/>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
|
@ -42,6 +43,7 @@
|
|||
<field name="task_nbr"/>
|
||||
<field name="task_hrs"/>
|
||||
<field name="task_progress"/>
|
||||
<field name="task_state"/>
|
||||
</tree>
|
||||
</field>
|
||||
</record>
|
||||
|
|
|
@ -18,10 +18,7 @@
|
|||
<field name="type">form</field>
|
||||
<field name="inherit_id" ref="sale.view_order_form"/>
|
||||
<field name="arch" type="xml">
|
||||
<field name="product_id"
|
||||
on_change="product_id_change(parent.pricelist_id,product_id,product_uom_qty,product_uom,product_uos_qty,product_uos,name,parent.partner_id, 'lang' in context and context['lang'], True, parent.date_order)"
|
||||
context="partner_id=parent.partner_id,quantity=product_uom_qty,pricelist=parent.pricelist_id,shop=parent.shop_id,uom=product_uom"
|
||||
select="1" position="after">
|
||||
<field name="product_id" position="after">
|
||||
<field name="analytics_id" domain="[('plan_id','<>',False)]"/>
|
||||
</field>
|
||||
</field>
|
||||
|
|
|
@ -21,6 +21,8 @@
|
|||
##############################################################################
|
||||
|
||||
from osv import fields, osv
|
||||
from tools.translate import _
|
||||
|
||||
|
||||
class product_product(osv.osv):
|
||||
_inherit = "product.product"
|
||||
|
@ -161,36 +163,36 @@ class product_product(osv.osv):
|
|||
if fields:
|
||||
if location_info.usage == 'supplier':
|
||||
if fields.get('virtual_available'):
|
||||
res['fields']['virtual_available']['string'] = 'Futur Receptions'
|
||||
res['fields']['virtual_available']['string'] = _('Futur Receptions')
|
||||
if fields.get('qty_available'):
|
||||
res['fields']['qty_available']['string'] = 'Received Qty'
|
||||
res['fields']['qty_available']['string'] = _('Received Qty')
|
||||
|
||||
if location_info.usage == 'internal':
|
||||
if fields.get('virtual_available'):
|
||||
res['fields']['virtual_available']['string'] = 'Futur Stock'
|
||||
res['fields']['virtual_available']['string'] = _('Futur Stock')
|
||||
|
||||
if location_info.usage == 'customer':
|
||||
if fields.get('virtual_available'):
|
||||
res['fields']['virtual_available']['string'] = 'Futur Deliveries'
|
||||
res['fields']['virtual_available']['string'] = _('Futur Deliveries')
|
||||
if fields.get('qty_available'):
|
||||
res['fields']['qty_available']['string'] = 'Delivered Qty'
|
||||
res['fields']['qty_available']['string'] = _('Delivered Qty')
|
||||
|
||||
if location_info.usage == 'inventory':
|
||||
if fields.get('virtual_available'):
|
||||
res['fields']['virtual_available']['string'] = 'Futur P&L'
|
||||
res['fields']['qty_available']['string'] = 'P&L Qty'
|
||||
res['fields']['virtual_available']['string'] = _('Futur P&L')
|
||||
res['fields']['qty_available']['string'] = _('P&L Qty')
|
||||
|
||||
if location_info.usage == 'procurement':
|
||||
if fields.get('virtual_available'):
|
||||
res['fields']['virtual_available']['string'] = 'Futur Qty'
|
||||
res['fields']['virtual_available']['string'] = _('Futur Qty')
|
||||
if fields.get('qty_available'):
|
||||
res['fields']['qty_available']['string'] = 'Unplanned Qty'
|
||||
res['fields']['qty_available']['string'] = _('Unplanned Qty')
|
||||
|
||||
if location_info.usage == 'production':
|
||||
if fields.get('virtual_available'):
|
||||
res['fields']['virtual_available']['string'] = 'Futur Productions'
|
||||
res['fields']['virtual_available']['string'] = _('Futur Productions')
|
||||
if fields.get('qty_available'):
|
||||
res['fields']['qty_available']['string'] = 'Produced Qty'
|
||||
res['fields']['qty_available']['string'] = _('Produced Qty')
|
||||
|
||||
return res
|
||||
product_product()
|
||||
|
|
|
@ -27,6 +27,8 @@ from tools.misc import UpdateableStr
|
|||
import netsvc
|
||||
import time
|
||||
|
||||
from tools.translate import _
|
||||
|
||||
arch=UpdateableStr()
|
||||
fields={}
|
||||
|
||||
|
@ -41,7 +43,7 @@ def _get_returns(self, cr, uid, data, context):
|
|||
pick=pick_obj.browse(cr, uid, [data['id']])[0]
|
||||
res={}
|
||||
fields.clear()
|
||||
arch_lst=['<?xml version="1.0"?>', '<form string="Return lines">', '<label string="Provide the quantities of the returned products." colspan="4"/>']
|
||||
arch_lst=['<?xml version="1.0"?>', '<form string="%s">' % _('Return lines'), '<label string="%s" colspan="4"/>' % _('Provide the quantities of the returned products.')]
|
||||
for m in [line for line in pick.move_lines]:
|
||||
quantity=m.product_qty
|
||||
arch_lst.append('<field name="return%s"/>\n<newline/>' % (m.id,))
|
||||
|
@ -52,7 +54,7 @@ def _get_returns(self, cr, uid, data, context):
|
|||
new_invoice_state='2binvoiced'
|
||||
else:
|
||||
new_invoice_state=pick.invoice_state
|
||||
fields['invoice_state']={'string':'Invoice state', 'type':'selection', 'default':make_default(new_invoice_state), 'required':True, 'selection':[('2binvoiced', 'to be invoiced'), ('none', 'None')]}
|
||||
fields['invoice_state']={'string':_('Invoice state'), 'type':'selection', 'default':make_default(new_invoice_state), 'required':True, 'selection':[('2binvoiced', _('to be invoiced')), ('none', _('None'))]}
|
||||
arch_lst.append('</form>')
|
||||
arch.string='\n'.join(arch_lst)
|
||||
return res
|
||||
|
|
Loading…
Reference in New Issue