Anto has proposed merging
lp:~openerp-dev/openobject-addons/trunk-imp_copy_l10n-abo into
lp:openobject-addons.
Requested reviews:
OpenERP Core Team (openerp)
For more details, see:
https://code.launchpad.net/~openerp-dev/openobject-addons/trunk-imp_copy_l10n-abo/+merge/126055
--
https://code.launchpad.net/~openerp-dev/openobject-addons/trunk-imp_copy_l10n-abo/+merge/126055
Your team OpenERP R&D Team is subscribed to branch
lp:~openerp-dev/openobject-addons/trunk-imp_copy_l10n-abo.
=== modified file 'account/account.py'
--- account/account.py 2012-09-20 09:27:26 +0000
+++ account/account.py 2012-09-24 17:04:23 +0000
@@ -601,7 +601,7 @@
if not default:
default = {}
default = default.copy()
- default['code'] = (account['code'] or '') + '(copy)'
+ default.update(code=_("%s (copy)") % (account['code'] or ''))
if not local:
done_list = []
if account.id in done_list:
@@ -782,9 +782,10 @@
if not default:
default = {}
default = default.copy()
- default['code'] = (journal['code'] or '') + '(copy)'
- default['name'] = (journal['name'] or '') + '(copy)'
- default['sequence_id'] = False
+ default.update(
+ code=_("%s (copy)") % (journal['code'] or ''),
+ name=_("%s (copy)") % (journal['name'] or ''),
+ sequence_id=False)
return super(account_journal, self).copy(cr, uid, id, default, context=context)
def write(self, cr, uid, ids, vals, context=None):
=== modified file 'account_coda/account_coda.py'
--- account_coda/account_coda.py 2012-09-14 05:52:48 +0000
+++ account_coda/account_coda.py 2012-09-24 17:04:23 +0000
@@ -107,11 +107,12 @@
if not default:
default = {}
default = default.copy()
- default.update({'journal_id': None})
- default['description1'] = cba['description1'] or ''
- default['description2'] = cba['description2'] or ''
- default['name'] = (cba['name'] or '') + ' (copy)'
- default['state'] = cba['state']
+ default.update(
+ journal_id=None,
+ description1=cba['description1'] or '',
+ description2=cba['description2'] or '',
+ name=_("%s (copy)") % (cba['name'] or ''),
+ state=cba['state'])
return super(coda_bank_account, self).copy(cr, uid, id, default, context)
def onchange_state(self, cr, uid, ids, state):
=== modified file 'analytic/analytic.py'
--- analytic/analytic.py 2012-09-21 13:14:24 +0000
+++ analytic/analytic.py 2012-09-24 17:04:23 +0000
@@ -223,9 +223,10 @@
if not default:
default = {}
analytic = self.browse(cr, uid, id, context=context)
- default['code'] = False
- default['line_ids'] = []
- default['name'] = analytic['name'] + ' (' + _('copy') + ')'
+ default.update(
+ code=False,
+ line_ids=[],
+ name=_("%s (copy)") % (analytic['name']))
return super(account_analytic_account, self).copy(cr, uid, id, default, context=context)
def on_change_company(self, cr, uid, id, company_id):
=== modified file 'document/document.py'
--- document/document.py 2012-08-06 17:08:41 +0000
+++ document/document.py 2012-09-24 17:04:23 +0000
@@ -209,7 +209,7 @@
default = {}
if 'name' not in default:
name = self.read(cr, uid, [id], ['name'])[0]['name']
- default.update({'name': name + " " + _("(copy)")})
+ default.update(name=_("%s (copy)") % (name))
return super(document_file, self).copy(cr, uid, id, default, context=context)
def write(self, cr, uid, ids, vals, context=None):
=== modified file 'document/document_directory.py'
--- document/document_directory.py 2012-09-11 11:12:33 +0000
+++ document/document_directory.py 2012-09-24 17:04:23 +0000
@@ -231,7 +231,7 @@
if not default:
default ={}
name = self.read(cr, uid, [id])[0]['name']
- default.update({'name': name+ " (copy)"})
+ default.update(name=_("%s (copy)") % (name))
return super(document_directory,self).copy(cr, uid, id, default, context=context)
def _check_duplication(self, cr, uid, vals, ids=[], op='create'):
=== modified file 'email_template/email_template.py'
--- email_template/email_template.py 2012-09-24 15:56:00 +0000
+++ email_template/email_template.py 2012-09-24 17:04:23 +0000
@@ -215,8 +215,12 @@
if default is None:
default = {}
default = default.copy()
+<<<<<<< TREE
default['name'] = template.name + _('(copy)')
default.update(ref_ir_act_window=False, ref_ir_value=False)
+=======
+ default.update(name=_("%s (copy)") % (template.name))
+>>>>>>> MERGE-SOURCE
return super(email_template, self).copy(cr, uid, id, default, context)
def build_expression(self, field_name, sub_field_name, null_value):
=== modified file 'hr_payroll/hr_payroll.py'
--- hr_payroll/hr_payroll.py 2012-09-14 11:27:56 +0000
+++ hr_payroll/hr_payroll.py 2012-09-24 17:04:23 +0000
@@ -81,10 +81,9 @@
"""
if not default:
default = {}
- default.update({
- 'code': self.browse(cr, uid, id, context=context).code + "(copy)",
- 'company_id': self.pool.get('res.users').browse(cr, uid, uid, context=context).company_id.id
- })
+ default.update(
+ code=_("%s (copy)") % (self.browse(cr, uid, id, context=context).code),
+ company_id=self.pool.get('res.users').browse(cr, uid, uid, context=context).company_id.id)
return super(hr_payroll_structure, self).copy(cr, uid, id, default, context=context)
def get_all_rules(self, cr, uid, structure_ids, context=None):
@@ -305,7 +304,7 @@
return False
return True
- _constraints = [(_check_dates, "Payslip 'Date From' must be before 'Date To'.", ['date_from', 'date_to'])]
+ _constraints = [(_check_dates, "Payslip 'Date From' must be before 'Date To'.", ['date_from', 'date_to'])]
def copy(self, cr, uid, id, default=None, context=None):
if not default:
@@ -851,7 +850,7 @@
"""
:param rule_id: id of rule to compute
:param localdict: dictionary containing the environement in which to compute the rule
- :return: returns a tuple build as the base/amount computed, the quantity and the rate
+ :return: returns a tuple build as the base/amount computed, the quantity and the rate
:rtype: (float, float, float)
"""
rule = self.browse(cr, uid, rule_id, context=context)
=== modified file 'mrp/mrp.py'
--- mrp/mrp.py 2012-09-12 11:30:46 +0000
+++ mrp/mrp.py 2012-09-24 17:04:23 +0000
@@ -356,7 +356,7 @@
if default is None:
default = {}
bom_data = self.read(cr, uid, id, [], context=context)
- default.update({'name': bom_data['name'] + ' ' + _('Copy'), 'bom_id':False})
+ default.update(name=_("%s (copy)") % (bom_data['name']), bom_id=False)
return super(mrp_bom, self).copy_data(cr, uid, id, default, context=context)
def create(self, cr, uid, vals, context=None):
=== modified file 'product/product.py'
--- product/product.py 2012-09-24 11:16:41 +0000
+++ product/product.py 2012-09-24 17:04:23 +0000
@@ -727,7 +727,7 @@
context_wo_lang.pop('lang', None)
product = self.read(cr, uid, id, ['name'], context=context_wo_lang)
default = default.copy()
- default['name'] = product['name'] + ' (' + _('copy') + ')'
+ default.update(name=_("%s (copy)") % (product['name']))
if context.get('variant',False):
fields = ['product_tmpl_id', 'active', 'variants', 'default_code',
=== modified file 'project/project.py'
--- project/project.py 2012-09-12 15:00:54 +0000
+++ project/project.py 2012-09-24 17:04:23 +0000
@@ -323,7 +323,7 @@
default.pop('alias_id', None)
proj = self.browse(cr, uid, id, context=context)
if not default.get('name', False):
- default['name'] = proj.name + _(' (copy)')
+ default.update(name=_("%s (copy)") % (proj.name))
res = super(project, self).copy(cr, uid, id, default, context)
self.map_tasks(cr,uid,id,res,context)
return res
@@ -344,7 +344,7 @@
new_date_end = (datetime(*time.strptime(new_date_start,'%Y-%m-%d')[:3])+(end_date-start_date)).strftime('%Y-%m-%d')
context.update({'copy':True})
new_id = self.copy(cr, uid, proj.id, default = {
- 'name': proj.name +_(' (copy)'),
+ 'name':_("%s (copy)") % (proj.name),
'state':'open',
'date_start':new_date_start,
'date':new_date_end,
@@ -694,7 +694,7 @@
if not default.get('name', False):
default['name'] = self.browse(cr, uid, id, context=context).name or ''
if not context.get('copy',False):
- new_name = _("%s (copy)")%default.get('name','')
+ new_name = _("%s (copy)") % (default.get('name', ''))
default.update({'name':new_name})
return super(task, self).copy_data(cr, uid, id, default, context)
=== modified file 'project_issue/project_issue.py'
--- project_issue/project_issue.py 2012-09-06 16:18:12 +0000
+++ project_issue/project_issue.py 2012-09-24 17:04:23 +0000
@@ -355,7 +355,7 @@
if not default:
default = {}
default = default.copy()
- default['name'] = issue['name'] + _(' (copy)')
+ default.update(name=_('%s (copy)') % (issue['name']))
return super(project_issue, self).copy(cr, uid, id, default=default,
context=context)
@@ -534,7 +534,7 @@
def _get_alias_models(self, cr, uid, context=None):
return [('project.task', "Tasks"), ("project.issue", "Issues")]
-
+
def _issue_count(self, cr, uid, ids, field_name, arg, context=None):
res = dict.fromkeys(ids, 0)
issue_ids = self.pool.get('project.issue').search(cr, uid, [('project_id', 'in', ids)])
@@ -557,7 +557,7 @@
_constraints = [
(_check_escalation, 'Error! You cannot assign escalation to the same project!', ['project_escalation_id'])
]
-
+
project()
class account_analytic_account(osv.osv):
=== modified file 'project_long_term/project_long_term.py'
--- project_long_term/project_long_term.py 2012-08-30 09:49:13 +0000
+++ project_long_term/project_long_term.py 2012-09-24 17:04:23 +0000
@@ -138,7 +138,7 @@
if default is None:
default = {}
if not default.get('name', False):
- default['name'] = self.browse(cr, uid, id, context=context).name + _(' (copy)')
+ default.update(name=_('%s (copy)') % (self.browse(cr, uid, id, context=context).name))
return super(project_phase, self).copy(cr, uid, id, default, context)
def set_draft(self, cr, uid, ids, *args):
@@ -227,7 +227,7 @@
'phase_ids': fields.one2many('project.phase', 'project_id', "Project Phases"),
'phase_count': fields.function(_phase_count, type='integer', string="Open Phases"),
}
-
+
def schedule_phases(self, cr, uid, ids, context=None):
context = context or {}
if type(ids) in (long, int,):
@@ -250,7 +250,7 @@
# Maybe it's better to update than unlink/create if it already exists ?
p = getattr(project_gantt, 'Phase_%d' % (phase.id,))
- self.pool.get('project.user.allocation').unlink(cr, uid,
+ self.pool.get('project.user.allocation').unlink(cr, uid,
[x.id for x in phase.user_ids],
context=context
)
=== modified file 'resource/resource.py'
--- resource/resource.py 2012-07-13 10:17:51 +0000
+++ resource/resource.py 2012-09-24 17:04:23 +0000
@@ -45,24 +45,24 @@
def working_hours_on_day(self, cr, uid, resource_calendar_id, day, context=None):
"""Calculates the Working Total Hours based on Resource Calendar and
given working day (datetime object).
-
+
@param resource_calendar_id: resource.calendar browse record
@param day: datetime object
-
+
@return: returns the working hours (as float) men should work on the given day if is in the attendance_ids of the resource_calendar_id (i.e if that day is a working day), returns 0.0 otherwise
"""
res = 0.0
for working_day in resource_calendar_id.attendance_ids:
if (int(working_day.dayofweek) + 1) == day.isoweekday():
res += working_day.hour_to - working_day.hour_from
- return res
+ return res
def _get_leaves(self, cr, uid, id, resource):
- """Private Method to Calculate resource Leaves days
-
+ """Private Method to Calculate resource Leaves days
+
@param id: resource calendar id
- @param resource: resource id for which leaves will ew calculated
-
+ @param resource: resource id for which leaves will ew calculated
+
@return : returns the list of dates, where resource on leave in
resource.calendar.leaves object (e.g.['%Y-%m-%d', '%Y-%m-%d'])
"""
@@ -85,9 +85,9 @@
"""
Calculates the working Schedule from supplied from date to till hours
will be satisfied based or resource calendar id. If resource is also
- given then it will consider the resource leave also and than will
+ given then it will consider the resource leave also and than will
calculates resource working schedule
-
+
@param dt_from: datetime object, start of working scheduled
@param hours: float, total number working hours needed scheduled from
start date
@@ -187,29 +187,29 @@
def interval_get(self, cr, uid, id, dt_from, hours, resource=False, byday=True):
"""Calculates Resource Working Internal Timing Based on Resource Calendar.
-
+
@param dt_from: start resource schedule calculation.
@param hours : total number of working hours to be scheduled.
- @param resource: optional resource id, If supplied it will take care of
+ @param resource: optional resource id, If supplied it will take care of
resource leave while scheduling.
@param byday: boolean flag bit enforce day wise scheduling
-
+
@return : list of scheduled working timing based on resource calendar.
"""
res = self.interval_get_multi(cr, uid, [(dt_from.strftime('%Y-%m-%d %H:%M:%S'), hours, id)], resource, byday)[(dt_from.strftime('%Y-%m-%d %H:%M:%S'), hours, id)]
return res
def interval_hours_get(self, cr, uid, id, dt_from, dt_to, resource=False):
- """ Calculates the Total Working hours based on given start_date to
- end_date, If resource id is supplied that it will consider the source
+ """ Calculates the Total Working hours based on given start_date to
+ end_date, If resource id is supplied that it will consider the source
leaves also in calculating the hours.
-
+
@param dt_from : date start to calculate hours
@param dt_end : date end to calculate hours
@param resource: optional resource id, If given resource leave will be
- considered.
-
- @return : Total number of working hours based dt_from and dt_end and
+ considered.
+
+ @return : Total number of working hours based dt_from and dt_end and
resource if supplied.
"""
if not id:
@@ -257,7 +257,7 @@
class resource_calendar_attendance(osv.osv):
_name = "resource.calendar.attendance"
_description = "Work Detail"
-
+
_columns = {
'name' : fields.char("Name", size=64, required=True),
'dayofweek': fields.selection([('0','Monday'),('1','Tuesday'),('2','Wednesday'),('3','Thursday'),('4','Friday'),('5','Saturday'),('6','Sunday')], 'Day of Week', required=True, select=True),
@@ -266,9 +266,9 @@
'hour_to' : fields.float("Work to", required=True),
'calendar_id' : fields.many2one("resource.calendar", "Resource's Calendar", required=True),
}
-
+
_order = 'dayofweek, hour_from'
-
+
_defaults = {
'dayofweek' : '0'
}
@@ -302,12 +302,12 @@
'company_id': lambda self, cr, uid, context: self.pool.get('res.company')._company_default_get(cr, uid, 'resource.resource', context=context)
}
-
+
def copy(self, cr, uid, id, default=None, context=None):
if default is None:
default = {}
if not default.get('name', False):
- default['name'] = self.browse(cr, uid, id, context=context).name + _(' (copy)')
+ default.update(name=_('%s (copy)') % (self.browse(cr, uid, id, context=context).name))
return super(resource_resource, self).copy(cr, uid, id, default, context)
def generate_resources(self, cr, uid, user_ids, calendar_id, context=None):
@@ -368,7 +368,7 @@
"""
if not calendar_id:
# Calendar is not specified: working days: 24/7
- return [('fri', '8:0-12:0','13:0-17:0'), ('thu', '8:0-12:0','13:0-17:0'), ('wed', '8:0-12:0','13:0-17:0'),
+ return [('fri', '8:0-12:0','13:0-17:0'), ('thu', '8:0-12:0','13:0-17:0'), ('wed', '8:0-12:0','13:0-17:0'),
('mon', '8:0-12:0','13:0-17:0'), ('tue', '8:0-12:0','13:0-17:0')]
resource_attendance_pool = self.pool.get('resource.calendar.attendance')
time_range = "8:00-8:00"
=== modified file 'survey/survey.py'
--- survey/survey.py 2012-09-20 09:09:11 +0000
+++ survey/survey.py 2012-09-24 17:04:23 +0000
@@ -94,7 +94,7 @@
def copy(self, cr, uid, ids, default=None, context=None):
vals = {}
current_rec = self.read(cr, uid, ids, context=context)
- title = current_rec.get('title') + ' (Copy)'
+ title = _("%s (copy)") % (current_rec.get('title'))
vals.update({'title':title})
vals.update({'history':[],'tot_start_survey':0,'tot_comp_survey':0})
return super(survey, self).copy(cr, uid, ids, vals, context=context)
@@ -143,7 +143,7 @@
'nodestroy':True,
}
return report
-
+
def fill_survey(self, cr, uid, ids, context=None):
sur_obj = self.read(cr, uid, ids,['title'], context=context)
for sur in sur_obj:
@@ -232,7 +232,7 @@
def copy(self, cr, uid, ids, default=None, context=None):
vals = {}
current_rec = self.read(cr, uid, ids, context=context)
- title = current_rec.get('title') + ' (Copy)'
+ title = _("%s (copy)") % (current_rec.get('title'))
vals.update({'title':title})
return super(survey_page, self).copy(cr, uid, ids, vals, context=context)
_______________________________________________
Mailing list: https://launchpad.net/~openerp-dev-gtk
Post to : [email protected]
Unsubscribe : https://launchpad.net/~openerp-dev-gtk
More help : https://help.launchpad.net/ListHelp