Skip to content

Commit cccc7a3

Browse files
committed
[MERGE]sync with trunk.
bzr revid: [email protected]
2 parents b3c6e20 + 772bf13 commit cccc7a3

File tree

6,611 files changed

+85438
-118927
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

6,611 files changed

+85438
-118927
lines changed

addons/account/__openerp__.py

+23-4
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@
4949
""",
5050
'website': 'http://www.openerp.com',
5151
'images' : ['images/accounts.jpeg','images/bank_statement.jpeg','images/cash_register.jpeg','images/chart_of_accounts.jpeg','images/customer_invoice.jpeg','images/journal_entries.jpeg'],
52-
'depends' : ['base_setup', 'product', 'analytic', 'board', 'edi'],
52+
'depends' : ['base_setup', 'product', 'analytic', 'board', 'edi', 'report'],
5353
'data': [
5454
'security/account_security.xml',
5555
'security/ir.model.access.csv',
@@ -120,7 +120,27 @@
120120
'edi/invoice_action_data.xml',
121121
'account_bank_view.xml',
122122
'res_config_view.xml',
123-
'account_pre_install.yml'
123+
'account_pre_install.yml',
124+
125+
'views/report_vat.xml',
126+
'views/report_invoice.xml',
127+
'views/report_trialbalance.xml',
128+
'views/report_centraljournal.xml',
129+
'views/report_overdue.xml',
130+
'views/report_generaljournal.xml',
131+
'views/report_journal.xml',
132+
'views/report_salepurchasejournal.xml',
133+
'views/report_partnerbalance.xml',
134+
'views/report_agedpartnerbalance.xml',
135+
'views/report_partnerledger.xml',
136+
'views/report_partnerledgerother.xml',
137+
'views/report_financial.xml',
138+
'views/report_generalledger.xml',
139+
'project/views/report_analyticbalance.xml',
140+
'project/views/report_analyticjournal.xml',
141+
'project/views/report_analyticcostledgerquantity.xml',
142+
'project/views/report_analyticcostledger.xml',
143+
'project/views/report_invertedanalyticbalance.xml',
124144
],
125145
'js': [
126146
'static/src/js/account_move_reconciliation.js',
@@ -152,13 +172,12 @@
152172
'test/account_period_close.yml',
153173
'test/account_use_model.yml',
154174
'test/account_validate_account_move.yml',
155-
#'test/account_bank_statement.yml',
156-
#'test/account_cash_statement.yml',
157175
'test/test_edi_invoice.yml',
158176
'test/account_report.yml',
159177
'test/account_fiscalyear_close.yml', #last test, as it will definitively close the demo fiscalyear
160178
],
161179
'installable': True,
162180
'auto_install': False,
163181
}
182+
164183
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

addons/account/account.py

+32-80
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
from openerp import tools
3131
from openerp.osv import fields, osv, expression
3232
from openerp.tools.translate import _
33-
from openerp.tools.float_utils import float_round
33+
from openerp.tools.float_utils import float_round as round
3434

3535
import openerp.addons.decimal_precision as dp
3636

@@ -729,8 +729,7 @@ class account_journal(osv.osv):
729729
'currency': fields.many2one('res.currency', 'Currency', help='The currency used to enter statement'),
730730
'entry_posted': fields.boolean('Autopost Created Moves', help='Check this box to automatically post entries of this journal. Note that legally, some entries may be automatically posted when the source document is validated (Invoices), whatever the status of this field.'),
731731
'company_id': fields.many2one('res.company', 'Company', required=True, select=1, help="Company related to this journal"),
732-
'allow_date':fields.boolean('Check Date in Period', help= 'If set to True then do not accept the entry if the entry date is not into the period dates'),
733-
732+
'allow_date':fields.boolean('Check Date in Period', help= 'If checked, the entry won\'t be created if the entry date is not included into the selected period'),
734733
'profit_account_id' : fields.many2one('account.account', 'Profit Account'),
735734
'loss_account_id' : fields.many2one('account.account', 'Loss Account'),
736735
'internal_account_id' : fields.many2one('account.account', 'Internal Transfers Account', select=1),
@@ -841,16 +840,11 @@ def name_get(self, cr, user, ids, context=None):
841840
def name_search(self, cr, user, name, args=None, operator='ilike', context=None, limit=100):
842841
if not args:
843842
args = []
844-
if context is None:
845-
context = {}
846-
ids = []
847-
if context.get('journal_type', False):
848-
args += [('type','=',context.get('journal_type'))]
849-
if name:
850-
ids = self.search(cr, user, [('code', 'ilike', name)]+ args, limit=limit, context=context)
851-
if not ids:
852-
ids = self.search(cr, user, [('name', 'ilike', name)]+ args, limit=limit, context=context)#fix it ilike should be replace with operator
853-
843+
if operator in expression.NEGATIVE_TERM_OPERATORS:
844+
domain = [('code', operator, name), ('name', operator, name)]
845+
else:
846+
domain = ['|', ('code', operator, name), ('name', operator, name)]
847+
ids = self.search(cr, user, expression.AND([domain, args]), limit=limit, context=context)
854848
return self.name_get(cr, user, ids, context=context)
855849

856850

@@ -939,13 +933,11 @@ def finds(self, cr, uid, dt=None, exception=True, context=None):
939933
def name_search(self, cr, user, name, args=None, operator='ilike', context=None, limit=80):
940934
if args is None:
941935
args = []
942-
if context is None:
943-
context = {}
944-
ids = []
945-
if name:
946-
ids = self.search(cr, user, [('code', 'ilike', name)]+ args, limit=limit)
947-
if not ids:
948-
ids = self.search(cr, user, [('name', operator, name)]+ args, limit=limit)
936+
if operator in expression.NEGATIVE_TERM_OPERATORS:
937+
domain = [('code', operator, name), ('name', operator, name)]
938+
else:
939+
domain = ['|', ('code', operator, name), ('name', operator, name)]
940+
ids = self.search(cr, user, expression.AND([domain, args]), limit=limit, context=context)
949941
return self.name_get(cr, user, ids, context=context)
950942

951943

@@ -1041,19 +1033,11 @@ def action_draft(self, cr, uid, ids, *args):
10411033
def name_search(self, cr, user, name, args=None, operator='ilike', context=None, limit=100):
10421034
if args is None:
10431035
args = []
1044-
if context is None:
1045-
context = {}
1046-
ids = []
1047-
if name:
1048-
ids = self.search(cr, user,
1049-
[('code', 'ilike', name)] + args,
1050-
limit=limit,
1051-
context=context)
1052-
if not ids:
1053-
ids = self.search(cr, user,
1054-
[('name', operator, name)] + args,
1055-
limit=limit,
1056-
context=context)
1036+
if operator in expression.NEGATIVE_TERM_OPERATORS:
1037+
domain = [('code', operator, name), ('name', operator, name)]
1038+
else:
1039+
domain = ['|', ('code', operator, name), ('name', operator, name)]
1040+
ids = self.search(cr, user, expression.AND([domain, args]), limit=limit, context=context)
10571041
return self.name_get(cr, user, ids, context=context)
10581042

10591043
def write(self, cr, uid, ids, vals, context=None):
@@ -1188,36 +1172,6 @@ def account_move_prepare(self, cr, uid, journal_id, date=False, ref='', company_
11881172
'company_id': company_id,
11891173
}
11901174

1191-
def name_search(self, cr, user, name, args=None, operator='ilike', context=None, limit=80):
1192-
"""
1193-
Returns a list of tupples containing id, name, as internally it is called {def name_get}
1194-
result format: {[(id, name), (id, name), ...]}
1195-
1196-
@param cr: A database cursor
1197-
@param user: ID of the user currently logged in
1198-
@param name: name to search
1199-
@param args: other arguments
1200-
@param operator: default operator is 'ilike', it can be changed
1201-
@param context: context arguments, like lang, time zone
1202-
@param limit: Returns first 'n' ids of complete result, default is 80.
1203-
1204-
@return: Returns a list of tuples containing id and name
1205-
"""
1206-
1207-
if not args:
1208-
args = []
1209-
ids = []
1210-
if name:
1211-
ids += self.search(cr, user, [('name','ilike',name)]+args, limit=limit, context=context)
1212-
1213-
if not ids and name and type(name) == int:
1214-
ids += self.search(cr, user, [('id','=',name)]+args, limit=limit, context=context)
1215-
1216-
if not ids:
1217-
ids += self.search(cr, user, args, limit=limit, context=context)
1218-
1219-
return self.name_get(cr, user, ids, context=context)
1220-
12211175
def name_get(self, cursor, user, ids, context=None):
12221176
if isinstance(ids, (int, long)):
12231177
ids = [ids]
@@ -1843,10 +1797,12 @@ def _sum_period(self, cr, uid, ids, name, args, context):
18431797
def name_search(self, cr, user, name, args=None, operator='ilike', context=None, limit=80):
18441798
if not args:
18451799
args = []
1846-
if context is None:
1847-
context = {}
1848-
ids = self.search(cr, user, ['|',('name',operator,name),('code',operator,name)] + args, limit=limit, context=context)
1849-
return self.name_get(cr, user, ids, context)
1800+
if operator in expression.NEGATIVE_TERM_OPERATORS:
1801+
domain = [('code', operator, name), ('name', operator, name)]
1802+
else:
1803+
domain = ['|', ('code', operator, name), ('name', operator, name)]
1804+
ids = self.search(cr, user, expression.AND([domain, args]), limit=limit, context=context)
1805+
return self.name_get(cr, user, ids, context=context)
18501806

18511807
def name_get(self, cr, uid, ids, context=None):
18521808
if isinstance(ids, (int, long)):
@@ -1938,15 +1894,15 @@ def copy_data(self, cr, uid, id, default=None, context=None):
19381894
#
19391895
'base_code_id': fields.many2one('account.tax.code', 'Account Base Code', help="Use this code for the tax declaration."),
19401896
'tax_code_id': fields.many2one('account.tax.code', 'Account Tax Code', help="Use this code for the tax declaration."),
1941-
'base_sign': fields.float('Base Code Sign', help="Usually 1 or -1."),
1942-
'tax_sign': fields.float('Tax Code Sign', help="Usually 1 or -1."),
1897+
'base_sign': fields.float('Base Code Sign', help="Usually 1 or -1.", digits_compute=get_precision_tax()),
1898+
'tax_sign': fields.float('Tax Code Sign', help="Usually 1 or -1.", digits_compute=get_precision_tax()),
19431899

19441900
# Same fields for refund invoices
19451901

19461902
'ref_base_code_id': fields.many2one('account.tax.code', 'Refund Base Code', help="Use this code for the tax declaration."),
19471903
'ref_tax_code_id': fields.many2one('account.tax.code', 'Refund Tax Code', help="Use this code for the tax declaration."),
1948-
'ref_base_sign': fields.float('Refund Base Code Sign', help="Usually 1 or -1."),
1949-
'ref_tax_sign': fields.float('Refund Tax Code Sign', help="Usually 1 or -1."),
1904+
'ref_base_sign': fields.float('Refund Base Code Sign', help="Usually 1 or -1.", digits_compute=get_precision_tax()),
1905+
'ref_tax_sign': fields.float('Refund Tax Code Sign', help="Usually 1 or -1.", digits_compute=get_precision_tax()),
19501906
'include_base_amount': fields.boolean('Included in base amount', help="Indicates if the amount of tax must be included in the base amount for the computation of the next taxes"),
19511907
'company_id': fields.many2one('res.company', 'Company', required=True),
19521908
'description': fields.char('Tax Code'),
@@ -1975,15 +1931,11 @@ def name_search(self, cr, user, name, args=None, operator='ilike', context=None,
19751931
"""
19761932
if not args:
19771933
args = []
1978-
if context is None:
1979-
context = {}
1980-
ids = []
1981-
if name:
1982-
ids = self.search(cr, user, [('description', '=', name)] + args, limit=limit, context=context)
1983-
if not ids:
1984-
ids = self.search(cr, user, [('name', operator, name)] + args, limit=limit, context=context)
1934+
if operator in expression.NEGATIVE_TERM_OPERATORS:
1935+
domain = [('description', operator, name), ('name', operator, name)]
19851936
else:
1986-
ids = self.search(cr, user, args, limit=limit, context=context or {})
1937+
domain = ['|', ('description', operator, name), ('name', operator, name)]
1938+
ids = self.search(cr, user, expression.AND([domain, args]), limit=limit, context=context)
19871939
return self.name_get(cr, user, ids, context=context)
19881940

