bzr revid: fp@tinyerp.com-20090820153205-1j6pt7x12uzms06m
This commit is contained in:
Fabien Pinckaers 2009-08-20 17:32:05 +02:00
commit b7f5aa52c5
9 changed files with 73 additions and 43 deletions

View File

@ -857,7 +857,6 @@ class account_move_line(osv.osv):
if not ok:
raise osv.except_osv(_('Bad account !'), _('You can not use this general account in this journal !'))
# result = super(osv.osv, self).create(cr, uid, vals, context)
if 'analytic_account_id' in vals and vals['analytic_account_id']:
if journal.analytic_journal_id:
vals['analytic_lines'] = [(0,0, {
@ -943,11 +942,12 @@ class account_move_line(osv.osv):
self.create(cr, uid, data, context)
del vals['account_tax_id']
if not is_new_move and 'date' in vals:
if context and ('__last_update' in context):
del context['__last_update']
self.pool.get('account.move').write(cr, uid, [move_id], {'date':vals['date']}, context=context)
if check:
# No needed, related to the job
#if not is_new_move and 'date' in vals:
# if context and ('__last_update' in context):
# del context['__last_update']
# self.pool.get('account.move').write(cr, uid, [move_id], {'date':vals['date']}, context=context)
if check and not context.get('no_store_function'):
tmp = self.pool.get('account.move').validate(cr, uid, [vals['move_id']], context)
if journal.entry_posted and tmp:
self.pool.get('account.move').button_validate(cr,uid, [vals['move_id']],context)

View File

@ -232,23 +232,23 @@ class account_invoice(osv.osv):
'move_id': fields.many2one('account.move', 'Invoice Movement', readonly=True, help="Link to the automatically generated account moves."),
'amount_untaxed': fields.function(_amount_all, method=True, digits=(16,2),string='Untaxed',
store={
'account.invoice': (lambda self, cr, uid, ids, c={}: ids, None, 20),
'account.invoice': (lambda self, cr, uid, ids, c={}: ids, ['invoice_line'], 20),
'account.invoice.tax': (_get_invoice_tax, None, 20),
'account.invoice.line': (_get_invoice_line, None, 20),
'account.invoice.line': (_get_invoice_line, ['price_unit','invoice_line_tax_id','quantity','discount'], 20),
},
multi='all'),
'amount_tax': fields.function(_amount_all, method=True, digits=(16,2), string='Tax',
store={
'account.invoice': (lambda self, cr, uid, ids, c={}: ids, None, 20),
'account.invoice': (lambda self, cr, uid, ids, c={}: ids, ['invoice_line'], 20),
'account.invoice.tax': (_get_invoice_tax, None, 20),
'account.invoice.line': (_get_invoice_line, None, 20),
'account.invoice.line': (_get_invoice_line, ['price_unit','invoice_line_tax_id','quantity','discount'], 20),
},
multi='all'),
'amount_total': fields.function(_amount_all, method=True, digits=(16,2), string='Total',
store={
'account.invoice': (lambda self, cr, uid, ids, c={}: ids, None, 20),
'account.invoice': (lambda self, cr, uid, ids, c={}: ids, ['invoice_line'], 20),
'account.invoice.tax': (_get_invoice_tax, None, 20),
'account.invoice.line': (_get_invoice_line, None, 20),
'account.invoice.line': (_get_invoice_line, ['price_unit','invoice_line_tax_id','quantity','discount'], 20),
},
multi='all'),
'currency_id': fields.many2one('res.currency', 'Currency', required=True, readonly=True, states={'draft':[('readonly',False)]}),
@ -257,7 +257,7 @@ class account_invoice(osv.osv):
'check_total': fields.float('Total', digits=(16,2), states={'open':[('readonly',True)],'close':[('readonly',True)]}),
'reconciled': fields.function(_reconciled, method=True, string='Paid/Reconciled', type='boolean',
store={
'account.invoice': (lambda self, cr, uid, ids, c={}: ids, None, 50),
'account.invoice': (lambda self, cr, uid, ids, c={}: ids, None, 50), # Check if we can remove ?
'account.move.line': (_get_invoice_from_line, None, 50),
'account.move.reconcile': (_get_invoice_from_reconcile, None, 50),
}, help="The account moves of the invoice have been reconciled with account moves of the payment(s)."),
@ -266,9 +266,9 @@ class account_invoice(osv.osv):
'move_lines':fields.function(_get_lines , method=True,type='many2many' , relation='account.move.line',string='Move Lines'),
'residual': fields.function(_amount_residual, method=True, digits=(16,2),string='Residual',
store={
'account.invoice': (lambda self, cr, uid, ids, c={}: ids, None, 50),
'account.invoice': (lambda self, cr, uid, ids, c={}: ids, ['invoice_line'], 50),
'account.invoice.tax': (_get_invoice_tax, None, 50),
'account.invoice.line': (_get_invoice_line, None, 50),
'account.invoice.line': (_get_invoice_line, ['price_unit','invoice_line_tax_id','quantity','discount'], 50),
'account.move.line': (_get_invoice_from_line, None, 50),
'account.move.reconcile': (_get_invoice_from_reconcile, None, 50),
},
@ -389,14 +389,14 @@ class account_invoice(osv.osv):
# return the ids of the move lines which has the same account than the invoice
# whose id is in ids
def move_line_id_payment_get(self, cr, uid, ids, *args):
ml = self.pool.get('account.move.line')
res = []
for inv in self.read(cr, uid, ids, ['move_id','account_id']):
if inv['move_id']:
move_line_ids = ml.search(cr, uid, [('move_id', '=', inv['move_id'][0])])
for line in ml.read(cr, uid, move_line_ids, ['account_id']):
if line['account_id']==inv['account_id']:
res.append(line['id'])
if not ids: return res
cr.execute('select \
l.id \
from account_move_line l \
left join account_invoice i on (i.move_id=l.move_id) \
where i.id in ('+','.join(map(str,ids))+') and l.account_id=i.account_id')
res = map(lambda x: x[0], cr.fetchall())
return res
def copy(self, cr, uid, id, default=None, context=None):

View File

@ -174,7 +174,7 @@ class node_class(object):
res = fobj.browse(self.cr, self.uid, file_ids, context=self.context)
result +=map(lambda x: node_class(self.cr, self.uid, self.path+'/'+eval('x.'+fobj._rec_name), x, False, context=self.context, type='file', root=self.root), res)
if self.type=='collection' and self.object.type=="ressource":
where = self.object.domain and eval(self.object.domain, {'active_id':self.root}) or []
where = self.object.domain and eval(self.object.domain, {'active_id':self.root, 'uid':self.uid}) or []
pool = pooler.get_pool(self.cr.dbname)
obj = pool.get(self.object.ressource_type_id.model)
_dirname_field = obj._rec_name

View File

@ -35,23 +35,59 @@ if len(pps) == 2:
PASSIVE_PORTS = int(pps[0]), int(pps[1])
class ftp_server(threading.Thread):
def log(self, level, message):
def log(self, level, message):
logger = netsvc.Logger()
logger.notifyChannel('FTP', level, message)
def detect_ip_addr(self):
def _detect_ip_addr():
from array import array
import socket
from struct import pack, unpack
try:
import fcntl
except ImportError:
fcntl = None
if not fcntl: # not UNIX:
hostname = socket.gethostname()
ip_addr = socket.gethostbyname(hostname)
else: # UNIX:
# get all interfaces:
nbytes = 128 * 32
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
names = array('B', '\0' * nbytes)
outbytes = unpack('iL', fcntl.ioctl( s.fileno(), 0x8912, pack('iL', nbytes, names.buffer_info()[0])))[0]
namestr = names.tostring()
ifaces = [namestr[i:i+32].split('\0', 1)[0] for i in range(0, outbytes, 32)]
for ifname in [iface for iface in ifaces if iface != 'lo']:
ip_addr = socket.inet_ntoa(fcntl.ioctl(s.fileno(), 0x8915, pack('256s', ifname[:15]))[20:24])
break
return ip_addr
try:
ip_addr = _detect_ip_addr()
except:
ip_addr = ''
return ip_addr
def run(self):
autho = authorizer.authorizer()
autho = authorizer.authorizer()
ftpserver.FTPHandler.authorizer = autho
ftpserver.max_cons = 300
ftpserver.max_cons_per_ip = 50
ftpserver.FTPHandler.abstracted_fs = abstracted_fs.abstracted_fs
if PASSIVE_PORTS:
ftpserver.FTPHandler.passive_ports = PASSIVE_PORTS
ftpserver.log = lambda msg: self.log(netsvc.LOG_INFO, msg)
ftpserver.logline = lambda msg: None
ftpserver.logerror = lambda msg: self.log(netsvc.LOG_ERROR, msg)
HOST = self.detect_ip_addr()
address = (HOST, PORT)
ftpd = ftpserver.FTPServer(address, ftpserver.FTPHandler)
ftpd.serve_forever()

View File

@ -974,11 +974,6 @@ msgstr "Montant en unité de mesure"
msgid "Run procurement"
msgstr "Lancer les approvisionnements"
#. module: mrp
#: help:mrp.workcenter,time_efficiency:0
msgid "Factor that multiplies all times expressed in the workcenter."
msgstr ""
#. module: mrp
#: help:res.company,schedule_range:0
msgid "This is the time frame analysed by the scheduler when computing procurements. All procurement that are not between today and today+range are skipped for futur computation."

View File

@ -46,7 +46,6 @@ class pos_order(osv.osv):
_name = "pos.order"
_description = "Point of Sale"
_order = "date_order, create_date desc"
_order = "date_order desc, name desc"
def unlink(self, cr, uid, ids, context={}):
for rec in self.browse(cr, uid, ids, context=context):
@ -231,7 +230,7 @@ class pos_order(osv.osv):
def test_paid(self, cr, uid, ids, context=None):
def deci(val):
return Decimal(str(val))
return Decimal("%f" % (val, ))
for order in self.browse(cr, uid, ids, context):
if order.lines and not order.amount_total:

View File

@ -42,10 +42,10 @@
<field name="model">report.analytic.account.close</field>
<field name="type">graph</field>
<field name="arch" type="xml">
<graph string="Expired analytic accounts">
<field group="True" name="partner_id"/>
<graph string="Expired analytic accounts" type="bar">
<field name="partner_id"/>
<field name="quantity" operator="+"/>
<field name="quantity_max" operator="+"/>
<field name="quantity_max" operator="+"/>
</graph>
</field>
</record>

View File

@ -232,20 +232,20 @@ class sale_order(osv.osv):
'amount_untaxed': fields.function(_amount_all, method=True, string='Untaxed Amount',
store={
'sale.order': (lambda self, cr, uid, ids, c={}: ids, None, 10),
'sale.order.line': (_get_order, None, 10),
'sale.order': (lambda self, cr, uid, ids, c={}: ids, ['order_line'], 10),
'sale.order.line': (_get_order, ['price_unit','tax_id','discount','product_uom_qty'], 10),
},
multi='sums'),
'amount_tax': fields.function(_amount_all, method=True, string='Taxes',
store={
'sale.order': (lambda self, cr, uid, ids, c={}: ids, None, 10),
'sale.order.line': (_get_order, None, 10),
'sale.order': (lambda self, cr, uid, ids, c={}: ids, ['order_line'], 10),
'sale.order.line': (_get_order, ['price_unit','tax_id','discount','product_uom_qty'], 10),
},
multi='sums'),
'amount_total': fields.function(_amount_all, method=True, string='Total',
store={
'sale.order': (lambda self, cr, uid, ids, c={}: ids, None, 10),
'sale.order.line': (_get_order, None, 10),
'sale.order': (lambda self, cr, uid, ids, c={}: ids, ['order_line'], 10),
'sale.order.line': (_get_order, ['price_unit','tax_id','discount','product_uom_qty'], 10),
},
multi='sums'),

View File

@ -407,7 +407,7 @@ class stock_picking(osv.osv):
return res
def create(self, cr, user, vals, context=None):
if 'name' not in vals:
if ('name' not in vals) or (vals.get('name')=='/'):
vals['name'] = self.pool.get('ir.sequence').get(cr, user, 'stock.picking')
return super(stock_picking, self).create(cr, user, vals, context)