[FIX] a few problems introduced with the last merge

bzr revid: abo@openerp.com-20121002111231-zo41jejkrm8afavu
This commit is contained in:
Antonin Bourguignon 2012-10-02 13:12:31 +02:00
parent 1653332080
commit 2b2288a3bd
10 changed files with 109 additions and 86 deletions

View File

@ -595,7 +595,7 @@ class account_account(osv.osv):
res.append((record['id'], name)) res.append((record['id'], name))
return res return res
def copy(self, cr, uid, id, None, context=None, done_list=None, local=False): def copy(self, cr, uid, id, default=None, context=None, done_list=None, local=False):
if default is None: if default is None:
default = {} default = {}
else: else:
@ -2281,9 +2281,10 @@ class account_model(osv.osv):
_defaults = { _defaults = {
'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'), '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'),
} }
def generate(self, cr, uid, ids, datas=None, context=None):
if datas is None: def generate(self, cr, uid, ids, data=None, context=None):
datas = {} if data is None:
data = {}
move_ids = [] move_ids = []
entry = {} entry = {}
account_move_obj = self.pool.get('account.move') account_move_obj = self.pool.get('account.move')
@ -2294,8 +2295,8 @@ class account_model(osv.osv):
if context is None: if context is None:
context = {} context = {}
if datas.get('date', False): if data.get('date', False):
context.update({'date': datas['date']}) context.update({'date': data['date']})
move_date = context.get('date', time.strftime('%Y-%m-%d')) move_date = context.get('date', time.strftime('%Y-%m-%d'))
move_date = datetime.strptime(move_date,"%Y-%m-%d") move_date = datetime.strptime(move_date,"%Y-%m-%d")
@ -2481,10 +2482,10 @@ class account_subscription_line(osv.osv):
all_moves = [] all_moves = []
obj_model = self.pool.get('account.model') obj_model = self.pool.get('account.model')
for line in self.browse(cr, uid, ids, context=context): for line in self.browse(cr, uid, ids, context=context):
datas = { data = {
'date': line.date, 'date': line.date,
} }
move_ids = obj_model.generate(cr, uid, [line.subscription_id.model_id.id], datas, context) move_ids = obj_model.generate(cr, uid, [line.subscription_id.model_id.id], data, context)
tocheck[line.subscription_id.id] = True tocheck[line.subscription_id.id] = True
self.write(cr, uid, [line.id], {'move_id':move_ids[0]}) self.write(cr, uid, [line.id], {'move_id':move_ids[0]})
all_moves.extend(move_ids) all_moves.extend(move_ids)

View File

@ -353,7 +353,7 @@ class audittrail_objects_proxy(object_proxy):
def prepare_audittrail_log_line(self, cr, uid, pool, model, resource_id, method, old_values, new_values, field_list=None): def prepare_audittrail_log_line(self, cr, uid, pool, model, resource_id, method, old_values, new_values, field_list=None):
""" """
This function compares the old data (i.e before the method was executed) and the new data This function compares the old data (i.e before the method was executed) and the new data
(after the method was executed) and returns a structure with all the needed information to (after the method was executed) and returns a structure with all the needed information to
log those differences. log those differences.
@ -377,7 +377,7 @@ class audittrail_objects_proxy(object_proxy):
(model.id, resource_id): [] (model.id, resource_id): []
} }
The reason why the structure returned is build as above is because when modifying an existing The reason why the structure returned is build as above is because when modifying an existing
record, we may have to log a change done in a x2many field of that object record, we may have to log a change done in a x2many field of that object
""" """
if field_list is None: if field_list is None:
@ -439,6 +439,8 @@ class audittrail_objects_proxy(object_proxy):
on specific fields only. on specific fields only.
:return: True :return: True
""" """
if field_list is None:
field_list = []
# loop on all the given ids # loop on all the given ids
for res_id in res_ids: for res_id in res_ids:
# compare old and new values and get audittrail log lines accordingly # compare old and new values and get audittrail log lines accordingly

View File