19891941
def write(self, cr, uid, ids, vals, context=None):
@@ -2144,7 +2096,7 @@ def compute_all(self, cr, uid, taxes, price_unit, quantity, product=None, partne
21442096
tax_compute_precision = precision
21452097
if taxes and taxes[0].company_id.tax_calculation_rounding_method == 'round_globally':
21462098
tax_compute_precision += 5
2147-
totalin = totalex = float_round(price_unit * quantity, precision)
2099+
totalin = totalex = round(price_unit * quantity, precision)
21482100
tin = []
21492101
tex = []
21502102
for tax in taxes:

addons/account/account_bank_statement.py

+1
Original file line numberDiff line numberDiff line change
@@ -495,6 +495,7 @@ def button_journal_entries(self, cr, uid, ids, context=None):
495495
ctx = (context or {}).copy()
496496
ctx['journal_id'] = self.browse(cr, uid, ids[0], context=context).journal_id.id
497497
return {
498+
'name': _('Journal Items'),
498499
'view_type':'form',
499500
'view_mode':'tree',
500501
'res_model':'account.move.line',

addons/account/account_invoice.py

+7-26
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ def _amount_residual(self, cr, uid, ids, name, args, context=None):
114114
#we check if the invoice is partially reconciled and if there are other invoices
115115
#involved in this partial reconciliation (and we sum these invoices)
116116
for line in aml.reconcile_partial_id.line_partial_ids:
117-
if line.invoice:
117+
if line.invoice and invoice.type == line.invoice.type:
118118
nb_inv_in_partial_rec += 1
119119
#store the max invoice id as for this invoice we will make a balance instead of a simple division
120120
max_invoice_id = max(max_invoice_id, line.invoice.id)
@@ -226,7 +226,7 @@ def _get_invoice_from_reconcile(self, cr, uid, ids, context=None):
226226
},
227227
}
228228
_columns = {
229-
'name': fields.char('Description', size=64, select=True, readonly=True, states={'draft':[('readonly',False)]}),
229+
'name': fields.char('Reference/Description', size=64, select=True, readonly=True, states={'draft':[('readonly',False)]}),
230230
'origin': fields.char('Source Document', size=64, help="Reference of the document that produced this invoice.", readonly=True, states={'draft':[('readonly',False)]}),
231231
'supplier_invoice_number': fields.char('Supplier Invoice Number', size=64, help="The reference of this invoice as provided by the supplier.", readonly=True, states={'draft':[('readonly',False)]}),
232232
'type': fields.selection([
@@ -409,17 +409,9 @@ def invoice_print(self, cr, uid, ids, context=None):
409409
'''
410410
assert len(ids) == 1, 'This option should only be used for a single id at a time.'
411411
self.write(cr, uid, ids, {'sent': True}, context=context)
412-
datas = {
413-
'ids': ids,
414-
'model': 'account.invoice',
415-
'form': self.read(cr, uid, ids[0], context=context)
416-
}
417-
return {
418-
'type': 'ir.actions.report.xml',
419-
'report_name': 'account.invoice',
420-
'datas': datas,
421-
'nodestroy' : True
422-
}
412+
context2 = context.copy()
413+
context2['active_ids'] = ids
414+
return self.pool['report'].get_action(cr, uid, [], 'account.report_invoice', context=context2)
423415

424416
def action_invoice_sent(self, cr, uid, ids, context=None):
425417
'''
@@ -680,25 +672,14 @@ def action_cancel_draft(self, cr, uid, ids, *args):
680672
self.create_workflow(cr, uid, ids)
681673
return True
682674

683-
# ----------------------------------------
684-
# Mail related methods
685-
# ----------------------------------------
686-
687-
def _get_formview_action(self, cr, uid, id, context=None):
675+
def get_formview_id(self, cr, uid, id, context=None):
688676
""" Update form view id of action to open the invoice """
689-
action = super(account_invoice, self)._get_formview_action(cr, uid, id, context=context)
690677
obj = self.browse(cr, uid, id, context=context)
691678
if obj.type == 'in_invoice':
692679
model, view_id = self.pool.get('ir.model.data').get_object_reference(cr, uid, 'account', 'invoice_supplier_form')
693-
action.update({
694-
'views': [(view_id, 'form')],
695-
})
696680
else:
697681
model, view_id = self.pool.get('ir.model.data').get_object_reference(cr, uid, 'account', 'invoice_form')
698-
action.update({
699-
'views': [(view_id, 'form')],
700-
})
701-
return action
682+
return view_id
702683

703684
# Workflow stuff
704685
#################

0 commit comments

Comments
 (0)