'name': name,
'code': code
}
- type_id = seq_typ_pool.create(cr, uid, types)
+ seq_typ_pool.create(cr, uid, types)
seq = {
'name': name,
context = {}
invoice = context.get('invoice', False)
valid_moves = self.validate(cr, uid, ids, context)
-
+
if not valid_moves:
raise osv.except_osv(_('Integrity Error !'), _('You cannot validate a non-balanced entry !\nMake sure you have configured Payment Term properly !\nIt should contain atleast one Payment Term Line with type "Balance" !'))
-
+
for move in self.browse(cr, uid, valid_moves):
if move.name =='/':
new_name = False
'SET state=%s '\
'WHERE id IN %s',
('posted', tuple(valid_moves),))
-
+
return True
def button_validate(self, cursor, user, ids, context=None):
##############################################################################
import time
-from operator import itemgetter
import decimal_precision as dp
-from lxml import etree
import netsvc
from osv import fields, osv, orm
import pooler
-from tools import config
from tools.translate import _
class account_invoice(osv.osv):
if not result_id:
raise osv.except_osv(_('Configuration Error !'),
_('Can not find account chart for this company in invoice line account, Please Create account.'))
- r_id = self.pool.get('account.invoice.line').write(cr, uid, [line.id], {'account_id': result_id[0]})
+ self.pool.get('account.invoice.line').write(cr, uid, [line.id], {'account_id': result_id[0]})
else:
if invoice_line:
for inv_line in invoice_line:
wf_service.trg_create(uid, 'account.invoice', inv_id, cr)
return True
- def finalize_invoice_move_lines(self, cr, uid, invoice_browse, move_lines):
- """finalize_invoice_move_lines(cr, uid, invoice, move_lines) -> move_lines
- Hook method to be overridden in additional modules to verify and possibly alter the
- move lines to be created by an invoice, for special cases.
- :param invoice_browse: browsable record of the invoice that is generating the move lines
- :param move_lines: list of dictionaries with the account.move.lines (as for create())
- :return: the (possibly updated) final move_lines to create for this invoice
- """
- return move_lines
-
# Workflow stuff
#################
self.write(cr, uid, [inv.id], {'date_invoice':time.strftime('%Y-%m-%d')})
company_currency = inv.company_id.currency_id.id
# create the analytical lines
- line_ids = self.read(cr, uid, [inv.id], ['invoice_line'])[0]['invoice_line']
# one move line per invoice line
iml = self._get_analytic_lines(cr, uid, inv.id)
# check if taxes are all computed
if a:
result['account_id'] = a
- taxep = None
- tax_obj = self.pool.get('account.tax')
if type in ('out_invoice', 'out_refund'):
taxes = res.taxes_id and res.taxes_id or (a and self.pool.get('account.account').browse(cr, uid, a).tax_ids or False)
tax_id = fpos_obj.map_tax(cr, uid, fpos, taxes)
def move_line_get(self, cr, uid, invoice_id, context=None):
res = []
- tax_grouped = {}
tax_obj = self.pool.get('account.tax')
cur_obj = self.pool.get('res.currency')
- ait_obj = self.pool.get('account.invoice.tax')
inv = self.pool.get('account.invoice').browse(cr, uid, invoice_id)
company_currency = inv.company_id.currency_id.id
- cur = inv.currency_id
for line in inv.invoice_line:
mres = self.move_line_get_item(cr, uid, line, context)
import time
-import netsvc
from osv import osv, fields
from tools.translate import _
for account_id in form['account_ids']:
params = (account_id,)
if not allow_write_off:
- query = """SELECT partner_id FROM account_move_line WHERE account_id=%s AND reconcile_id IS NULL
- AND state <> 'draft' GROUP BY partner_id
+ query = """SELECT partner_id FROM account_move_line WHERE account_id=%s AND reconcile_id IS NULL
+ AND state <> 'draft' GROUP BY partner_id
HAVING ABS(SUM(debit-credit)) = 0.0 AND count(*)>0"""
else:
- query = """SELECT partner_id FROM account_move_line WHERE account_id=%s AND reconcile_id IS NULL
- AND state <> 'draft' GROUP BY partner_id
+ query = """SELECT partner_id FROM account_move_line WHERE account_id=%s AND reconcile_id IS NULL
+ AND state <> 'draft' GROUP BY partner_id
HAVING ABS(SUM(debit-credit)) < %s AND count(*)>0"""
params += (max_amount,)
# reconcile automatically all transactions from partners whose balance is 0