@ -262,7 +262,7 @@ class AddAttachment(unohelper.Base, XJobExecutor ):
# Can be None if len(strFilterSubName) <= 0 # Can be None if len(strFilterSubName) <= 0
return filename return filename
def _MakePropertyValue(self, cName="", uValue=u"" ): def _MakePropertyValue(self, cName="", uValue=u""):
oPropertyValue = createUnoStruct( "com.sun.star.beans.PropertyValue" ) oPropertyValue = createUnoStruct( "com.sun.star.beans.PropertyValue" )
if cName: if cName:
oPropertyValue.Name = cName oPropertyValue.Name = cName

View File

@ -3,31 +3,31 @@
# Portions of this file are under the following copyright and license: # Portions of this file are under the following copyright and license:
# #
# #
# Copyright (c) 2003-2004 Danny Brewer # Copyright (c) 2003-2004 Danny Brewer
# d29583@groovegarden.com # d29583@groovegarden.com
# #
# This library is free software; you can redistribute it and/or # This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public # modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either # License as published by the Free Software Foundation; either
# version 2.1 of the License, or (at your option) any later version. # version 2.1 of the License, or (at your option) any later version.
# #
# This library is distributed in the hope that it will be useful, # This library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of # but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# Lesser General Public License for more details. # Lesser General Public License for more details.
# #
# You should have received a copy of the GNU Lesser General Public # You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software # License along with this library; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
# #
# See: http://www.gnu.org/licenses/lgpl.html # See: http://www.gnu.org/licenses/lgpl.html
#
# #
#
# and other portions are under the following copyright and license: # and other portions are under the following copyright and license:
# #
# #
# OpenERP, Open Source Management Solution>.. # OpenERP, Open Source Management Solution>..
# Copyright (C) 2004-2010 OpenERP SA (<http://openerp.com>). # Copyright (C) 2004-2010 OpenERP SA (<http://openerp.com>).
# #
# This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by # it under the terms of the GNU Affero General Public License as published by
@ -216,6 +216,8 @@ class ConvertBracesToField( unohelper.Base, XJobExecutor ):
return sObject return sObject
def getBraces(self, aReportSyntex=None): def getBraces(self, aReportSyntex=None):
if aReportSyntex is None:
aReportSyntex = []
desktop=getDesktop() desktop=getDesktop()
doc = desktop.getCurrentComponent() doc = desktop.getCurrentComponent()
aSearchString=[] aSearchString=[]

View File

@ -15,6 +15,8 @@ def get(object, level=3, ending=None, ending_excl=None, recur=None, root=''):
ending = [] ending = []
if ending_excl is None: if ending_excl is None:
ending_excl = [] ending_excl = []
if recur is None:
recur = []
res = sock.execute('terp', 3, 'admin', 'account.invoice', 'fields_get') res = sock.execute('terp', 3, 'admin', 'account.invoice', 'fields_get')
key = res.keys() key = res.keys()
key.sort() key.sort()

View File

