[Merge]Merge lp:openobject-addons
bzr revid: vja@tinyerp.com-20130128115031-dy2ib57ox6rl7c4r
This commit is contained in:
commit
d24459e4a9
|
@ -133,7 +133,9 @@ for a particular financial year and for preparation of vouchers there is a modul
|
|||
"static/src/xml/account_move_reconciliation.xml",
|
||||
"static/src/xml/account_move_line_quickadd.xml",
|
||||
],
|
||||
'css':['static/src/css/account_move_reconciliation.css'
|
||||
'css':[
|
||||
'static/src/css/account_move_reconciliation.css',
|
||||
'static/src/css/account_move_line_quickadd.css'
|
||||
],
|
||||
'demo': [
|
||||
'demo/account_demo.xml',
|
||||
|
|
|
@ -19,19 +19,19 @@
|
|||
#
|
||||
##############################################################################
|
||||
|
||||
import time
|
||||
import logging
|
||||
from datetime import datetime
|
||||
from dateutil.relativedelta import relativedelta
|
||||
from operator import itemgetter
|
||||
import time
|
||||
|
||||
import logging
|
||||
import pooler
|
||||
from osv import fields, osv
|
||||
import decimal_precision as dp
|
||||
from tools.translate import _
|
||||
from tools.float_utils import float_round
|
||||
from openerp import SUPERUSER_ID
|
||||
import tools
|
||||
from openerp import pooler, tools
|
||||
from openerp.osv import fields, osv
|
||||
from openerp.tools.translate import _
|
||||
from openerp.tools.float_utils import float_round
|
||||
|
||||
import openerp.addons.decimal_precision as dp
|
||||
|
||||
_logger = logging.getLogger(__name__)
|
||||
|
||||
|
@ -705,7 +705,7 @@ class account_journal(osv.osv):
|
|||
'with_last_closing_balance' : fields.boolean('Opening With Last Closing Balance'),
|
||||
'name': fields.char('Journal Name', size=64, required=True),
|
||||
'code': fields.char('Code', size=5, required=True, help="The code will be displayed on reports."),
|
||||
'type': fields.selection([('sale', 'Sale'),('sale_refund','Sale Refund'), ('purchase', 'Purchase'), ('purchase_refund','Purchase Refund'), ('cash', 'Cash'), ('bank', 'Bank and Cheques'), ('general', 'General'), ('situation', 'Opening/Closing Situation')], 'Type', size=32, required=True,
|
||||
'type': fields.selection([('sale', 'Sale'),('sale_refund','Sale Refund'), ('purchase', 'Purchase'), ('purchase_refund','Purchase Refund'), ('cash', 'Cash'), ('bank', 'Bank and Checks'), ('general', 'General'), ('situation', 'Opening/Closing Situation')], 'Type', size=32, required=True,
|
||||
help="Select 'Sale' for customer invoices journals."\
|
||||
" Select 'Purchase' for supplier invoices journals."\
|
||||
" Select 'Cash' or 'Bank' for journals that are used in customer or supplier payments."\
|
||||
|
@ -715,7 +715,7 @@ class account_journal(osv.osv):
|
|||
'account_control_ids': fields.many2many('account.account', 'account_account_type_rel', 'journal_id','account_id', 'Account', domain=[('type','<>','view'), ('type', '<>', 'closed')]),
|
||||
'default_credit_account_id': fields.many2one('account.account', 'Default Credit Account', domain="[('type','!=','view')]", help="It acts as a default account for credit amount"),
|
||||
'default_debit_account_id': fields.many2one('account.account', 'Default Debit Account', domain="[('type','!=','view')]", help="It acts as a default account for debit amount"),
|
||||
'centralisation': fields.boolean('Centralised Counterpart', help="Check this box to determine that each entry of this journal won't create a new counterpart but will share the same counterpart. This is used in fiscal year closing."),
|
||||
'centralisation': fields.boolean('Centralized Counterpart', help="Check this box to determine that each entry of this journal won't create a new counterpart but will share the same counterpart. This is used in fiscal year closing."),
|
||||
'update_posted': fields.boolean('Allow Cancelling Entries', help="Check this box if you want to allow the cancellation the entries related to this journal or of the invoice related to this journal"),
|
||||
'group_invoice_lines': fields.boolean('Group Invoice Lines', help="If this box is checked, the system will try to group the accounting lines when generating them from invoices."),
|
||||
'sequence_id': fields.many2one('ir.sequence', 'Entry Sequence', help="This field contains the information related to the numbering of the journal entries of this journal.", required=True),
|
||||
|
@ -1014,10 +1014,15 @@ class account_period(osv.osv):
|
|||
else:
|
||||
company_id = self.pool.get('res.users').browse(cr, uid, uid, context=context).company_id.id
|
||||
args.append(('company_id', '=', company_id))
|
||||
ids = self.search(cr, uid, args, context=context)
|
||||
if not ids:
|
||||
raise osv.except_osv(_('Error!'), _('There is no period defined for this date: %s.\nPlease create one.')%dt)
|
||||
return ids
|
||||
result = []
|
||||
if context.get('account_period_prefer_normal'):
|
||||
# look for non-special periods first, and fallback to all if no result is found
|
||||
result = self.search(cr, uid, args + [('special', '=', False)], context=context)
|
||||
if not result:
|
||||
result = self.search(cr, uid, args, context=context)
|
||||
if not result:
|
||||
raise osv.except_osv(_('Error !'), _('There is no period defined for this date: %s.\nPlease create one.')%dt)
|
||||
return result
|
||||
|
||||
def action_draft(self, cr, uid, ids, *args):
|
||||
mode = 'draft'
|
||||
|
@ -1191,10 +1196,9 @@ class account_move(osv.osv):
|
|||
return res
|
||||
|
||||
def _get_period(self, cr, uid, context=None):
|
||||
periods = self.pool.get('account.period').find(cr, uid)
|
||||
if periods:
|
||||
return periods[0]
|
||||
return False
|
||||
ctx = dict(context or {}, account_period_prefer_normal=True)
|
||||
period_ids = self.pool.get('account.period').find(cr, uid, context=ctx)
|
||||
return period_ids[0]
|
||||
|
||||
def _amount_compute(self, cr, uid, ids, name, args, context, where =''):
|
||||
if not ids: return {}
|
||||
|
@ -1459,6 +1463,7 @@ class account_move(osv.osv):
|
|||
line_id = self.pool.get('account.move.line').create(cr, uid, {
|
||||
'name': _(mode.capitalize()+' Centralisation'),
|
||||
'centralisation': mode,
|
||||
'partner_id': False,
|
||||
'account_id': account_id,
|
||||
'move_id': move.id,
|
||||
'journal_id': move.journal_id.id,
|
||||
|
@ -1497,6 +1502,7 @@ class account_move(osv.osv):
|
|||
line_id = self.pool.get('account.move.line').create(cr, uid, {
|
||||
'name': _('Currency Adjustment'),
|
||||
'centralisation': 'currency',
|
||||
'partner_id': False,
|
||||
'account_id': account_id,
|
||||
'move_id': move.id,
|
||||
'journal_id': move.journal_id.id,
|
||||
|
@ -3348,10 +3354,25 @@ class wizard_multi_charts_accounts(osv.osv_memory):
|
|||
all the provided information to create the accounts, the banks, the journals, the taxes, the tax codes, the
|
||||
accounting properties... accordingly for the chosen company.
|
||||
'''
|
||||
obj_data = self.pool.get('ir.model.data')
|
||||
ir_values_obj = self.pool.get('ir.values')
|
||||
obj_wizard = self.browse(cr, uid, ids[0])
|
||||
company_id = obj_wizard.company_id.id
|
||||
|
||||
self.pool.get('res.company').write(cr, uid, [company_id], {'currency_id': obj_wizard.currency_id.id})
|
||||
|
||||
# When we install the CoA of first company, set the currency to price types and pricelists
|
||||
if company_id==1:
|
||||
for ref in (('product','list_price'),('product','standard_price'),('product','list0'),('purchase','list0')):
|
||||
try:
|
||||
tmp2 = obj_data.get_object_reference(cr, uid, *ref)
|
||||
if tmp2:
|
||||
self.pool.get(tmp2[0]).write(cr, uid, tmp2[1], {
|
||||
'currency_id': obj_wizard.currency_id.id
|
||||
})
|
||||
except ValueError, e:
|
||||
pass
|
||||
|
||||
# If the floats for sale/purchase rates have been filled, create templates from them
|
||||
self._create_tax_templates_from_rates(cr, uid, obj_wizard, company_id, context=context)
|
||||
|
||||
|
|
|
@ -19,9 +19,9 @@
|
|||
#
|
||||
##############################################################################
|
||||
|
||||
from osv import fields
|
||||
from osv import osv
|
||||
from tools.translate import _
|
||||
from openerp.osv import fields
|
||||
from openerp.osv import osv
|
||||
from openerp.tools.translate import _
|
||||
|
||||
class account_analytic_line(osv.osv):
|
||||
_inherit = 'account.analytic.line'
|
||||
|
@ -82,7 +82,7 @@ class account_analytic_line(osv.osv):
|
|||
if j_id.type == 'purchase':
|
||||
unit = prod.uom_po_id.id
|
||||
if j_id.type <> 'sale':
|
||||
a = prod.product_tmpl_id.property_account_expense.id
|
||||
a = prod.property_account_expense.id
|
||||
if not a:
|
||||
a = prod.categ_id.property_account_expense_categ.id
|
||||
if not a:
|
||||
|
@ -91,7 +91,7 @@ class account_analytic_line(osv.osv):
|
|||
'for this product: "%s" (id:%d).') % \
|
||||
(prod.name, prod.id,))
|
||||
else:
|
||||
a = prod.product_tmpl_id.property_account_income.id
|
||||
a = prod.property_account_income.id
|
||||
if not a:
|
||||
a = prod.categ_id.property_account_income_categ.id
|
||||
if not a:
|
||||
|
|
|
@ -19,8 +19,8 @@
|
|||
#
|
||||
##############################################################################
|
||||
|
||||
from tools.translate import _
|
||||
from osv import fields, osv
|
||||
from openerp.tools.translate import _
|
||||
from openerp.osv import fields, osv
|
||||
|
||||
class bank(osv.osv):
|
||||
_inherit = "res.partner.bank"
|
||||
|
|
|
@ -21,9 +21,9 @@
|
|||
|
||||
import time
|
||||
|
||||
from osv import fields, osv
|
||||
from tools.translate import _
|
||||
import decimal_precision as dp
|
||||
from openerp.osv import fields, osv
|
||||
from openerp.tools.translate import _
|
||||
import openerp.addons.decimal_precision as dp
|
||||
|
||||
class account_bank_statement(osv.osv):
|
||||
def create(self, cr, uid, vals, context=None):
|
||||
|
@ -439,10 +439,11 @@ class account_bank_statement(osv.osv):
|
|||
for st in self.browse(cr, uid, ids, context=context):
|
||||
if st.state=='draft':
|
||||
continue
|
||||
ids = []
|
||||
move_ids = []
|
||||
for line in st.line_ids:
|
||||
ids += [x.id for x in line.move_ids]
|
||||
account_move_obj.unlink(cr, uid, ids, context)
|
||||
move_ids += [x.id for x in line.move_ids]
|
||||
account_move_obj.button_cancel(cr, uid, move_ids, context=context)
|
||||
account_move_obj.unlink(cr, uid, move_ids, context)
|
||||
done.append(st.id)
|
||||
return self.write(cr, uid, done, {'state':'draft'}, context=context)
|
||||
|
||||
|
@ -546,7 +547,7 @@ class account_bank_statement_line(osv.osv):
|
|||
_name = "account.bank.statement.line"
|
||||
_description = "Bank Statement Line"
|
||||
_columns = {
|
||||
'name': fields.char('Communication', size=64, required=True),
|
||||
'name': fields.char('OBI', required=True, help="Originator to Beneficiary Information"),
|
||||
'date': fields.date('Date', required=True),
|
||||
'amount': fields.float('Amount', digits_compute=dp.get_precision('Account')),
|
||||
'type': fields.selection([
|
||||
|
|
|
@ -22,9 +22,9 @@
|
|||
|
||||
import time
|
||||
|
||||
from osv import osv, fields
|
||||
from tools.translate import _
|
||||
import decimal_precision as dp
|
||||
from openerp.osv import fields, osv
|
||||
from openerp.tools.translate import _
|
||||
import openerp.addons.decimal_precision as dp
|
||||
|
||||
class account_cashbox_line(osv.osv):
|
||||
|
||||
|
|
|
@ -24,11 +24,11 @@ from datetime import datetime
|
|||
from dateutil.relativedelta import relativedelta
|
||||
from operator import itemgetter
|
||||
|
||||
import netsvc
|
||||
import pooler
|
||||
from osv import fields, osv
|
||||
import decimal_precision as dp
|
||||
from tools.translate import _
|
||||
from openerp import netsvc
|
||||
from openerp import pooler
|
||||
from openerp.osv import fields, osv
|
||||
import openerp.addons.decimal_precision as dp
|
||||
from openerp.tools.translate import _
|
||||
|
||||
# ---------------------------------------------------------
|
||||
# Account Financial Report
|
||||
|
|
|
@ -21,12 +21,12 @@
|
|||
|
||||
import time
|
||||
from lxml import etree
|
||||
import decimal_precision as dp
|
||||
import openerp.addons.decimal_precision as dp
|
||||
|
||||
import netsvc
|
||||
import pooler
|
||||
from osv import fields, osv, orm
|
||||
from tools.translate import _
|
||||
from openerp import netsvc
|
||||
from openerp import pooler
|
||||
from openerp.osv import fields, osv, orm
|
||||
from openerp.tools.translate import _
|
||||
|
||||
class account_invoice(osv.osv):
|
||||
def _amount_all(self, cr, uid, ids, name, args, context=None):
|
||||
|
@ -184,7 +184,14 @@ class account_invoice(osv.osv):
|
|||
_inherit = ['mail.thread']
|
||||
_description = 'Invoice'
|
||||
_order = "id desc"
|
||||
|
||||
_track = {
|
||||
'type': {
|
||||
},
|
||||
'state': {
|
||||
'account.mt_invoice_paid': lambda self, cr, uid, obj, ctx=None: obj['state'] == 'paid' and obj['type'] in ('out_invoice', 'out_refund'),
|
||||
'account.mt_invoice_validated': lambda self, cr, uid, obj, ctx=None: obj['state'] == 'open' and obj['type'] in ('out_invoice', 'out_refund'),
|
||||
},
|
||||
}
|
||||
_columns = {
|
||||
'name': fields.char('Description', size=64, select=True, readonly=True, states={'draft':[('readonly',False)]}),
|
||||
'origin': fields.char('Source Document', size=64, help="Reference of the document that produced this invoice.", readonly=True, states={'draft':[('readonly',False)]}),
|
||||
|
@ -194,7 +201,7 @@ class account_invoice(osv.osv):
|
|||
('in_invoice','Supplier Invoice'),
|
||||
('out_refund','Customer Refund'),
|
||||
('in_refund','Supplier Refund'),
|
||||
],'Type', readonly=True, select=True, change_default=True),
|
||||
],'Type', readonly=True, select=True, change_default=True, track_visibility='always'),
|
||||
|
||||
'number': fields.related('move_id','name', type='char', readonly=True, size=64, relation='account.move', store=True, string='Number'),
|
||||
'internal_number': fields.char('Invoice Number', size=32, readonly=True, help="Unique number of the invoice, computed automatically when the invoice is created."),
|
||||
|
@ -210,7 +217,7 @@ class account_invoice(osv.osv):
|
|||
('open','Open'),
|
||||
('paid','Paid'),
|
||||
('cancel','Cancelled'),
|
||||
],'Status', select=True, readonly=True,
|
||||
],'Status', select=True, readonly=True, track_visibility='onchange',
|
||||
help=' * The \'Draft\' status is used when a user is encoding a new and unconfirmed Invoice. \
|
||||
\n* The \'Pro-forma\' when invoice is in Pro-forma status,invoice does not have an invoice number. \
|
||||
\n* The \'Open\' status is used when user create invoice,a invoice number is generated.Its in open status till user does not pay invoice. \
|
||||
|
@ -221,8 +228,8 @@ class account_invoice(osv.osv):
|
|||
'date_due': fields.date('Due Date', readonly=True, states={'draft':[('readonly',False)]}, select=True,
|
||||
help="If you use payment terms, the due date will be computed automatically at the generation "\
|
||||
"of accounting entries. The payment term may compute several due dates, for example 50% now and 50% in one month, but if you want to force a due date, make sure that the payment term is not set on the invoice. If you keep the payment term and the due date empty, it means direct payment."),
|
||||
'partner_id': fields.many2one('res.partner', 'Partner', change_default=True, readonly=True, required=True, states={'draft':[('readonly',False)]}),
|
||||
'payment_term': fields.many2one('account.payment.term', 'Payment Term',readonly=True, states={'draft':[('readonly',False)]},
|
||||
'partner_id': fields.many2one('res.partner', 'Partner', change_default=True, readonly=True, required=True, states={'draft':[('readonly',False)]}, track_visibility='always'),
|
||||
'payment_term': fields.many2one('account.payment.term', 'Payment Terms',readonly=True, states={'draft':[('readonly',False)]},
|
||||
help="If you use payment terms, the due date will be computed automatically at the generation "\
|
||||
"of accounting entries. If you keep the payment term and the due date empty, it means direct payment. "\
|
||||
"The payment term may compute several due dates, for example 50% now, 50% in one month."),
|
||||
|
@ -233,7 +240,7 @@ class account_invoice(osv.osv):
|
|||
'tax_line': fields.one2many('account.invoice.tax', 'invoice_id', 'Tax Lines', readonly=True, states={'draft':[('readonly',False)]}),
|
||||
|
||||
'move_id': fields.many2one('account.move', 'Journal Entry', readonly=True, select=1, ondelete='restrict', help="Link to the automatically generated Journal Items."),
|
||||
'amount_untaxed': fields.function(_amount_all, digits_compute=dp.get_precision('Account'), string='Untaxed',
|
||||
'amount_untaxed': fields.function(_amount_all, digits_compute=dp.get_precision('Account'), string='Subtotal', track_visibility='always',
|
||||
store={
|
||||
'account.invoice': (lambda self, cr, uid, ids, c={}: ids, ['invoice_line'], 20),
|
||||
'account.invoice.tax': (_get_invoice_tax, None, 20),
|
||||
|
@ -254,7 +261,7 @@ class account_invoice(osv.osv):
|
|||
'account.invoice.line': (_get_invoice_line, ['price_unit','invoice_line_tax_id','quantity','discount','invoice_id'], 20),
|
||||
},
|
||||
multi='all'),
|
||||
'currency_id': fields.many2one('res.currency', 'Currency', required=True, readonly=True, states={'draft':[('readonly',False)]}),
|
||||
'currency_id': fields.many2one('res.currency', 'Currency', required=True, readonly=True, states={'draft':[('readonly',False)]}, track_visibility='always'),
|
||||
'journal_id': fields.many2one('account.journal', 'Journal', required=True, readonly=True, states={'draft':[('readonly',False)]}),
|
||||
'company_id': fields.many2one('res.company', 'Company', required=True, change_default=True, readonly=True, states={'draft':[('readonly',False)]}),
|
||||
'check_total': fields.float('Verification Total', digits_compute=dp.get_precision('Account'), readonly=True, states={'draft':[('readonly',False)]}),
|
||||
|
@ -278,7 +285,7 @@ class account_invoice(osv.osv):
|
|||
help="Remaining amount due."),
|
||||
'payment_ids': fields.function(_compute_lines, relation='account.move.line', type="many2many", string='Payments'),
|
||||
'move_name': fields.char('Journal Entry', size=64, readonly=True, states={'draft':[('readonly',False)]}),
|
||||
'user_id': fields.many2one('res.users', 'Salesperson', readonly=True, states={'draft':[('readonly',False)]}),
|
||||
'user_id': fields.many2one('res.users', 'Salesperson', readonly=True, track_visibility='onchange', states={'draft':[('readonly',False)]}),
|
||||
'fiscal_position': fields.many2one('account.fiscal.position', 'Fiscal Position', readonly=True, states={'draft':[('readonly',False)]})
|
||||
}
|
||||
_defaults = {
|
||||
|
@ -373,10 +380,7 @@ class account_invoice(osv.osv):
|
|||
if context is None:
|
||||
context = {}
|
||||
try:
|
||||
res = super(account_invoice, self).create(cr, uid, vals, context)
|
||||
if res:
|
||||
self.create_send_note(cr, uid, [res], context=context)
|
||||
return res
|
||||
return super(account_invoice, self).create(cr, uid, vals, context)
|
||||
except Exception, e:
|
||||
if '"journal_id" viol' in e.args[0]:
|
||||
raise orm.except_orm(_('Configuration Error!'),
|
||||
|
@ -440,7 +444,6 @@ class account_invoice(osv.osv):
|
|||
if context is None:
|
||||
context = {}
|
||||
self.write(cr, uid, ids, {'state':'paid'}, context=context)
|
||||
self.confirm_paid_send_note(cr, uid, ids, context=context)
|
||||
return True
|
||||
|
||||
def unlink(self, cr, uid, ids, context=None):
|
||||
|
@ -994,7 +997,8 @@ class account_invoice(osv.osv):
|
|||
'narration':inv.comment
|
||||
}
|
||||
period_id = inv.period_id and inv.period_id.id or False
|
||||
ctx.update({'company_id': inv.company_id.id})
|
||||
ctx.update(company_id=inv.company_id.id,
|
||||
account_period_prefer_normal=True)
|
||||
if not period_id:
|
||||
period_ids = period_obj.find(cr, uid, inv.date_invoice, context=ctx)
|
||||
period_id = period_ids and period_ids[0] or False
|
||||
|
@ -1046,13 +1050,12 @@ class account_invoice(osv.osv):
|
|||
self.write(cr, uid, ids, {})
|
||||
|
||||
for obj_inv in self.browse(cr, uid, ids, context=context):
|
||||
id = obj_inv.id
|
||||
invtype = obj_inv.type
|
||||
number = obj_inv.number
|
||||
move_id = obj_inv.move_id and obj_inv.move_id.id or False
|
||||
reference = obj_inv.reference or ''
|
||||
|
||||
self.write(cr, uid, ids, {'internal_number':number})
|
||||
self.write(cr, uid, ids, {'internal_number': number})
|
||||
|
||||
if invtype in ('in_invoice', 'in_refund'):
|
||||
if not reference:
|
||||
|
@ -1073,13 +1076,6 @@ class account_invoice(osv.osv):
|
|||
'WHERE account_move_line.move_id = %s ' \
|
||||
'AND account_analytic_line.move_id = account_move_line.id',
|
||||
(ref, move_id))
|
||||
|
||||
for inv_id, name in self.name_get(cr, uid, [id]):
|
||||
ctx = context.copy()
|
||||
if obj_inv.type in ('out_invoice', 'out_refund'):
|
||||
ctx = self.get_log_context(cr, uid, context=ctx)
|
||||
message = _("Invoice '%s' is validated.") % name
|
||||
self.message_post(cr, uid, [inv_id], body=message, context=context)
|
||||
return True
|
||||
|
||||
def action_cancel(self, cr, uid, ids, context=None):
|
||||
|
@ -1108,7 +1104,6 @@ class account_invoice(osv.osv):
|
|||
# will be automatically deleted too
|
||||
account_move_obj.unlink(cr, uid, move_ids, context=context)
|
||||
self._log_event(cr, uid, ids, -1.0, 'Cancel Invoice')
|
||||
self.invoice_cancel_send_note(cr, uid, ids, context=context)
|
||||
return True
|
||||
|
||||
###################
|
||||
|
@ -1149,73 +1144,92 @@ class account_invoice(osv.osv):
|
|||
ids = self.search(cr, user, [('name',operator,name)] + args, limit=limit, context=context)
|
||||
return self.name_get(cr, user, ids, context)
|
||||
|
||||
def _refund_cleanup_lines(self, cr, uid, lines):
|
||||
def _refund_cleanup_lines(self, cr, uid, lines, context=None):
|
||||
clean_lines = []
|
||||
for line in lines:
|
||||
del line['id']
|
||||
del line['invoice_id']
|
||||
for field in ('company_id', 'partner_id', 'account_id', 'product_id',
|
||||
'uos_id', 'account_analytic_id', 'tax_code_id', 'base_code_id'):
|
||||
if line.get(field):
|
||||
line[field] = line[field][0]
|
||||
if 'invoice_line_tax_id' in line:
|
||||
line['invoice_line_tax_id'] = [(6,0, line.get('invoice_line_tax_id', [])) ]
|
||||
return map(lambda x: (0,0,x), lines)
|
||||
clean_line = {}
|
||||
for field in line._all_columns.keys():
|
||||
if line._all_columns[field].column._type == 'many2one':
|
||||
clean_line[field] = line[field].id
|
||||
elif line._all_columns[field].column._type not in ['many2many','one2many']:
|
||||
clean_line[field] = line[field]
|
||||
elif field == 'invoice_line_tax_id':
|
||||
tax_list = []
|
||||
for tax in line[field]:
|
||||
tax_list.append(tax.id)
|
||||
clean_line[field] = [(6,0, tax_list)]
|
||||
clean_lines.append(clean_line)
|
||||
return map(lambda x: (0,0,x), clean_lines)
|
||||
|
||||
def refund(self, cr, uid, ids, date=None, period_id=None, description=None, journal_id=None):
|
||||
invoices = self.read(cr, uid, ids, ['name', 'type', 'number', 'reference', 'comment', 'date_due', 'partner_id', 'partner_contact', 'partner_insite', 'partner_ref', 'payment_term', 'account_id', 'currency_id', 'invoice_line', 'tax_line', 'journal_id', 'company_id', 'user_id', 'fiscal_position'])
|
||||
obj_invoice_line = self.pool.get('account.invoice.line')
|
||||
obj_invoice_tax = self.pool.get('account.invoice.tax')
|
||||
def _prepare_refund(self, cr, uid, invoice, date=None, period_id=None, description=None, journal_id=None, context=None):
|
||||
"""Prepare the dict of values to create the new refund from the invoice.
|
||||
This method may be overridden to implement custom
|
||||
refund generation (making sure to call super() to establish
|
||||
a clean extension chain).
|
||||
|
||||
:param integer invoice_id: id of the invoice to refund
|
||||
:param dict invoice: read of the invoice to refund
|
||||
:param string date: refund creation date from the wizard
|
||||
:param integer period_id: force account.period from the wizard
|
||||
:param string description: description of the refund from the wizard
|
||||
:param integer journal_id: account.journal from the wizard
|
||||
:return: dict of value to create() the refund
|
||||
"""
|
||||
obj_journal = self.pool.get('account.journal')
|
||||
new_ids = []
|
||||
for invoice in invoices:
|
||||
del invoice['id']
|
||||
|
||||
type_dict = {
|
||||
'out_invoice': 'out_refund', # Customer Invoice
|
||||
'in_invoice': 'in_refund', # Supplier Invoice
|
||||
'out_refund': 'out_invoice', # Customer Refund
|
||||
'in_refund': 'in_invoice', # Supplier Refund
|
||||
}
|
||||
|
||||
invoice_lines = obj_invoice_line.read(cr, uid, invoice['invoice_line'])
|
||||
invoice_lines = self._refund_cleanup_lines(cr, uid, invoice_lines)
|
||||
|
||||
tax_lines = obj_invoice_tax.read(cr, uid, invoice['tax_line'])
|
||||
tax_lines = filter(lambda l: l['manual'], tax_lines)
|
||||
tax_lines = self._refund_cleanup_lines(cr, uid, tax_lines)
|
||||
if journal_id:
|
||||
refund_journal_ids = [journal_id]
|
||||
elif invoice['type'] == 'in_invoice':
|
||||
refund_journal_ids = obj_journal.search(cr, uid, [('type','=','purchase_refund')])
|
||||
type_dict = {
|
||||
'out_invoice': 'out_refund', # Customer Invoice
|
||||
'in_invoice': 'in_refund', # Supplier Invoice
|
||||
'out_refund': 'out_invoice', # Customer Refund
|
||||
'in_refund': 'in_invoice', # Supplier Refund
|
||||
}
|
||||
invoice_data = {}
|
||||
for field in ['name', 'reference', 'comment', 'date_due', 'partner_id', 'company_id',
|
||||
'account_id', 'currency_id', 'payment_term', 'user_id', 'fiscal_position']:
|
||||
if invoice._all_columns[field].column._type == 'many2one':
|
||||
invoice_data[field] = invoice[field].id
|
||||
else:
|
||||
refund_journal_ids = obj_journal.search(cr, uid, [('type','=','sale_refund')])
|
||||
invoice_data[field] = invoice[field] if invoice[field] else False
|
||||
|
||||
if not date:
|
||||
date = time.strftime('%Y-%m-%d')
|
||||
invoice.update({
|
||||
'type': type_dict[invoice['type']],
|
||||
'date_invoice': date,
|
||||
'state': 'draft',
|
||||
'number': False,
|
||||
'invoice_line': invoice_lines,
|
||||
'tax_line': tax_lines,
|
||||
'journal_id': refund_journal_ids
|
||||
})
|
||||
if period_id:
|
||||
invoice.update({
|
||||
'period_id': period_id,
|
||||
})
|
||||
if description:
|
||||
invoice.update({
|
||||
'name': description,
|
||||
})
|
||||
# take the id part of the tuple returned for many2one fields
|
||||
for field in ('partner_id', 'company_id',
|
||||
'account_id', 'currency_id', 'payment_term', 'journal_id',
|
||||
'user_id', 'fiscal_position'):
|
||||
invoice[field] = invoice[field] and invoice[field][0]
|
||||
invoice_lines = self._refund_cleanup_lines(cr, uid, invoice.invoice_line, context=context)
|
||||
|
||||
tax_lines = filter(lambda l: l['manual'], invoice.tax_line)
|
||||
tax_lines = self._refund_cleanup_lines(cr, uid, tax_lines, context=context)
|
||||
if journal_id:
|
||||
refund_journal_ids = [journal_id]
|
||||
elif invoice['type'] == 'in_invoice':
|
||||
refund_journal_ids = obj_journal.search(cr, uid, [('type','=','purchase_refund')], context=context)
|
||||
else:
|
||||
refund_journal_ids = obj_journal.search(cr, uid, [('type','=','sale_refund')], context=context)
|
||||
|
||||
if not date:
|
||||
date = time.strftime('%Y-%m-%d')
|
||||
invoice_data.update({
|
||||
'type': type_dict[invoice['type']],
|
||||
'date_invoice': date,
|
||||
'state': 'draft',
|
||||
'number': False,
|
||||
'invoice_line': invoice_lines,
|
||||
'tax_line': tax_lines,
|
||||
'journal_id': refund_journal_ids and refund_journal_ids[0] or False,
|
||||
})
|
||||
if period_id:
|
||||
invoice_data['period_id'] = period_id
|
||||
if description:
|
||||
invoice_data['name'] = description
|
||||
return invoice_data
|
||||
|
||||
def refund(self, cr, uid, ids, date=None, period_id=None, description=None, journal_id=None, context=None):
|
||||
new_ids = []
|
||||
for invoice in self.browse(cr, uid, ids, context=context):
|
||||
invoice = self._prepare_refund(cr, uid, invoice,
|
||||
date=date,
|
||||
period_id=period_id,
|
||||
description=description,
|
||||
journal_id=journal_id,
|
||||
context=context)
|
||||
# create the new invoice
|
||||
new_ids.append(self.create(cr, uid, invoice))
|
||||
new_ids.append(self.create(cr, uid, invoice, context=context))
|
||||
|
||||
return new_ids
|
||||
|
||||
|
@ -1312,8 +1326,8 @@ class account_invoice(osv.osv):
|
|||
else:
|
||||
code = invoice.currency_id.symbol
|
||||
# TODO: use currency's formatting function
|
||||
msg = _("Invoice '%s' is paid partially: %s%s of %s%s (%s%s remaining).") % \
|
||||
(name, pay_amount, code, invoice.amount_total, code, total, code)
|
||||
msg = _("Invoice partially paid: %s%s of %s%s (%s%s remaining).") % \
|
||||
(pay_amount, code, invoice.amount_total, code, total, code)
|
||||
self.message_post(cr, uid, [inv_id], body=msg, context=context)
|
||||
self.pool.get('account.move.line').reconcile_partial(cr, uid, line_ids, 'manual', context)
|
||||
|
||||
|
@ -1321,35 +1335,6 @@ class account_invoice(osv.osv):
|
|||
self.pool.get('account.invoice').write(cr, uid, ids, {}, context=context)
|
||||
return True
|
||||
|
||||
# -----------------------------------------
|
||||
# OpenChatter notifications and need_action
|
||||
# -----------------------------------------
|
||||
|
||||
def _get_document_type(self, type):
|
||||
type_dict = {
|
||||
# Translation markers will have no effect at runtime, only used to properly flag export
|
||||
'out_invoice': _('Customer invoice'),
|
||||
'in_invoice': _('Supplier invoice'),
|
||||
'out_refund': _('Customer Refund'),
|
||||
'in_refund': _('Supplier Refund'),
|
||||
}
|
||||
return type_dict.get(type, 'Invoice')
|
||||
|
||||
def create_send_note(self, cr, uid, ids, context=None):
|
||||
for obj in self.browse(cr, uid, ids, context=context):
|
||||
self.message_post(cr, uid, [obj.id], body=_("%s <b>created</b>.") % (self._get_document_type(obj.type)),
|
||||
subtype="account.mt_invoice_new", context=context)
|
||||
|
||||
def confirm_paid_send_note(self, cr, uid, ids, context=None):
|
||||
for obj in self.browse(cr, uid, ids, context=context):
|
||||
self.message_post(cr, uid, [obj.id], body=_("%s <b>paid</b>.") % (self._get_document_type(obj.type)),
|
||||
subtype="account.mt_invoice_paid", context=context)
|
||||
|
||||
def invoice_cancel_send_note(self, cr, uid, ids, context=None):
|
||||
for obj in self.browse(cr, uid, ids, context=context):
|
||||
self.message_post(cr, uid, [obj.id], body=_("%s <b>cancelled</b>.") % (self._get_document_type(obj.type)),
|
||||
context=context)
|
||||
|
||||
|
||||
class account_invoice_line(osv.osv):
|
||||
|
||||
|
@ -1395,7 +1380,7 @@ class account_invoice_line(osv.osv):
|
|||
'product_id': fields.many2one('product.product', 'Product', ondelete='set null', select=True),
|
||||
'account_id': fields.many2one('account.account', 'Account', required=True, domain=[('type','<>','view'), ('type', '<>', 'closed')], help="The income or expense account related to the selected product."),
|
||||
'price_unit': fields.float('Unit Price', required=True, digits_compute= dp.get_precision('Product Price')),
|
||||
'price_subtotal': fields.function(_amount_line, string='Subtotal', type="float",
|
||||
'price_subtotal': fields.function(_amount_line, string='Amount', type="float",
|
||||
digits_compute= dp.get_precision('Account'), store=True),
|
||||
'quantity': fields.float('Quantity', digits_compute= dp.get_precision('Product Unit of Measure'), required=True),
|
||||
'discount': fields.float('Discount (%)', digits_compute= dp.get_precision('Discount')),
|
||||
|
@ -1456,11 +1441,11 @@ class account_invoice_line(osv.osv):
|
|||
res = self.pool.get('product.product').browse(cr, uid, product, context=context)
|
||||
|
||||
if type in ('out_invoice','out_refund'):
|
||||
a = res.product_tmpl_id.property_account_income.id
|
||||
a = res.property_account_income.id
|
||||
if not a:
|
||||
a = res.categ_id.property_account_income_categ.id
|
||||
else:
|
||||
a = res.product_tmpl_id.property_account_expense.id
|
||||
a = res.property_account_expense.id
|
||||
if not a:
|
||||
a = res.categ_id.property_account_expense_categ.id
|
||||
a = fpos_obj.map_account(cr, uid, fpos, a)
|
||||
|
@ -1499,11 +1484,10 @@ class account_invoice_line(osv.osv):
|
|||
new_price = res_final['value']['price_unit'] * currency.rate
|
||||
res_final['value']['price_unit'] = new_price
|
||||
|
||||
if result['uos_id'] != res.uom_id.id:
|
||||
selected_uom = self.pool.get('product.uom_id').browse(cr, uid, result['uos_id'], context=context)
|
||||
if res.uom_id.category_id.id == selected_uom.category_id.id:
|
||||
new_price = res_final['value']['price_unit'] * uom_id.factor_inv
|
||||
res_final['value']['price_unit'] = new_price
|
||||
if result['uos_id'] and result['uos_id'] != res.uom_id.id:
|
||||
selected_uom = self.pool.get('product.uom').browse(cr, uid, result['uos_id'], context=context)
|
||||
new_price = self.pool.get('product.uom')._compute_price(cr, uid, res.uom_id.id, res_final['value']['price_unit'], result['uos_id'])
|
||||
res_final['value']['price_unit'] = new_price
|
||||
return res_final
|
||||
|
||||
def uos_id_change(self, cr, uid, ids, product, uom, qty=0, name='', type='out_invoice', partner_id=False, fposition_id=False, price_unit=False, currency_id=False, context=None, company_id=None):
|
||||
|
@ -1759,12 +1743,13 @@ class res_partner(osv.osv):
|
|||
return super(res_partner, self).copy(cr, uid, id, default, context)
|
||||
|
||||
|
||||
class mail_compose_message(osv.osv):
|
||||
class mail_compose_message(osv.Model):
|
||||
_inherit = 'mail.compose.message'
|
||||
|
||||
def send_mail(self, cr, uid, ids, context=None):
|
||||
context = context or {}
|
||||
if context.get('default_model') == 'account.invoice' and context.get('default_res_id') and context.get('mark_invoice_as_sent'):
|
||||
context = dict(context, mail_post_autofollow=True)
|
||||
self.pool.get('account.invoice').write(cr, uid, [context['default_res_id']], {'sent': True}, context=context)
|
||||
return super(mail_compose_message, self).send_mail(cr, uid, ids, context=context)
|
||||
|
||||
|
|
|
@ -145,7 +145,8 @@
|
|||
<header>
|
||||
<button name="invoice_open" states="draft,proforma2" string="Validate" class="oe_highlight" groups="account.group_account_invoice"/>
|
||||
<button name="%(action_account_invoice_refund)d" type='action' string='Ask Refund' states='open,paid' groups="account.group_account_invoice"/>
|
||||
<button name="invoice_cancel" states="draft,proforma2,sale,open" string="Cancel" groups="base.group_no_one"/>
|
||||
<button name="invoice_cancel" states="draft,proforma2" string="Cancel" groups="account.group_account_invoice"/>
|
||||
<button name="invoice_cancel" states="sale,open" string="Cancel" groups="base.group_no_one"/>
|
||||
<button name="action_cancel_draft" states="cancel" string="Set to Draft" type="object" groups="account.group_account_invoice"/>
|
||||
<button name='%(action_account_state_open)d' type='action' string='Re-Open' groups="account.group_account_invoice" attrs="{'invisible':['|', ('state','<>','paid'), ('reconciled', '=', True)]}" help="This button only appears when the state of the invoice is 'paid' (showing that it has been fully reconciled) and auto-computed boolean 'reconciled' is False (depicting that it's not the case anymore). In other words, the invoice has been dereconciled and it does not fit anymore the 'paid' state. You should press this button to re-open it and let it continue its normal process after having resolved the eventual exceptions it may have created."/>
|
||||
<field name="state" widget="statusbar" statusbar_visible="draft,open,paid" statusbar_colors='{"proforma":"blue","proforma2":"blue"}'/>
|
||||
|
@ -194,7 +195,7 @@
|
|||
<field name="product_id"
|
||||
on_change="product_id_change(product_id, uos_id, quantity, name, parent.type, parent.partner_id, parent.fiscal_position, price_unit, parent.currency_id, context, parent.company_id)"/>
|
||||
<field name="name"/>
|
||||
<field name="company_id" groups="base.group_multi_company" readonly="1"/>
|
||||
<field name="company_id" invisible="1"/>
|
||||
<field name="account_id" groups="account.group_account_user"
|
||||
domain="[('company_id', '=', parent.company_id), ('journal_id', '=', parent.journal_id), ('type', '!=', 'view')]"
|
||||
on_change="onchange_account_id(product_id, parent.partner_id, parent.type, parent.fiscal_position,account_id)"/>
|
||||
|
@ -349,7 +350,7 @@
|
|||
<field name="product_id"
|
||||
on_change="product_id_change(product_id, uos_id, quantity, name, parent.type, parent.partner_id, parent.fiscal_position, price_unit, parent.currency_id, context, parent.company_id)"/>
|
||||
<field name="name"/>
|
||||
<field name="company_id" groups="base.group_multi_company" readonly="1"/>
|
||||
<field name="company_id" invisible="1"/>
|
||||
<field name="account_id" groups="account.group_account_user"
|
||||
domain="[('company_id', '=', parent.company_id), ('journal_id', '=', parent.journal_id), ('type', '!=', 'view')]"
|
||||
on_change="onchange_account_id(product_id, parent.partner_id, parent.type, parent.fiscal_position,account_id)"/>
|
||||
|
@ -627,6 +628,7 @@
|
|||
id="act_account_journal_2_account_invoice_opened"
|
||||
name="Unpaid Invoices"
|
||||
context="{'search_default_journal_id': [active_id], 'search_default_unpaid':1, 'default_journal_id': active_id}"
|
||||
domain="[('journal_id','=', active_id)]"
|
||||
res_model="account.invoice"
|
||||
src_model="account.journal"/>
|
||||
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
<menuitem id="menu_finance_payables" name="Suppliers" parent="menu_finance" sequence="3"/>
|
||||
<menuitem id="menu_finance_bank_and_cash" name="Bank and Cash" parent="menu_finance" sequence="4"
|
||||
groups="group_account_user,group_account_manager"/>
|
||||
<menuitem id="menu_finance_periodical_processing" name="Periodical Processing" parent="menu_finance" sequence="13" groups="group_account_user,group_account_manager"/>
|
||||
<menuitem id="menu_finance_periodical_processing" name="Periodic Processing" parent="menu_finance" sequence="13" groups="group_account_user,group_account_manager"/>
|
||||
<!-- This menu is used in account_code module -->
|
||||
<menuitem id="menu_account_pp_statements" name="Statements" parent="menu_finance_periodical_processing" sequence="12"/>
|
||||
<menuitem id="periodical_processing_journal_entries_validation" name="Draft Entries" parent="menu_finance_periodical_processing"/>
|
||||
|
|
|
@ -26,11 +26,11 @@ from operator import itemgetter
|
|||
|
||||
from lxml import etree
|
||||
|
||||
import netsvc
|
||||
from osv import fields, osv, orm
|
||||
from tools.translate import _
|
||||
import decimal_precision as dp
|
||||
import tools
|
||||
from openerp import netsvc
|
||||
from openerp.osv import fields, osv, orm
|
||||
from openerp.tools.translate import _
|
||||
import openerp.addons.decimal_precision as dp
|
||||
from openerp import tools
|
||||
|
||||
class account_move_line(osv.osv):
|
||||
_name = "account.move.line"
|
||||
|
@ -983,7 +983,8 @@ class account_move_line(osv.osv):
|
|||
if context is None:
|
||||
context = {}
|
||||
period_pool = self.pool.get('account.period')
|
||||
pids = period_pool.search(cr, user, [('date_start','<=',date), ('date_stop','>=',date)])
|
||||
ctx = dict(context, account_period_prefer_normal=True)
|
||||
pids = period_pool.find(cr, user, date, context=ctx)
|
||||
if pids:
|
||||
res.update({
|
||||
'period_id':pids[0]
|
||||
|
@ -1136,9 +1137,11 @@ class account_move_line(osv.osv):
|
|||
if context is None:
|
||||
context = {}
|
||||
if vals.get('move_id', False):
|
||||
company_id = self.pool.get('account.move').read(cr, uid, vals['move_id'], ['company_id']).get('company_id', False)
|
||||
if company_id:
|
||||
vals['company_id'] = company_id[0]
|
||||
move = self.pool.get('account.move').browse(cr, uid, vals['move_id'], context=context)
|
||||
if move.company_id:
|
||||
vals['company_id'] = move.company_id.id
|
||||
if move.date and not vals.get('date'):
|
||||
vals['date'] = move.date
|
||||
if ('account_id' in vals) and not account_obj.read(cr, uid, vals['account_id'], ['active'])['active']:
|
||||
raise osv.except_osv(_('Bad Account!'), _('You cannot use an inactive account.'))
|
||||
if 'journal_id' in vals and vals['journal_id']:
|
||||
|
|
|
@ -97,7 +97,7 @@
|
|||
<form string="Account Period" version="7.0">
|
||||
<header>
|
||||
<button string="Close Period" name="%(account.action_account_period_close)d" type="action" class="oe_highlight" states="draft"/>
|
||||
<button name="action_draft" states="done" string="Set to Draft" type="object" groups="account.group_account_manager"/>
|
||||
<button name="action_draft" states="done" string="Re-Open Period" type="object" groups="account.group_account_manager"/>
|
||||
<field name="state" widget="statusbar" nolabel="1"/>
|
||||
</header>
|
||||
<sheet>
|
||||
|
@ -537,6 +537,7 @@
|
|||
<record id="view_bank_statement_form" model="ir.ui.view">
|
||||
<field name="name">account.bank.statement.form</field>
|
||||
<field name="model">account.bank.statement</field>
|
||||
<field name="priority">1</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Bank Statement" version="7.0">
|
||||
<header>
|
||||
|
@ -549,10 +550,8 @@
|
|||
<div class="oe_right oe_button_box" name="import_buttons">
|
||||
<!-- Put here related buttons -->
|
||||
</div>
|
||||
<label for="name" class="oe_edit_only" attrs="{'invisible':[('name','=','/')]}"/>
|
||||
<h1>
|
||||
<field name="name" attrs="{'invisible':[('name','=','/')]}"/>
|
||||
</h1>
|
||||
<label for="name" class="oe_edit_only"/>
|
||||
<h1><field name="name"/></h1>
|
||||
<group>
|
||||
<group>
|
||||
<field name="journal_id" domain="[('type', '=', 'bank')]" on_change="onchange_journal_id(journal_id)" widget="selection"/>
|
||||
|
@ -577,7 +576,7 @@
|
|||
<field name="date"/>
|
||||
<field name="name"/>
|
||||
<field name="ref"/>
|
||||
<field name="partner_id" on_change="onchange_partner_id(partner_id)"/>
|
||||
<field name="partner_id" on_change="onchange_partner_id(partner_id)" domain="['|',('parent_id','=',False),('is_company','=',True)]"/>
|
||||
<field name="type" on_change="onchange_type(partner_id, type)"/>
|
||||
<field name="account_id" options='{"no_open":True}' domain="[('journal_id','=',parent.journal_id), ('company_id', '=', parent.company_id)]"/>
|
||||
<field name="analytic_account_id" groups="analytic.group_analytic_accounting" domain="[('company_id', '=', parent.company_id), ('type', '<>', 'view')]"/>
|
||||
|
@ -1137,7 +1136,7 @@
|
|||
<separator/>
|
||||
<filter string="Next Partner to Reconcile" help="Next Partner Entries to reconcile" name="next_partner" context="{'next_partner_only': 1}" icon="terp-gtk-jump-to-ltr" domain="[('account_id.reconcile','=',True),('reconcile_id','=',False)]"/>
|
||||
<field name="move_id" string="Number (Move)"/>
|
||||
<field name="account_id" filter_domain="['|', ('name', 'ilike', self), ('code', 'ilike', self)]"/>
|
||||
<field name="account_id"/>
|
||||
<field name="partner_id"/>
|
||||
<field name="journal_id" context="{'journal_id':self}" widget="selection"/> <!-- it's important to keep widget='selection' in this filter viewbecause without that the value passed in the context is not the ID but the textual value (name) of the selected journal -->
|
||||
<field name="period_id" context="{'period_id':self}" widget="selection"/> <!-- it's important to keep the widget='selection' in this field, for the same reason as explained above -->
|
||||
|
@ -1155,7 +1154,7 @@
|
|||
<field name="name">Journal Items</field>
|
||||
<field name="res_model">account.move.line</field>
|
||||
<field name="view_id" ref="view_move_line_tree"/>
|
||||
<field name="view_mode">tree_account_move_line_quickadd</field>
|
||||
<field name="view_mode">tree_account_move_line_quickadd,form</field>
|
||||
<field name="help" type="html">
|
||||
<p class="oe_view_nocontent_create">
|
||||
Select the period and the journal you want to fill.
|
||||
|
@ -2234,6 +2233,7 @@
|
|||
<record id="view_bank_statement_form2" model="ir.ui.view">
|
||||
<field name="name">account.bank.statement.form</field>
|
||||
<field name="model">account.bank.statement</field>
|
||||
<field name="priority">2</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Statement" version="7.0">
|
||||
<header>
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
#
|
||||
##############################################################################
|
||||
|
||||
from osv import fields, osv
|
||||
from openerp.osv import fields, osv
|
||||
|
||||
class res_company(osv.osv):
|
||||
_inherit = "res.company"
|
||||
|
|
|
@ -151,14 +151,16 @@
|
|||
<field name="object">account.invoice</field>
|
||||
</record>
|
||||
|
||||
<!-- mail: subtypes -->
|
||||
<record id="mt_invoice_new" model="mail.message.subtype">
|
||||
<field name="name">created</field>
|
||||
<!-- Account-related subtypes for messaging / Chatter -->
|
||||
<record id="mt_invoice_validated" model="mail.message.subtype">
|
||||
<field name="name">Validated</field>
|
||||
<field name="res_model">account.invoice</field>
|
||||
<field name="description">Invoice validated</field>
|
||||
</record>
|
||||
<record id="mt_invoice_paid" model="mail.message.subtype">
|
||||
<field name="name">paid</field>
|
||||
<field name="name">Paid</field>
|
||||
<field name="res_model">account.invoice</field>
|
||||
<field name="description">Invoice paid</field>
|
||||
</record>
|
||||
</data>
|
||||
</openerp>
|
||||
|
|
|
@ -18,9 +18,10 @@
|
|||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
##############################################################################
|
||||
from openerp.osv import osv, fields
|
||||
from openerp.addons.edi import EDIMixin
|
||||
|
||||
from openerp.osv import osv
|
||||
from edi import EDIMixin
|
||||
from urllib import urlencode
|
||||
|
||||
INVOICE_LINE_EDI_STRUCT = {
|
||||
'name': True,
|
||||
|
@ -258,6 +259,28 @@ class account_invoice(osv.osv, EDIMixin):
|
|||
pass
|
||||
return action
|
||||
|
||||
def _edi_paypal_url(self, cr, uid, ids, field, arg, context=None):
|
||||
res = dict.fromkeys(ids, False)
|
||||
for inv in self.browse(cr, uid, ids, context=context):
|
||||
if inv.type == 'out_invoice' and inv.company_id.paypal_account:
|
||||
params = {
|
||||
"cmd": "_xclick",
|
||||
"business": inv.company_id.paypal_account,
|
||||
"item_name": inv.company_id.name + " Invoice " + inv.number,
|
||||
"invoice": inv.number,
|
||||
"amount": inv.residual,
|
||||
"currency_code": inv.currency_id.name,
|
||||
"button_subtype": "services",
|
||||
"no_note": "1",
|
||||
"bn": "OpenERP_Invoice_PayNow_" + inv.currency_id.name,
|
||||
}
|
||||
res[inv.id] = "https://www.paypal.com/cgi-bin/webscr?" + urlencode(params)
|
||||
return res
|
||||
|
||||
_columns = {
|
||||
'paypal_url': fields.function(_edi_paypal_url, type='char', string='Paypal Url'),
|
||||
}
|
||||
|
||||
|
||||
class account_invoice_line(osv.osv, EDIMixin):
|
||||
_inherit='account.invoice.line'
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
<record id="email_template_edi_invoice" model="email.template">
|
||||
<field name="name">Invoice - Send by Email</field>
|
||||
<field name="email_from">${object.user_id.email or object.company_id.email or 'noreply@localhost'}</field>
|
||||
<field name="subject">${object.company_id.name} Invoice (Ref ${object.number or 'n/a' })</field>
|
||||
<field name="subject">${object.company_id.name} Invoice (Ref ${object.number or 'n/a'})</field>
|
||||
<field name="email_recipients">${object.partner_id.id}</field>
|
||||
<field name="model_id" ref="account.model_account_invoice"/>
|
||||
<field name="auto_delete" eval="True"/>
|
||||
|
@ -33,7 +33,7 @@
|
|||
<field name="body_html"><![CDATA[
|
||||
<div style="font-family: 'Lucica Grande', Ubuntu, Arial, Verdana, sans-serif; font-size: 12px; color: rgb(34, 34, 34); background-color: #FFF; ">
|
||||
|
||||
<p>Hello${object.partner_id.name and ' ' or ''}${object.partner_id.name or ''},</p>
|
||||
<p>Hello ${object.partner_id.name},</p>
|
||||
|
||||
<p>A new invoice is available for you: </p>
|
||||
|
||||
|
@ -50,20 +50,10 @@
|
|||
% endif
|
||||
</p>
|
||||
|
||||
% if object.company_id.paypal_account and object.type in ('out_invoice'):
|
||||
<%
|
||||
comp_name = quote(object.company_id.name)
|
||||
inv_number = quote(object.number)
|
||||
paypal_account = quote(object.company_id.paypal_account)
|
||||
inv_amount = quote(str(object.residual))
|
||||
cur_name = quote(object.currency_id.name)
|
||||
paypal_url = "https://www.paypal.com/cgi-bin/webscr?cmd=_xclick&business=%s&item_name=%s%%20Invoice%%20%s&" \
|
||||
"invoice=%s&amount=%s&currency_code=%s&button_subtype=services&no_note=1&bn=OpenERP_Invoice_PayNow_%s" % \
|
||||
(paypal_account,comp_name,inv_number,inv_number,inv_amount,cur_name,cur_name)
|
||||
%>
|
||||
% if object.paypal_url:
|
||||
<br/>
|
||||
<p>It is also possible to directly pay with Paypal:</p>
|
||||
<a style="margin-left: 120px;" href="${paypal_url}">
|
||||
<a style="margin-left: 120px;" href="${object.paypal_url}">
|
||||
<img class="oe_edi_paypal_button" src="https://www.paypal.com/en_US/i/btn/btn_paynowCC_LG.gif"/>
|
||||
</a>
|
||||
% endif
|
||||
|
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -19,17 +19,17 @@
|
|||
#
|
||||
##############################################################################
|
||||
|
||||
import logging
|
||||
import time
|
||||
import datetime
|
||||
from dateutil.relativedelta import relativedelta
|
||||
import logging
|
||||
from operator import itemgetter
|
||||
from os.path import join as opj
|
||||
import time
|
||||
|
||||
from openerp import netsvc, tools
|
||||
from openerp.tools.translate import _
|
||||
from openerp.osv import fields, osv
|
||||
|
||||
from tools.translate import _
|
||||
from osv import fields, osv
|
||||
import netsvc
|
||||
import tools
|
||||
_logger = logging.getLogger(__name__)
|
||||
|
||||
class account_installer(osv.osv_memory):
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
#
|
||||
##############################################################################
|
||||
|
||||
from osv import fields, osv
|
||||
from openerp.osv import fields, osv
|
||||
|
||||
class ir_sequence_fiscalyear(osv.osv):
|
||||
_name = 'account.sequence.fiscalyear'
|
||||
|
|
|
@ -20,9 +20,10 @@
|
|||
##############################################################################
|
||||
|
||||
from operator import itemgetter
|
||||
from osv import fields, osv
|
||||
import time
|
||||
|
||||
from openerp.osv import fields, osv
|
||||
|
||||
class account_fiscal_position(osv.osv):
|
||||
_name = 'account.fiscal.position'
|
||||
_description = 'Fiscal Position'
|
||||
|
|
|
@ -68,6 +68,7 @@
|
|||
<field eval=""""Accounting"""" name="name"/>
|
||||
<field eval=""""Accounting entries."""" name="note"/>
|
||||
<field name="process_id" ref="process_process_supplierinvoiceprocess0"/>
|
||||
<field eval=""""object.state=='posted'"""" name="model_states"/>
|
||||
<field eval="0" name="flow_start"/>
|
||||
</record>
|
||||
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
#
|
||||
##############################################################################
|
||||
|
||||
from osv import fields, osv
|
||||
from openerp.osv import fields, osv
|
||||
|
||||
class product_category(osv.osv):
|
||||
_inherit = "product.category"
|
||||
|
|
|
@ -19,8 +19,7 @@
|
|||
#
|
||||
##############################################################################
|
||||
|
||||
from osv import fields
|
||||
from osv import osv
|
||||
from openerp.osv import fields, osv
|
||||
|
||||
class account_analytic_journal(osv.osv):
|
||||
_name = 'account.analytic.journal'
|
||||
|
|
|
@ -9,13 +9,13 @@
|
|||
<field name="arch" type="xml">
|
||||
<tree toolbar="1" colors="red:state=='pending';grey:state in ('cancelled','close');blue:type=='view'" string="Analytic Accounts">
|
||||
<field name="complete_name"/>
|
||||
<field name="partner_id"/>
|
||||
<field name="code"/>
|
||||
<field name="quantity"/>
|
||||
<field name="date"/>
|
||||
<field name="date_start" invisible="1"/>
|
||||
<field name="user_id" invisible="1"/>
|
||||
<field name="manager_id" invisible="1"/>
|
||||
<field name="parent_id" invisible="1"/>
|
||||
<field name="partner_id" invisible="1"/>
|
||||
<field name="state" invisible="1"/>
|
||||
<field name="type" invisible="1"/>
|
||||
<field name="company_id" groups="base.group_multi_company"/>
|
||||
|
@ -33,6 +33,7 @@
|
|||
<filter icon="terp-gtk-media-pause" string="Pending" domain="[('state','=','pending')]" help="Pending Accounts"/>
|
||||
<filter icon="terp-camera_test" string="Current" domain="[('state','=','open')]" help="Current Accounts"/>
|
||||
<field name="partner_id"/>
|
||||
<field name="manager_id"/>
|
||||
<field name="user_id"/>
|
||||
<group expand="0" string="Group By...">
|
||||
<filter string="Associated Partner" icon="terp-partner" domain="[]" context="{'group_by':'partner_id'}"/>
|
||||
|
@ -49,6 +50,7 @@
|
|||
<field name="field_parent">child_complete_ids</field>
|
||||
<field name="arch" type="xml">
|
||||
<tree colors="blue:state=='pending';grey:state in ('close','cancelled');blue:type=='view'" string="Analytic account" toolbar="1">
|
||||
<field name="name" invisible="1"/>
|
||||
<field name="complete_name"/>
|
||||
<field name="code"/>
|
||||
<field name="debit"/>
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
|
||||
|
||||
import time
|
||||
from report import report_sxw
|
||||
from openerp.report import report_sxw
|
||||
|
||||
#
|
||||
# Use period and Journal for selection or resources
|
||||
|
|
|
@ -20,7 +20,8 @@
|
|||
##############################################################################
|
||||
|
||||
import time
|
||||
from report import report_sxw
|
||||
|
||||
from openerp.report import report_sxw
|
||||
|
||||
|
||||
class account_analytic_balance(report_sxw.rml_parse):
|
||||
|
|
|
@ -20,8 +20,9 @@
|
|||
##############################################################################
|
||||
|
||||
import time
|
||||
import pooler
|
||||
from report import report_sxw
|
||||
|
||||
from openerp import pooler
|
||||
from openerp.report import report_sxw
|
||||
|
||||
#
|
||||
# Use period and Journal for selection or resources
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue