diff options
| author | Fabien Pinckaers <fp@tinyerp.com> | 2009-08-20 17:32:05 +0200 |
|---|---|---|
| committer | Fabien Pinckaers <fp@tinyerp.com> | 2009-08-20 17:32:05 +0200 |
| commit | b7f5aa52c553ce7ea1902016b59ea4a5f1817693 (patch) | |
| tree | 619087ce9bef5a1e2a61ecb68f0567e994600d43 | |
| parent | e09353891cce38b81d1f0c207467236480a6874e (diff) | |
| parent | ccb6079cd038170daca3028b11d1212599d89b3a (diff) | |
merge
bzr revid: fp@tinyerp.com-20090820153205-1j6pt7x12uzms06m
| -rw-r--r-- | addons/account/account_move_line.py | 12 | ||||
| -rw-r--r-- | addons/account/invoice.py | 32 | ||||
| -rw-r--r-- | addons/document/document.py | 2 | ||||
| -rw-r--r-- | addons/document/ftpserver/__init__.py | 42 | ||||
| -rw-r--r-- | addons/mrp/i18n/fr_FR.po | 5 | ||||
| -rw-r--r-- | addons/point_of_sale/pos.py | 3 | ||||
| -rw-r--r-- | addons/report_analytic/report_analytic_view.xml | 6 | ||||
| -rw-r--r-- | addons/sale/sale.py | 12 | ||||
| -rw-r--r-- | addons/stock/stock.py | 2 |
9 files changed, 73 insertions, 43 deletions
diff --git a/addons/account/account_move_line.py b/addons/account/account_move_line.py index c2d474a3441..1ed28ff2588 100644 --- a/addons/account/account_move_line.py +++ b/addons/account/account_move_line.py @@ -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) diff --git a/addons/account/invoice.py b/addons/account/invoice.py index c641b417e14..b3c5316b68f 100644 --- a/addons/account/invoice.py +++ b/addons/account/invoice.py @@ -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): diff --git a/addons/document/document.py b/addons/document/document.py index 1b0d6ad680f..cafbb074e28 100644 --- a/addons/document/document.py +++ b/addons/document/document.py @@ -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 diff --git a/addons/document/ftpserver/__init__.py b/addons/document/ftpserver/__init__.py index 7895755da5f..7a68a7e5821 100644 --- a/addons/document/ftpserver/__init__.py +++ b/addons/document/ftpserver/__init__.py @@ -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() diff --git a/addons/mrp/i18n/fr_FR.po b/addons/mrp/i18n/fr_FR.po index e77f8c6771d..68d3b0b5a34 100644 --- a/addons/mrp/i18n/fr_FR.po +++ b/addons/mrp/i18n/fr_FR.po @@ -975,11 +975,6 @@ 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." msgstr "Ceci est la fenêtre de temps analysée par le planificateur lors du calcul des approvisionnement. Tous les approvisionnements qui ne sont pas entre aujourdhui et aujourdhui+plage seront ignorés des prochains calculs." diff --git a/addons/point_of_sale/pos.py b/addons/point_of_sale/pos.py index 7c71436373d..be588a156dd 100644 --- a/addons/point_of_sale/pos.py +++ b/addons/point_of_sale/pos.py @@ -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: diff --git a/addons/report_analytic/report_analytic_view.xml b/addons/report_analytic/report_analytic_view.xml index 87aa0c3b858..dc1a6fd1b71 100644 --- a/addons/report_analytic/report_analytic_view.xml +++ b/addons/report_analytic/report_analytic_view.xml @@ -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> diff --git a/addons/sale/sale.py b/addons/sale/sale.py index 212b9f1903b..ca988922c8a 100644 --- a/addons/sale/sale.py +++ b/addons/sale/sale.py @@ -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'), diff --git a/addons/stock/stock.py b/addons/stock/stock.py index 7c533f3cc2c..4398877df43 100644 --- a/addons/stock/stock.py +++ b/addons/stock/stock.py @@ -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) |