@ -41,13 +41,13 @@ def name2cp(k):
if k.startswith("&#") and k.endswith(";"): return int(k[2:-1]) # not in latin-1 if k.startswith("&#") and k.endswith(";"): return int(k[2:-1]) # not in latin-1
return ord(codecs.latin_1_decode(k)[0]) return ord(codecs.latin_1_decode(k)[0])
unifiable = {'rsquo':"'", 'lsquo':"'", 'rdquo':'"', 'ldquo':'"', unifiable = {'rsquo':"'", 'lsquo':"'", 'rdquo':'"', 'ldquo':'"',
'copy':'(C)', 'mdash':'--', 'nbsp':' ', 'rarr':'->', 'larr':'<-', 'middot':'*', 'copy':'(C)', 'mdash':'--', 'nbsp':' ', 'rarr':'->', 'larr':'<-', 'middot':'*',
'ndash':'-', 'oelig':'oe', 'aelig':'ae', 'ndash':'-', 'oelig':'oe', 'aelig':'ae',
'agrave':'a', 'aacute':'a', 'acirc':'a', 'atilde':'a', 'auml':'a', 'aring':'a', 'agrave':'a', 'aacute':'a', 'acirc':'a', 'atilde':'a', 'auml':'a', 'aring':'a',
'egrave':'e', 'eacute':'e', 'ecirc':'e', 'euml':'e', 'egrave':'e', 'eacute':'e', 'ecirc':'e', 'euml':'e',
'igrave':'i', 'iacute':'i', 'icirc':'i', 'iuml':'i', 'igrave':'i', 'iacute':'i', 'icirc':'i', 'iuml':'i',
'ograve':'o', 'oacute':'o', 'ocirc':'o', 'otilde':'o', 'ouml':'o', 'ograve':'o', 'oacute':'o', 'ocirc':'o', 'otilde':'o', 'ouml':'o',
'ugrave':'u', 'uacute':'u', 'ucirc':'u', 'uuml':'u'} 'ugrave':'u', 'uacute':'u', 'ucirc':'u', 'uuml':'u'}
unifiable_n = {} unifiable_n = {}
@ -60,7 +60,7 @@ def charref(name):
c = int(name[1:], 16) c = int(name[1:], 16)
else: else:
c = int(name) c = int(name)
if not UNICODE_SNOB and c in unifiable_n.keys(): if not UNICODE_SNOB and c in unifiable_n.keys():
return unifiable_n[c] return unifiable_n[c]
else: else:
@ -76,14 +76,14 @@ def entityref(c):
def replaceEntities(s): def replaceEntities(s):
s = s.group(1) s = s.group(1)
if s[0] == "#": if s[0] == "#":
return charref(s[1:]) return charref(s[1:])
else: return entityref(s) else: return entityref(s)
r_unescape = re.compile(r"&(#?[xX]?(?:[0-9a-fA-F]+|\w{1,8}));") r_unescape = re.compile(r"&(#?[xX]?(?:[0-9a-fA-F]+|\w{1,8}));")
def unescape(s): def unescape(s):
return r_unescape.sub(replaceEntities, s) return r_unescape.sub(replaceEntities, s)
def fixattrs(attrs): def fixattrs(attrs):
# Fix bug in sgmllib.py # Fix bug in sgmllib.py
if not attrs: return attrs if not attrs: return attrs
@ -105,7 +105,7 @@ def optwrap(text):
"""Wrap all paragraphs in the provided text.""" """Wrap all paragraphs in the provided text."""
if not BODY_WIDTH: if not BODY_WIDTH:
return text return text
assert wrap, "Requires Python 2.3." assert wrap, "Requires Python 2.3."
result = '' result = ''
newlines = 0 newlines = 0
@ -136,7 +136,7 @@ def hn(tag):
class _html2text(sgmllib.SGMLParser): class _html2text(sgmllib.SGMLParser):
def __init__(self, out=sys.stdout.write, baseurl=''): def __init__(self, out=sys.stdout.write, baseurl=''):
sgmllib.SGMLParser.__init__(self) sgmllib.SGMLParser.__init__(self)
if out is None: self.out = self.outtextf if out is None: self.out = self.outtextf
else: self.out = out else: self.out = out
self.outtext = u'' self.outtext = u''
@ -157,43 +157,43 @@ class _html2text(sgmllib.SGMLParser):
self.abbr_data = None # last inner HTML (for abbr being defined) self.abbr_data = None # last inner HTML (for abbr being defined)
self.abbr_list = {} # stack of abbreviations to write later self.abbr_list = {} # stack of abbreviations to write later
self.baseurl = baseurl self.baseurl = baseurl
def outtextf(self, s): def outtextf(self, s):
self.outtext += s self.outtext += s
def close(self): def close(self):
sgmllib.SGMLParser.close(self) sgmllib.SGMLParser.close(self)
self.pbr() self.pbr()
self.o('', 0, 'end') self.o('', 0, 'end')
return self.outtext return self.outtext
def handle_charref(self, c): def handle_charref(self, c):
self.o(charref(c)) self.o(charref(c))
def handle_entityref(self, c): def handle_entityref(self, c):
self.o(entityref(c)) self.o(entityref(c))
def unknown_starttag(self, tag, attrs): def unknown_starttag(self, tag, attrs):
self.handle_tag(tag, attrs, 1) self.handle_tag(tag, attrs, 1)
def unknown_endtag(self, tag): def unknown_endtag(self, tag):
self.handle_tag(tag, None, 0) self.handle_tag(tag, None, 0)
def previousIndex(self, attrs): def previousIndex(self, attrs):
""" returns the index of certain set of attributes (of a link) in the """ returns the index of certain set of attributes (of a link) in the
self.a list self.a list
If the set of attributes is not found, returns None If the set of attributes is not found, returns None
""" """
if not attrs.has_key('href'): return None if not attrs.has_key('href'): return None
i = -1 i = -1
for a in self.a: for a in self.a:
i += 1 i += 1
match = 0 match = 0
if a.has_key('href') and a['href'] == attrs['href']: if a.has_key('href') and a['href'] == attrs['href']:
if a.has_key('title') or attrs.has_key('title'): if a.has_key('title') or attrs.has_key('title'):
if (a.has_key('title') and attrs.has_key('title') and if (a.has_key('title') and attrs.has_key('title') and
@ -206,13 +206,13 @@ class _html2text(sgmllib.SGMLParser):
def handle_tag(self, tag, attrs, start): def handle_tag(self, tag, attrs, start):
attrs = fixattrs(attrs) attrs = fixattrs(attrs)
if hn(tag): if hn(tag):
self.p() self.p()
if start: self.o(hn(tag)*"#" + ' ') if start: self.o(hn(tag)*"#" + ' ')
if tag in ['p', 'div']: self.p() if tag in ['p', 'div']: self.p()
if tag == "br" and start: self.o(" \n") if tag == "br" and start: self.o(" \n")
if tag == "hr" and start: if tag == "hr" and start:
@ -220,21 +220,21 @@ class _html2text(sgmllib.SGMLParser):
self.o("* * *") self.o("* * *")
self.p() self.p()
if tag in ["head", "style", 'script']: if tag in ["head", "style", 'script']:
if start: self.quiet += 1 if start: self.quiet += 1
else: self.quiet -= 1 else: self.quiet -= 1
if tag in ["body"]: if tag in ["body"]:
self.quiet = 0 # sites like 9rules.com never close <head> self.quiet = 0 # sites like 9rules.com never close <head>
if tag == "blockquote": if tag == "blockquote":
if start: if start:
self.p(); self.o('> ', 0, 1); self.start = 1 self.p(); self.o('> ', 0, 1); self.start = 1
self.blockquote += 1 self.blockquote += 1
else: else:
self.blockquote -= 1 self.blockquote -= 1
self.p() self.p()
if tag in ['em', 'i', 'u']: self.o("_") if tag in ['em', 'i', 'u']: self.o("_")
if tag in ['strong', 'b']: self.o("**") if tag in ['strong', 'b']: self.o("**")
if tag == "code" and not self.pre: self.o('`') #TODO: `` `this` `` if tag == "code" and not self.pre: self.o('`') #TODO: `` `this` ``
@ -243,7 +243,7 @@ class _html2text(sgmllib.SGMLParser):
attrsD = {} attrsD = {}
for (x, y) in attrs: attrsD[x] = y for (x, y) in attrs: attrsD[x] = y
attrs = attrsD attrs = attrsD
self.abbr_title = None self.abbr_title = None
self.abbr_data = '' self.abbr_data = ''
if attrs.has_key('title'): if attrs.has_key('title'):
@ -253,13 +253,13 @@ class _html2text(sgmllib.SGMLParser):
self.abbr_list[self.abbr_data] = self.abbr_title self.abbr_list[self.abbr_data] = self.abbr_title
self.abbr_title = None self.abbr_title = None
self.abbr_data = '' self.abbr_data = ''
if tag == "a": if tag == "a":
if start: if start:
attrsD = {} attrsD = {}
for (x, y) in attrs: attrsD[x] = y for (x, y) in attrs: attrsD[x] = y
attrs = attrsD attrs = attrsD
if attrs.has_key('href') and not (SKIP_INTERNAL_LINKS and attrs['href'].startswith('#')): if attrs.has_key('href') and not (SKIP_INTERNAL_LINKS and attrs['href'].startswith('#')):
self.astack.append(attrs) self.astack.append(attrs)
self.o("[") self.o("[")
else: else:
@ -277,7 +277,7 @@ class _html2text(sgmllib.SGMLParser):
a['outcount'] = self.outcount a['outcount'] = self.outcount
self.a.append(a) self.a.append(a)
self.o("][" + `a['count']` + "]") self.o("][" + `a['count']` + "]")
if tag == "img" and start: if tag == "img" and start:
attrsD = {} attrsD = {}
for (x, y) in attrs: attrsD[x] = y for (x, y) in attrs: attrsD[x] = y
@ -296,20 +296,20 @@ class _html2text(sgmllib.SGMLParser):
self.o("![") self.o("![")
self.o(alt) self.o(alt)
self.o("]["+`attrs['count']`+"]") self.o("]["+`attrs['count']`+"]")
if tag == 'dl' and start: self.p() if tag == 'dl' and start: self.p()
if tag == 'dt' and not start: self.pbr() if tag == 'dt' and not start: self.pbr()
if tag == 'dd' and start: self.o(' ') if tag == 'dd' and start: self.o(' ')
if tag == 'dd' and not start: self.pbr() if tag == 'dd' and not start: self.pbr()
if tag in ["ol", "ul"]: if tag in ["ol", "ul"]:
if start: if start:
self.list.append({'name':tag, 'num':0}) self.list.append({'name':tag, 'num':0})
else: else:
if self.list: self.list.pop() if self.list: self.list.pop()
self.p() self.p()
if tag == 'li': if tag == 'li':
if start: if start:
self.pbr() self.pbr()
@ -323,10 +323,10 @@ class _html2text(sgmllib.SGMLParser):
self.start = 1 self.start = 1
else: else:
self.pbr() self.pbr()
if tag in ["table", "tr"] and start: self.p() if tag in ["table", "tr"] and start: self.p()
if tag == 'td': self.pbr() if tag == 'td': self.pbr()
if tag == "pre": if tag == "pre":
if start: if start:
self.startpre = 1 self.startpre = 1
@ -334,34 +334,35 @@ class _html2text(sgmllib.SGMLParser):
else: else:
self.pre = 0 self.pre = 0
self.p() self.p()
def pbr(self): def pbr(self):
if self.p_p == 0: self.p_p = 1 if self.p_p == 0: self.p_p = 1
def p(self): def p(self):
self.p_p = 2
def o(self, data, puredata=0, force=0): def o(self, data, puredata=0, force=0):
if self.abbr_data is not None: self.abbr_data += data if self.abbr_data is not None: self.abbr_data += data
if not self.quiet: if not self.quiet:
if puredata and not self.pre: if puredata and not self.pre:
data = re.sub('\s+', ' ', data) data = re.sub('\s+', ' ', data)
if data and data[0] == ' ': if data and data[0] == ' ':
self.space = 1 self.space = 1
data = data[1:] data = data[1:]
if not data and not force: return if not data and not force: return
if self.startpre: if self.startpre:
#self.out(" :") #TODO: not output when already one there #self.out(" :") #TODO: not output when already one there
self.startpre = 0 self.startpre = 0
bq = (">" * self.blockquote) bq = (">" * self.blockquote)
if not (force and data and data[0] == ">") and self.blockquote: bq += " " if not (force and data and data[0] == ">") and self.blockquote: bq += " "
if self.pre: if self.pre:
bq += " " bq += " "
data = data.replace("\n", "\n"+bq) data = data.replace("\n", "\n"+bq)
if self.start: if self.start:
self.space = 0 self.space = 0
self.p_p = 0 self.p_p = 0
@ -377,7 +378,7 @@ class _html2text(sgmllib.SGMLParser):
if self.p_p: if self.p_p:
self.out(('\n'+bq)*self.p_p) self.out(('\n'+bq)*self.p_p)
self.space = 0 self.space = 0
if self.space: if self.space:
if not self.lastWasNL: self.out(' ') if not self.lastWasNL: self.out(' ')
self.space = 0 self.space = 0
@ -388,7 +389,7 @@ class _html2text(sgmllib.SGMLParser):
newa = [] newa = []
for link in self.a: for link in self.a:
if self.outcount > link['outcount']: if self.outcount > link['outcount']:
self.out(" ["+`link['count']`+"]: " + urlparse.urljoin(self.baseurl, link['href'])) self.out(" ["+`link['count']`+"]: " + urlparse.urljoin(self.baseurl, link['href']))
if link.has_key('title'): self.out(" ("+link['title']+")") if link.has_key('title'): self.out(" ("+link['title']+")")
self.out("\n") self.out("\n")
else: else:
@ -397,7 +398,7 @@ class _html2text(sgmllib.SGMLParser):
if self.a != newa: self.out("\n") # Don't need an extra line when nothing was done. if self.a != newa: self.out("\n") # Don't need an extra line when nothing was done.
self.a = newa self.a = newa
if self.abbr_list and force == "end": if self.abbr_list and force == "end":
for abbr, definition in self.abbr_list.items(): for abbr, definition in self.abbr_list.items():
self.out(" *[" + abbr + "]: " + definition + "\n") self.out(" *[" + abbr + "]: " + definition + "\n")
@ -410,7 +411,7 @@ class _html2text(sgmllib.SGMLParser):
def handle_data(self, data): def handle_data(self, data):
if r'\/script>' in data: self.quiet -= 1 if r'\/script>' in data: self.quiet -= 1
self.o(data, 1) self.o(data, 1)
def unknown_decl(self, data): def unknown_decl(self, data):
pass pass

View File

@ -52,6 +52,8 @@ class account_analytic_line(osv.osv):
invoices = [] invoices = []
if context is None: if context is None:
context = {} context = {}
if data is None:
data = {}
account_ids = {} account_ids = {}
for line in self.pool.get('account.analytic.line').browse(cr, uid, ids, context=context): for line in self.pool.get('account.analytic.line').browse(cr, uid, ids, context=context):
@ -86,14 +88,14 @@ class account_analytic_line(osv.osv):
'date_due': date_due, 'date_due': date_due,
'fiscal_position': account.partner_id.property_account_position.id 'fiscal_position': account.partner_id.property_account_position.id
} }
context2 = context.copy() context2 = context.copy()
context2['lang'] = partner.lang context2['lang'] = partner.lang
# set company_id in context, so the correct default journal will be selected # set company_id in context, so the correct default journal will be selected
context2['force_company'] = curr_invoice['company_id'] context2['force_company'] = curr_invoice['company_id']
# set force_company in context so the correct product properties are selected (eg. income account) # set force_company in context so the correct product properties are selected (eg. income account)
context2['company_id'] = curr_invoice['company_id'] context2['company_id'] = curr_invoice['company_id']
last_invoice = invoice_obj.create(cr, uid, curr_invoice, context=context2) last_invoice = invoice_obj.create(cr, uid, curr_invoice, context=context2)
invoices.append(last_invoice) invoices.append(last_invoice)

View File

@ -50,4 +50,14 @@ class l10n_fr_line(osv.osv):
l10n_fr_line() l10n_fr_line()
class res_company(osv.osv):
_inherit = 'res.company'
_columns = {
'siret': fields.char('SIRET', size=64),
'ape': fields.char('APE', size=64),
}
res_company()
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -616,6 +616,8 @@ class mrp_production(osv.osv):
@param properties: List containing dictionaries of properties. @param properties: List containing dictionaries of properties.
@return: No. of products. @return: No. of products.
""" """
if properties is None:
properties = []
results = [] results = []
bom_obj = self.pool.get('mrp.bom') bom_obj = self.pool.get('mrp.bom')
uom_obj = self.pool.get('product.uom') uom_obj = self.pool.get('product.uom')
@ -834,7 +836,7 @@ class mrp_production(osv.osv):
'product_id': wc.product_id.id, 'product_id': wc.product_id.id,
'unit_amount': wc_line.hour, 'unit_amount': wc_line.hour,
'product_uom_id': wc.product_id.id and wc.product_id.uom_id.id or False 'product_uom_id': wc.product_id.id and wc.product_id.uom_id.id or False
} ) } )
if wc.costs_journal_id and wc.costs_general_account_id: if wc.costs_journal_id and wc.costs_general_account_id:
value = wc_line.cycle * wc.costs_cycle value = wc_line.cycle * wc.costs_cycle
@ -851,7 +853,7 @@ class mrp_production(osv.osv):
'product_id': wc.product_id.id, 'product_id': wc.product_id.id,
'unit_amount': wc_line.cycle, 'unit_amount': wc_line.cycle,
'product_uom_id': wc.product_id.id and wc.product_id.uom_id.id or False 'product_uom_id': wc.product_id.id and wc.product_id.uom_id.id or False
} ) } )
return amount return amount

View File

@ -312,8 +312,9 @@ class project(osv.osv):
def copy(self, cr, uid, id, default=None, context=None): def copy(self, cr, uid, id, default=None, context=None):
if context is None: if context is None:
context = {} context = {}
if default is None:
default = {}
default = default or {}
context['active_test'] = False context['active_test'] = False
default['state'] = 'open' default['state'] = 'open'
default['tasks'] = [] default['tasks'] = []