diff --git a/addons/account/account.py b/addons/account/account.py
index 7938862acfb..88a9848f3bb 100644
--- a/addons/account/account.py
+++ b/addons/account/account.py
@@ -231,9 +231,9 @@ class account_account(osv.osv):
aml_query = self.pool.get('account.move.line')._query_get(cr, uid, context=context)
wheres = [""]
- if query:
+ if query.strip():
wheres.append(query.strip())
- if aml_query:
+ if aml_query.strip():
wheres.append(aml_query.strip())
query = " AND ".join(wheres)
@@ -251,6 +251,7 @@ class account_account(osv.osv):
# consolidate accounts with direct children
+ ids2.reverse()
brs = list(self.browse(cr, uid, ids2, context=context))
sums = {}
while brs:
@@ -270,8 +271,9 @@ class account_account(osv.osv):
if current.child_id:
sums[current.id][fn] += sum(sums[child.id][fn] for child in current.child_id)
res = {}
+ null_result = dict((fn, 0.0) for fn in field_names)
for id in ids:
- res[id] = sums[id]
+ res[id] = sums.get(id, null_result)
return res
def _get_company_currency(self, cr, uid, ids, field_name, arg, context={}):
@@ -313,7 +315,7 @@ class account_account(osv.osv):
'user_type': fields.many2one('account.account.type', 'Account Type', required=True,
help="These types are defined according to your country. The type contains more information "\
"about the account and its specificities."),
- 'parent_id': fields.many2one('account.account', 'Parent', ondelete='cascade'),
+ 'parent_id': fields.many2one('account.account', 'Parent', ondelete='cascade', domain=[('type','=','view')]),
'child_parent_ids': fields.one2many('account.account','parent_id','Children'),
'child_consol_ids': fields.many2many('account.account', 'account_account_consol_rel', 'child_id', 'parent_id', 'Consolidated Children'),
'child_id': fields.function(_get_child_ids, method=True, type='many2many', relation="account.account", string="Child Accounts"),
@@ -450,18 +452,42 @@ class account_account(osv.osv):
def _check_moves(self, cr, uid, ids, method, context):
line_obj = self.pool.get('account.move.line')
account_ids = self.search(cr, uid, [('id', 'child_of', ids)])
+
if line_obj.search(cr, uid, [('account_id', 'in', account_ids)]):
if method == 'write':
raise osv.except_osv(_('Error !'), _('You cannot deactivate an account that contains account moves.'))
elif method == 'unlink':
raise osv.except_osv(_('Error !'), _('You cannot remove an account which has account entries!. '))
+ #Checking whether the account is set as a property to any Partner or not
+ value = 'account.account,' + str(ids[0])
+ partner_prop_acc = self.pool.get('ir.property').search(cr, uid, [('value_reference','=',value)], context=context)
+ if partner_prop_acc:
+ raise osv.except_osv(_('Warning !'), _('You cannot remove/deactivate an account which is set as a property to any Partner.'))
+ return True
+
+ def _check_allow_type_change(self, cr, uid, ids, new_type, context):
+ group1 = ['payable', 'receivable', 'other']
+ group2 = ['consolidation','view']
+ line_obj = self.pool.get('account.move.line')
+ for account in self.browse(cr, uid, ids, context=context):
+ old_type = account.type
+ account_ids = self.search(cr, uid, [('id', 'child_of', [account.id])])
+ if line_obj.search(cr, uid, [('account_id', 'in', account_ids)]):
+ #Check for 'Closed' type
+ if old_type == 'closed' and new_type !='closed':
+ raise osv.except_osv(_('Warning !'), _("You cannot change the type of account from 'Closed' to any other type which contains account entries!"))
+ #Check for change From group1 to group2 and vice versa
+ if (old_type in group1 and new_type in group2) or (old_type in group2 and new_type in group1):
+ raise osv.except_osv(_('Warning !'), _("You cannot change the type of account from '%s' to '%s' type as it contains account entries!") % (old_type,new_type,))
return True
def write(self, cr, uid, ids, vals, context=None):
- if not context:
+ if context is None:
context = {}
if 'active' in vals and not vals['active']:
self._check_moves(cr, uid, ids, "write", context)
+ if 'type' in vals.keys():
+ self._check_allow_type_change(cr, uid, ids, vals['type'], context=context)
return super(account_account, self).write(cr, uid, ids, vals, context=context)
def unlink(self, cr, uid, ids, context={}):
@@ -557,15 +583,16 @@ class account_journal(osv.osv):
def name_search(self, cr, user, name, args=None, operator='ilike', context=None, limit=100):
if not args:
- args=[]
- if not context:
- context={}
+ args = []
+ if context is None:
+ context = {}
ids = []
if name:
- ids = self.search(cr, user, [('code','ilike',name)]+ args, limit=limit)
+ ids = self.search(cr, user, [('code','ilike',name)]+ args, limit=limit, context=context)
if not ids:
- ids = self.search(cr, user, [('name',operator,name)]+ args, limit=limit)
+ ids = self.search(cr, user, [('name',operator,name)]+ args, limit=limit, context=context)
return self.name_get(cr, user, ids, context=context)
+
account_journal()
class account_fiscalyear(osv.osv):
@@ -631,6 +658,19 @@ class account_fiscalyear(osv.osv):
else:
return False
return ids[0]
+
+ def name_search(self, cr, user, name, args=None, operator='ilike', context=None, limit=80):
+ if args is None:
+ args = []
+ if context is None:
+ context = {}
+ ids = []
+ if name:
+ ids = self.search(cr, user, [('code','ilike',name)]+ args, limit=limit)
+ if not ids:
+ ids = self.search(cr, user, [('name',operator,name)]+ args, limit=limit)
+ return self.name_get(cr, user, ids, context=context)
+
account_fiscalyear()
class account_period(osv.osv):
@@ -706,12 +746,24 @@ class account_period(osv.osv):
cr.execute('update account_journal_period set state=%s where period_id=%s', (mode, id))
cr.execute('update account_period set state=%s where id=%s', (mode, id))
return True
+
+ def name_search(self, cr, user, name, args=None, operator='ilike', context=None, limit=80):
+ if args is None:
+ args = []
+ if context is None:
+ context = {}
+ ids = []
+ if name:
+ ids = self.search(cr, user, [('code','ilike',name)]+ args, limit=limit)
+ if not ids:
+ ids = self.search(cr, user, [('name',operator,name)]+ args, limit=limit)
+ return self.name_get(cr, user, ids, context=context)
account_period()
class account_journal_period(osv.osv):
_name = "account.journal.period"
- _description = "Journal - Period"
+ _description = "Journal Period"
def _icon_get(self, cr, uid, ids, field_name, arg=None, context={}):
result = {}.fromkeys(ids, 'STOCK_NEW')
@@ -950,7 +1002,6 @@ class account_move(osv.osv):
l[2]['period_id'] = default_period
context['period_id'] = default_period
- accnt_journal = self.pool.get('account.journal').browse(cr, uid, vals['journal_id'])
if 'line_id' in vals:
c = context.copy()
c['novalidate'] = True
@@ -1248,7 +1299,7 @@ class account_tax_code(osv.osv):
_description = 'Tax Code'
_rec_name = 'code'
_columns = {
- 'name': fields.char('Tax Case Name', size=64, required=True),
+ 'name': fields.char('Tax Case Name', size=64, required=True, translate=True),
'code': fields.char('Case Code', size=64),
'info': fields.text('Description'),
'sum': fields.function(_sum_year, method=True, string="Year Sum"),
@@ -1262,6 +1313,15 @@ class account_tax_code(osv.osv):
}
+ def name_search(self, cr, user, name, args=None, operator='ilike', context=None, limit=80):
+ if not args:
+ args = []
+ if context is None:
+ context = {}
+ ids = self.search(cr, user, ['|',('name',operator,name),('code',operator,name)] + args, limit=limit, context=context)
+ return self.name_get(cr, user, ids, context)
+
+
def name_get(self, cr, uid, ids, context=None):
if not len(ids):
return []
@@ -1290,7 +1350,15 @@ class account_tax_code(osv.osv):
return False
level -= 1
return True
+
+ def copy(self, cr, uid, id, default=None, context=None):
+ if default is None:
+ default = {}
+ default = default.copy()
+ default.update({'line_ids': []})
+ return super(account_tax_code, self).copy(cr, uid, id, default, context)
+
_constraints = [
(_check_recursion, 'Error ! You can not create recursive accounts.', ['parent_id'])
]
diff --git a/addons/account/account_analytic_line.py b/addons/account/account_analytic_line.py
index fa28f13b42e..64a22d65b21 100644
--- a/addons/account/account_analytic_line.py
+++ b/addons/account/account_analytic_line.py
@@ -30,7 +30,7 @@ from tools import config
class account_analytic_line(osv.osv):
_inherit = 'account.analytic.line'
- _description = 'Analytic lines'
+ _description = 'Analytic Line'
_columns = {
'product_uom_id' : fields.many2one('product.uom', 'UoM'),
'product_id' : fields.many2one('product.product', 'Product'),
@@ -118,7 +118,7 @@ account_analytic_line()
class timesheet_invoice(osv.osv):
_name = "report.hr.timesheet.invoice.journal"
- _description = "Analytic account costs and revenues"
+ _description = "Analytic Account Costs and Revenues"
_auto = False
_columns = {
'name': fields.char('Year',size=64,required=False, readonly=True),
diff --git a/addons/account/account_bank_statement.py b/addons/account/account_bank_statement.py
index deb010c7cd0..9b1497b563f 100644
--- a/addons/account/account_bank_statement.py
+++ b/addons/account/account_bank_statement.py
@@ -387,7 +387,7 @@ account_bank_statement()
class account_bank_statement_reconcile(osv.osv):
_name = "account.bank.statement.reconcile"
- _description = "Statement reconcile"
+ _description = "Statement Reconcile"
def _total_entry(self, cursor, user, ids, name, attr, context=None):
result = {}
@@ -558,35 +558,40 @@ class account_bank_statement_line(osv.osv):
def onchange_partner_id(self, cursor, user, line_id, partner_id, type, currency_id,
context={}):
+ res = {'value': {}}
if not partner_id:
- return {}
- res_currency_obj = self.pool.get('res.currency')
- res_users_obj = self.pool.get('res.users')
-
- company_currency_id = res_users_obj.browse(cursor, user, user,
- context=context).company_id.currency_id.id
-
- if not currency_id:
- currency_id = company_currency_id
-
- part = self.pool.get('res.partner').browse(cursor, user, partner_id,
+ return res
+ line = self.browse(cursor, user, line_id)
+
+ if not line or (line and not line[0].account_id):
+ part = self.pool.get('res.partner').browse(cursor, user, partner_id,
context=context)
- if type == 'supplier':
- account_id = part.property_account_payable.id
- else:
- account_id = part.property_account_receivable.id
+ if type == 'supplier':
+ account_id = part.property_account_payable.id
+ else:
+ account_id = part.property_account_receivable.id
+ res['value']['account_id'] = account_id
- cursor.execute('SELECT sum(debit-credit) \
+ if not line or (line and not line[0].amount):
+ res_users_obj = self.pool.get('res.users')
+ res_currency_obj = self.pool.get('res.currency')
+ company_currency_id = res_users_obj.browse(cursor, user, user,
+ context=context).company_id.currency_id.id
+ if not currency_id:
+ currency_id = company_currency_id
+
+ cursor.execute('SELECT sum(debit-credit) \
FROM account_move_line \
WHERE (reconcile_id is null) \
AND partner_id = %s \
AND account_id=%s', (partner_id, account_id))
- res = cursor.fetchone()
- balance = res and res[0] or 0.0
+ pgres = cursor.fetchone()
+ balance = pgres and pgres[0] or 0.0
- balance = res_currency_obj.compute(cursor, user, company_currency_id,
+ balance = res_currency_obj.compute(cursor, user, company_currency_id,
currency_id, balance, context=context)
- return {'value': {'amount': balance, 'account_id': account_id}}
+ res['value']['amount'] = balance
+ return res
def _reconcile_amount(self, cursor, user, ids, name, args, context=None):
if not ids:
@@ -633,7 +638,7 @@ class account_bank_statement_line(osv.osv):
'note': fields.text('Notes'),
'reconcile_amount': fields.function(_reconcile_amount,
string='Amount reconciled', method=True, type='float'),
- 'sequence': fields.integer('Sequence', help="Gives the sequence order when displaying a list of bank statement line."),
+ 'sequence': fields.integer('Sequence', help="Gives the sequence order when displaying a list of bank statement lines."),
}
_defaults = {
'name': lambda self,cr,uid,context={}: self.pool.get('ir.sequence').get(cr, uid, 'account.bank.statement.line'),
diff --git a/addons/account/account_invoice_view.xml b/addons/account/account_invoice_view.xml
index e955f498602..18d817f41bd 100644
--- a/addons/account/account_invoice_view.xml
+++ b/addons/account/account_invoice_view.xml
@@ -484,6 +484,8 @@
+
+
diff --git a/addons/account/account_invoice_workflow.xml b/addons/account/account_invoice_workflow.xml
index 374a436e9ac..4c919765596 100644
--- a/addons/account/account_invoice_workflow.xml
+++ b/addons/account/account_invoice_workflow.xml
@@ -50,7 +50,7 @@ write({'state':'open'})
paid
- write({'state':'paid'})
+ confirm_paid()functionsubflow.paid
diff --git a/addons/account/account_move_line.py b/addons/account/account_move_line.py
index a86fce20772..36b65d20dca 100644
--- a/addons/account/account_move_line.py
+++ b/addons/account/account_move_line.py
@@ -30,7 +30,7 @@ import tools
class account_move_line(osv.osv):
_name = "account.move.line"
- _description = "Entry lines"
+ _description = "Entry Lines"
def _query_get(self, cr, uid, obj='l', context={}):
fiscalyear_obj = self.pool.get('account.fiscalyear')
@@ -577,11 +577,12 @@ class account_move_line(osv.osv):
merges_rec = []
for line in self.browse(cr, uid, ids, context):
if line.reconcile_id:
- raise osv.except_osv(_('Already Reconciled'), _('Already Reconciled'))
+ raise osv.except_osv(_('Warning'), _('Already Reconciled!'))
if line.reconcile_partial_id:
for line2 in line.reconcile_partial_id.line_partial_ids:
if not line2.reconcile_id:
- merges.append(line2.id)
+ if line2.id not in merges:
+ merges.append(line2.id)
total += (line2.debit or 0.0) - (line2.credit or 0.0)
merges_rec.append(line.reconcile_partial_id.id)
else:
@@ -774,6 +775,17 @@ class account_move_line(osv.osv):
result['fields'] = self.fields_get(cr, uid, fields, context)
return result
+ def _check_moves(self, cr, uid, context):
+ # use the first move ever created for this journal and period
+ cr.execute('select id, state, name from account_move where journal_id=%s and period_id=%s order by id limit 1', (context['journal_id'],context['period_id']))
+ res = cr.fetchone()
+ if res:
+ if res[1] != 'draft':
+ raise osv.except_osv(_('UserError'),
+ _('The account move (%s) for centralisation ' \
+ 'has been confirmed!') % res[2])
+ return res
+
def unlink(self, cr, uid, ids, context={}, check=True):
self._update_check(cr, uid, ids, context)
result = False
@@ -809,7 +821,7 @@ class account_move_line(osv.osv):
return True
def write(self, cr, uid, ids, vals, context=None, check=True, update_check=True):
- if not context:
+ if context is None:
context={}
if vals.get('account_tax_id', False):
raise osv.except_osv(_('Unable to change tax !'), _('You can not change the tax, you should remove and recreate lines !'))
@@ -825,6 +837,24 @@ class account_move_line(osv.osv):
if vals.get('date', False):
todo_date = vals['date']
del vals['date']
+
+ for line in self.browse(cr, uid, ids,context=context):
+ ctx = context.copy()
+ if ('journal_id' not in ctx):
+ if line.move_id:
+ ctx['journal_id'] = line.move_id.journal_id.id
+ else:
+ ctx['journal_id'] = line.journal_id.id
+ if ('period_id' not in ctx):
+ if line.move_id:
+ ctx['period_id'] = line.move_id.period_id.id
+ else:
+ ctx['period_id'] = line.period_id.id
+ #Check for centralisation
+ journal = self.pool.get('account.journal').browse(cr, uid, ctx['journal_id'], context=ctx)
+ if journal.centralisation:
+ self._check_moves(cr, uid, context=ctx)
+
result = super(account_move_line, self).write(cr, uid, ids, vals, context)
if check:
@@ -891,14 +921,9 @@ class account_move_line(osv.osv):
is_new_move = False
if not move_id:
if journal.centralisation:
- # use the first move ever created for this journal and period
- cr.execute('select id, state, name from account_move where journal_id=%s and period_id=%s order by id limit 1', (context['journal_id'],context['period_id']))
- res = cr.fetchone()
+ #Check for centralisation
+ res = self._check_moves(cr, uid, context)
if res:
- if res[1] != 'draft':
- raise osv.except_osv(_('UserError'),
- _('The Ledger Posting (%s) for centralisation ' \
- 'has been confirmed!') % res[2])
vals['move_id'] = res[0]
if not vals.get('move_id', False):
@@ -926,7 +951,7 @@ class account_move_line(osv.osv):
break
if journal.account_control_ids and not ok:
for a in journal.account_control_ids:
- if a.id==vals['account_id']:
+ if a.id == vals['account_id']:
ok = True
break
if (account.currency_id) and 'amount_currency' not in vals and account.currency_id.id <> company_currency:
@@ -941,7 +966,7 @@ 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 !'))
- if 'analytic_account_id' in vals and vals['analytic_account_id']:
+ if vals.get('analytic_account_id',False):
if journal.analytic_journal_id:
vals['analytic_lines'] = [(0,0, {
'name': vals['name'],
@@ -961,8 +986,8 @@ class account_move_line(osv.osv):
result = super(osv.osv, self).create(cr, uid, vals, context)
# CREATE Taxes
- if 'account_tax_id' in vals and vals['account_tax_id']:
- tax_id=tax_obj.browse(cr,uid,vals['account_tax_id'])
+ if vals.get('account_tax_id',False):
+ tax_id = tax_obj.browse(cr, uid, vals['account_tax_id'])
total = vals['debit'] - vals['credit']
if journal.refund_journal:
base_code = 'ref_base_code_id'
@@ -978,7 +1003,7 @@ class account_move_line(osv.osv):
tax_sign = 'tax_sign'
tmp_cnt = 0
- for tax in tax_obj.compute(cr,uid,[tax_id],total,1.00):
+ for tax in tax_obj.compute(cr, uid, [tax_id], total, 1.00):
#create the base movement
if tmp_cnt == 0:
if tax[base_code]:
@@ -1031,7 +1056,7 @@ class account_move_line(osv.osv):
# 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'):
+ if check and ((not context.get('no_store_function')) or journal.entry_posted):
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/account_view.xml b/addons/account/account_view.xml
index 2ab119e59a7..88e5249735f 100644
--- a/addons/account/account_view.xml
+++ b/addons/account/account_view.xml
@@ -531,7 +531,10 @@
+
+
+
@@ -551,6 +554,7 @@
+
@@ -562,7 +566,7 @@
@@ -1451,9 +1455,11 @@
-
+
-
+
+
+ Account Add wizard
diff --git a/addons/account/invoice.py b/addons/account/invoice.py
index 34c7aa3e6ba..dbaa321f329 100644
--- a/addons/account/invoice.py
+++ b/addons/account/invoice.py
@@ -23,8 +23,8 @@ import time
import decimal_precision as dp
import netsvc
+
from osv import fields, osv, orm
-import ir
import pooler
from tools import config
from tools.translate import _
@@ -217,6 +217,7 @@ class account_invoice(osv.osv):
_name = "account.invoice"
_description = 'Invoice'
_order = "number"
+ _log_create = True
_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."),
@@ -333,7 +334,14 @@ class account_invoice(osv.osv):
raise orm.except_orm(_('Configuration Error!'),
_('There is no Accounting Journal of type Sale/Purchase defined!'))
else:
- raise
+ raise orm.except_orm(_('UnknownError'), str(e))
+
+ def confirm_paid(self, cr, uid, ids, context=None):
+ self.write(cr, uid, ids, {'state':'paid'}, context=context)
+ for (id,name) in self.name_get(cr, uid, ids):
+ message = _('Document ') + " '" + name + "' "+ _("has been paid.")
+ self.log(cr, uid, id, message)
+ return True
def unlink(self, cr, uid, ids, context=None):
invoices = self.read(cr, uid, ids, ['state'])
@@ -350,7 +358,7 @@ class account_invoice(osv.osv):
# res = self.pool.get('res.partner').address_get(cr, uid, [part], ['invoice'])
# return [{}]
def onchange_partner_id(self, cr, uid, ids, type, partner_id,
- date_invoice=False, payment_term=False, partner_bank_id=False, company_id=False):
+ date_invoice=False, payment_term=False, partner_bank=False, company_id=False):
invoice_addr_id = False
contact_addr_id = False
partner_payment_term = False
@@ -415,7 +423,7 @@ class account_invoice(osv.osv):
else:
result['value']['date_due'] = False
- if partner_bank_id != bank_id:
+ if partner_bank != bank_id:
to_update = self.onchange_partner_bank(cr, uid, ids, bank_id)
result['value'].update(to_update['value'])
return result
@@ -450,7 +458,7 @@ class account_invoice(osv.osv):
def onchange_invoice_line(self, cr, uid, ids, lines):
return {}
- def onchange_partner_bank(self, cursor, user, ids, partner_bank_id):
+ def onchange_partner_bank(self, cursor, user, ids, partner_bank):
return {'value': {}}
def onchange_company_id(self, cr, uid, ids, company_id, part_id, type, invoice_line, currency_id):
@@ -650,6 +658,16 @@ class account_invoice(osv.osv):
self.write(cr, uid, [inv.id], res['value'])
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
+
def check_tax_lines(self, cr, uid, inv, compute_taxes, ait_obj):
if not inv.tax_line:
for tax in compute_taxes.values():
@@ -912,7 +930,12 @@ class account_invoice(osv.osv):
# will be automatically deleted too
account_move_obj.unlink(cr, uid, [i['move_id'][0]])
if i['payment_ids']:
- self.pool.get('account.move.line').write(cr, uid, i['payment_ids'], {'reconcile_partial_id': False})
+ account_move_line_obj = self.pool.get('account.move.line')
+ pay_ids = account_move_line_obj.browse(cr, uid , i['payment_ids'])
+ for move_line in pay_ids:
+ if move_line.reconcile_partial_id and move_line.reconcile_partial_id.line_partial_ids:
+ raise osv.except_osv(_('Error !'), _('You cannot cancel the Invoice which is Partially Paid! You need to unreconcile concerned payment entries!'))
+
self.write(cr, uid, ids, {'state':'cancel', 'move_id':False})
self._log_event(cr, uid, ids,-1.0, 'Cancel Invoice')
return True
@@ -1147,14 +1170,14 @@ class account_invoice_line(osv.osv):
t = t - (p * l[2].get('quantity'))
taxes = l[2].get('invoice_line_tax_id')
if len(taxes[0]) >= 3 and taxes[0][2]:
- taxes=tax_obj.browse(cr, uid, taxes[0][2])
+ taxes = tax_obj.browse(cr, uid, taxes[0][2])
for tax in tax_obj.compute(cr, uid, taxes, p,l[2].get('quantity'), context.get('address_invoice_id', False), l[2].get('product_id', False), context.get('partner_id', False)):
t = t - tax['amount']
return t
return 0
_name = "account.invoice.line"
- _description = "Invoice line"
+ _description = "Invoice Line"
_columns = {
'name': fields.char('Description', size=256, required=True),
'origin': fields.char('Origin', size=256, help="Reference of the document that produced this invoice."),
@@ -1200,8 +1223,8 @@ class account_invoice_line(osv.osv):
part = self.pool.get('res.partner').browse(cr, uid, partner_id)
fpos = fposition_id and self.pool.get('account.fiscal.position').browse(cr, uid, fposition_id) or False
- lang=part.lang
- context.update({'lang': lang})
+ if part.lang:
+ context.update({'lang': part.lang})
result = {}
res = self.pool.get('product.product').browse(cr, uid, product, context=context)
diff --git a/addons/account/partner_view.xml b/addons/account/partner_view.xml
index 494c0f71a48..edbe704d4db 100644
--- a/addons/account/partner_view.xml
+++ b/addons/account/partner_view.xml
@@ -113,6 +113,7 @@
+
diff --git a/addons/account/project/project_view.xml b/addons/account/project/project_view.xml
index 71e57cb82e2..e57629d2618 100644
--- a/addons/account/project/project_view.xml
+++ b/addons/account/project/project_view.xml
@@ -25,13 +25,13 @@
-
+
@@ -97,6 +97,7 @@
formtree,graph,form
+ {"search_default_user_id":uid}
@@ -188,11 +189,11 @@
-
+
@@ -202,6 +203,7 @@
ir.actions.act_windowaccount.analytic.lineform
+ {"search_default_user_id":uid}
diff --git a/addons/account/project/report/analytic_check.py b/addons/account/project/report/analytic_check.py
index 54fbaddc4d9..458827d8bf3 100644
--- a/addons/account/project/report/analytic_check.py
+++ b/addons/account/project/report/analytic_check.py
@@ -54,12 +54,12 @@ class account_analytic_analytic_check(report_sxw.rml_parse):
self.cr.execute("SELECT abs(sum(amount)) AS balance \
FROM account_analytic_line \
- WHERE date>=%s AND date<=%s AND amount>0 AND general_account_id = %s", (date1, date2, a['id']))
+ WHERE date>=%s AND date<=%s AND amount<0 AND general_account_id = %s", (date1, date2, a['id']))
(ad,) = self.cr.fetchone()
ad = ad or 0.0
self.cr.execute("SELECT abs(sum(amount)) AS balance \
FROM account_analytic_line \
- WHERE date>=%s AND date<=%s AND amount<0 AND general_account_id = %s", (date1, date2, a['id']))
+ WHERE date>=%s AND date<=%s AND amount>0 AND general_account_id = %s", (date1, date2, a['id']))
(ac,) = self.cr.fetchone()
ac = ac or 0.0
diff --git a/addons/account/report/account_analytic_report_view.xml b/addons/account/report/account_analytic_report_view.xml
index de97bfcb798..e9336cd1393 100644
--- a/addons/account/report/account_analytic_report_view.xml
+++ b/addons/account/report/account_analytic_report_view.xml
@@ -44,12 +44,7 @@
-
-
-
+
diff --git a/addons/account/report/account_invoice_report_view.xml b/addons/account/report/account_invoice_report_view.xml
index 5a833e454fb..33d3442ddbb 100644
--- a/addons/account/report/account_invoice_report_view.xml
+++ b/addons/account/report/account_invoice_report_view.xml
@@ -79,10 +79,6 @@
- account.invoice.reportformtree,graph
- {'search_default_month':1,'search_default_User':1,'group_by_no_leaf':1,'group_by':[]}
+ {'search_default_month':1,'search_default_User':1,'group_by_no_leaf':1,'group_by':[],'search_default_user_id':uid}
diff --git a/addons/account/report/overdue.rml b/addons/account/report/overdue.rml
index 2713b665d06..e8e1a7dc84c 100644
--- a/addons/account/report/overdue.rml
+++ b/addons/account/report/overdue.rml
@@ -84,8 +84,8 @@
+
- [[ repeatIn(objects,'o') ]][[ setLang(o.lang) ]]
@@ -177,16 +177,16 @@
[[ line['ref'] ]]
- [[ line['date_maturity'] ]]
+ [[ line['date_maturity'] and formatLang(line['date_maturity'],date=True) or '' ]]
- [[ formatLang(line['debit']) and formatLang(line['debit'] * (line['account_id']['type'] == 'payable' and -1 or 1)) ]]
+ [[ (line['account_id']['type'] == 'receivable' and formatLang(line['debit']) or 0) or (line['account_id']['type'] == 'payable' and formatLang(line['credit'] * -1) or ' ') ]]
- [[ formatLang(line['credit']) and formatLang(line['credit'] * (line['account_id']['type'] == 'payable' and -1 or 1)) ]]
+ [[ (line['account_id']['type'] == 'receivable' and formatLang(line['credit']) or 0) or (line['account_id']['type'] == 'payable' and formatLang(line['debit'] * -1) or 0) ]]
- [[ formatLang((line['date_maturity'] < time.strftime('%Y-%m-%d')) and ((line['debit'] - line['credit']) * (line['account_id']['type'] == 'payable' and -1 or 1))) ]]
+ [[ formatLang((line['date_maturity'] < time.strftime('%Y-%m-%d'))) and (line['debit'] - line['credit']) ]]
[[ line['blocked'] and 'X' or '' ]]
@@ -205,13 +205,13 @@
Sub-Total :
- [[ formatLang((reduce(lambda x, y: x + (y['debit'] * (y['account_id']['type'] == 'payable' and -1 or 1)), getLines(o), 0))) ]]
+ [[ formatLang((reduce(lambda x, y: x + ((y['account_id']['type'] == 'receivable' and y['debit'] or 0) or (y['account_id']['type'] == 'payable' and y['credit'] * -1 or 0)), getLines(o), 0))) ]]
- [[ formatLang((reduce(lambda x ,y: x + (y['credit'] * (y['account_id']['type'] == 'payable' and -1 or 1)), getLines(o), 0))) ]]
+ [[ formatLang((reduce(lambda x, y: x + ((y['account_id']['type'] == 'receivable' and y['credit'] or 0) or (y['account_id']['type'] == 'payable' and y['debit'] * -1 or 0)), getLines(o), 0))) ]]
+
+
+
+
+ campaign.analysis.search
+ campaign.analysis
+ search
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Marketing Report
+ campaign.analysis
+ form
+ tree
+ {'group_by': [], 'search_default_group_campaign': 1, 'search_default_group_segment': 1}
+
+
+
+
+
+
+
diff --git a/addons/membership/membership.py b/addons/membership/membership.py
index 8c15c652335..23f9cd19275 100644
--- a/addons/membership/membership.py
+++ b/addons/membership/membership.py
@@ -28,7 +28,7 @@ import decimal_precision as dp
STATE = [
('none', 'Non Member'),
- ('canceled', 'Canceled Member'),
+ ('canceled', 'Cancelled Member'),
('old', 'Old Member'),
('waiting', 'Waiting Member'),
('invoiced', 'Invoiced Member'),
@@ -162,8 +162,9 @@ class membership_line(osv.osv):
res = {}
for line in self.browse(cr, uid, ids):
cr.execute('''
- SELECT i.state FROM
- account_invoice i WHERE
+ SELECT i.state, i.id FROM
+ account_invoice i
+ WHERE
i.id = (
SELECT l.invoice_id FROM
account_invoice_line l WHERE
@@ -186,6 +187,10 @@ class membership_line(osv.osv):
state = 'invoiced'
elif istate == 'paid':
state = 'paid'
+ inv = self.pool.get('account.invoice').browse(cr, uid, fetched[1])
+ for payment in inv.payment_ids:
+ if payment.invoice and payment.invoice.type == 'out_refund':
+ state = 'canceled'
elif istate == 'cancel':
state = 'canceled'
res[line.id] = state
@@ -253,11 +258,15 @@ class Partner(osv.osv):
s = 4
if partner_data.member_lines:
for mline in partner_data.member_lines:
- if mline.date_from <= today and mline.date_to >= today:
+ if mline.date_to >= today:
if mline.account_invoice_line and mline.account_invoice_line.invoice_id:
mstate = mline.account_invoice_line.invoice_id.state
if mstate == 'paid':
s = 0
+ inv = mline.account_invoice_line.invoice_id
+ for payment in inv.payment_ids:
+ if payment.invoice.type == 'out_refund':
+ s = 2
break
elif mstate == 'open' and s!=0:
s = 1
@@ -332,14 +341,12 @@ class Partner(osv.osv):
'''Return the cancel date of membership'''
res = {}
member_line_obj = self.pool.get('membership.membership_line')
- for partner_id in ids:
- line_id = member_line_obj.search(cr, uid, [('partner', '=', partner_id)],
- limit=1, order='date_cancel')
- if line_id:
- res[partner_id] = member_line_obj.read(cr, uid, line_id[0],
- ['date_cancel'])['date_cancel']
- else:
- res[partner_id] = False
+ for partner in self.browse(cr, uid, ids, context=context):
+ res[partner.id] = False
+ if partner.membership_state == 'canceled':
+ line_id = member_line_obj.search(cr, uid, [('partner', '=', partner.id)],limit=1, order='date_cancel')
+ if line_id:
+ res[partner.id] = member_line_obj.read(cr, uid, line_id[0],['date_cancel'])['date_cancel']
return res
def _get_partners(self, cr, uid, ids, context={}):
@@ -349,20 +356,23 @@ class Partner(osv.osv):
ids+=ids2
return ids
+ def __get_membership_state(self, *args, **kwargs):
+ return self._membership_state(*args, **kwargs)
+
_columns = {
'associate_member': fields.many2one('res.partner', 'Associate member'),
'member_lines': fields.one2many('membership.membership_line', 'partner', 'Membership'),
'free_member': fields.boolean('Free member'),
'membership_amount': fields.float(
- 'Membership amount', digites=(16, 2),
+ 'Membership amount', digits=(16, 2),
help='The price negociated by the partner'),
'membership_state': fields.function(
- _membership_state, method = True,
+ __get_membership_state, method = True,
string = 'Current membership state', type = 'selection',
selection = STATE ,store = {
'account.invoice':(_get_invoice_partner,['state'], 10),
'membership.membership_line':(_get_partner_id,['state'], 10),
- 'res.partner':(_get_partners, ['free_member', 'membership_state'], 10)
+ 'res.partner':(_get_partners, ['free_member', 'membership_state','associate_member'], 10)
}
),
'membership_start': fields.function(
@@ -388,7 +398,7 @@ class Partner(osv.osv):
_membership_cancel, method = True,
string = 'Cancel membership date', type='date',
store = {
- 'account.invoice':(_get_invoice_partner,['state'], 10),
+ 'account.invoice':(_get_invoice_partner,['state'], 11),
'membership.membership_line':(_get_partner_id,['state'], 10),
'res.partner':(lambda self,cr,uid,ids,c={}:ids, ['free_member'], 10)
}
@@ -412,7 +422,16 @@ class Partner(osv.osv):
_constraints = [
(_check_recursion, 'Error ! You can not create recursive associated members.', ['associate_member'])
]
-
+
+ def copy(self, cr, uid, id, default=None, context=None):
+ if default is None:
+ default = {}
+ if context is None:
+ context = {}
+ default = default.copy()
+ default['member_lines'] = []
+ return super(Partner, self).copy(cr, uid, id, default, context)
+
Partner()
class product_template(osv.osv):
@@ -439,8 +458,6 @@ class Product(osv.osv):
'''Product'''
_inherit = 'product.product'
- _description = 'product.product'
-
_columns = {
'membership': fields.boolean('Membership', help='Specify if this product is a membership product'),
'membership_date_from': fields.date('Date from'),
@@ -547,80 +564,6 @@ class ReportPartnerMemberYear(osv.osv):
ReportPartnerMemberYear()
-class ReportPartnerMemberYearNew(osv.osv):
- '''New Membership by Years'''
-
- _name = 'report.partner_member.year_new'
- _description = __doc__
- _auto = False
- _rec_name = 'year'
-
- _columns = {
- 'year': fields.char('Year', size='4', readonly=True, select=1),
- 'canceled_number': fields.integer('Canceled', readonly=True),
- 'waiting_number': fields.integer('Waiting', readonly=True),
- 'invoiced_number': fields.integer('Invoiced', readonly=True),
- 'paid_number': fields.integer('Paid', readonly=True),
- 'canceled_amount': fields.float('Canceled', digits=(16, 2), readonly=True),
- 'waiting_amount': fields.float('Waiting', digits=(16, 2), readonly=True),
- 'invoiced_amount': fields.float('Invoiced', digits=(16, 2), readonly=True),
- 'paid_amount': fields.float('Paid', digits=(16, 2), readonly=True),
- 'currency': fields.many2one('res.currency', 'Currency', readonly=True,
- select=2),
- }
-
- def init(self, cr):
- '''Create the view'''
- cr.execute("""
- CREATE OR REPLACE VIEW report_partner_member_year AS (
- SELECT
- MIN(id) AS id,
- COUNT(ncanceled) as canceled_number,
- COUNT(npaid) as paid_number,
- COUNT(ninvoiced) as invoiced_number,
- COUNT(nwaiting) as waiting_number,
- SUM(acanceled) as canceled_amount,
- SUM(apaid) as paid_amount,
- SUM(ainvoiced) as invoiced_amount,
- SUM(awaiting) as waiting_amount,
- year,
- currency
- FROM (SELECT
- CASE WHEN ai.state = 'cancel' THEN ml.id END AS ncanceled,
- CASE WHEN ai.state = 'paid' THEN ml.id END AS npaid,
- CASE WHEN ai.state = 'open' THEN ml.id END AS ninvoiced,
- CASE WHEN (ai.state = 'draft' OR ai.state = 'proforma')
- THEN ml.id END AS nwaiting,
- CASE WHEN ai.state = 'cancel'
- THEN SUM(ail.price_unit * ail.quantity * (1 - ail.discount / 100))
- ELSE 0 END AS acanceled,
- CASE WHEN ai.state = 'paid'
- THEN SUM(ail.price_unit * ail.quantity * (1 - ail.discount / 100))
- ELSE 0 END AS apaid,
- CASE WHEN ai.state = 'open'
- THEN SUM(ail.price_unit * ail.quantity * (1 - ail.discount / 100))
- ELSE 0 END AS ainvoiced,
- CASE WHEN (ai.state = 'draft' OR ai.state = 'proforma')
- THEN SUM(ail.price_unit * ail.quantity * (1 - ail.discount / 100))
- ELSE 0 END AS awaiting,
- TO_CHAR(ml.date_from, 'YYYY') AS year,
- ai.currency_id AS currency,
- MIN(ml.id) AS id
- FROM membership_membership_line ml
- JOIN (account_invoice_line ail
- LEFT JOIN account_invoice ai
- ON (ail.invoice_id = ai.id))
- ON (ml.account_invoice_line = ail.id)
- JOIN res_partner p
- ON (ml.partner = p.id)
- GROUP BY TO_CHAR(ml.date_from, 'YYYY'), ai.state,
- ai.currency_id, ml.id) AS foo
- GROUP BY year, currency)
- """)
-
-ReportPartnerMemberYear()
-
-
class ReportPartnerMemberYearNew(osv.osv):
'''New Membership by Years'''
@@ -703,28 +646,30 @@ ReportPartnerMemberYearNew()
class account_invoice_line(osv.osv):
_inherit='account.invoice.line'
+
def write(self, cr, uid, ids, vals, context=None):
if not context:
context={}
res = super(account_invoice_line, self).write(cr, uid, ids, vals, context=context)
member_line_obj = self.pool.get('membership.membership_line')
for line in self.browse(cr, uid, ids):
- ml_ids = member_line_obj.search(cr, uid, [('account_invoice_line','=',line.id)])
- if line.product_id and line.product_id.membership and not ml_ids:
- # Product line has changed to a membership product
- date_from = line.product_id.membership_date_from
- date_to = line.product_id.membership_date_to
- if line.invoice_id.date_invoice > date_from and line.invoice_id.date_invoice < date_to:
- date_from = line.invoice_id.date_invoice
- line_id = member_line_obj.create(cr, uid, {
- 'partner': line.invoice_id.partner_id.id,
- 'date_from': date_from,
- 'date_to': date_to,
- 'account_invoice_line': line.id,
- })
- if line.product_id and not line.product_id.membership and ml_ids:
- # Product line has changed to a non membership product
- member_line_obj.unlink(cr, uid, ml_ids, context=context)
+ if line.invoice_id.type == 'out_invoice':
+ ml_ids = member_line_obj.search(cr, uid, [('account_invoice_line','=',line.id)])
+ if line.product_id and line.product_id.membership and not ml_ids:
+ # Product line has changed to a membership product
+ date_from = line.product_id.membership_date_from
+ date_to = line.product_id.membership_date_to
+ if line.invoice_id.date_invoice > date_from and line.invoice_id.date_invoice < date_to:
+ date_from = line.invoice_id.date_invoice
+ line_id = member_line_obj.create(cr, uid, {
+ 'partner': line.invoice_id.partner_id.id,
+ 'date_from': date_from,
+ 'date_to': date_to,
+ 'account_invoice_line': line.id,
+ })
+ if line.product_id and not line.product_id.membership and ml_ids:
+ # Product line has changed to a non membership product
+ member_line_obj.unlink(cr, uid, ml_ids, context=context)
return res
def unlink(self, cr, uid, ids, context=None):
@@ -739,20 +684,21 @@ class account_invoice_line(osv.osv):
def create(self, cr, uid, vals, context={}):
result = super(account_invoice_line, self).create(cr, uid, vals, context)
line = self.browse(cr, uid, result)
- member_line_obj = self.pool.get('membership.membership_line')
- ml_ids = member_line_obj.search(cr, uid, [('account_invoice_line','=',line.id)])
- if line.product_id and line.product_id.membership and not ml_ids:
- # Product line is a membership product
- date_from = line.product_id.membership_date_from
- date_to = line.product_id.membership_date_to
- if line.invoice_id.date_invoice > date_from and line.invoice_id.date_invoice < date_to:
- date_from = line.invoice_id.date_invoice
- line_id = member_line_obj.create(cr, uid, {
- 'partner': line.invoice_id.partner_id and line.invoice_id.partner_id.id or False,
- 'date_from': date_from,
- 'date_to': date_to,
- 'account_invoice_line': line.id,
- })
+ if line.invoice_id.type == 'out_invoice':
+ member_line_obj = self.pool.get('membership.membership_line')
+ ml_ids = member_line_obj.search(cr, uid, [('account_invoice_line','=',line.id)])
+ if line.product_id and line.product_id.membership and not ml_ids:
+ # Product line is a membership product
+ date_from = line.product_id.membership_date_from
+ date_to = line.product_id.membership_date_to
+ if line.invoice_id.date_invoice > date_from and line.invoice_id.date_invoice < date_to:
+ date_from = line.invoice_id.date_invoice
+ line_id = member_line_obj.create(cr, uid, {
+ 'partner': line.invoice_id.partner_id and line.invoice_id.partner_id.id or False,
+ 'date_from': date_from,
+ 'date_to': date_to,
+ 'account_invoice_line': line.id,
+ })
return result
account_invoice_line()
diff --git a/addons/membership/membership_view.xml b/addons/membership/membership_view.xml
index b459ab1eb9d..00dde266b4b 100644
--- a/addons/membership/membership_view.xml
+++ b/addons/membership/membership_view.xml
@@ -53,8 +53,8 @@
-
-
+
+
diff --git a/addons/membership/security/ir.model.access.csv b/addons/membership/security/ir.model.access.csv
index de35a7c8adc..cb722db567a 100644
--- a/addons/membership/security/ir.model.access.csv
+++ b/addons/membership/security/ir.model.access.csv
@@ -3,3 +3,5 @@
"access_membership_membership_line","membership.membership_line","model_membership_membership_line",,1,0,0,0
"access_report_partner_member_year","report.partner_member.year","model_report_partner_member_year","base.group_partner_manager",1,0,0,0
"access_report_partner_member_year_new","report.partner_member.year_new","model_report_partner_member_year_new","base.group_partner_manager",1,0,0,0
+"access_membership_invoice","membership.invoice","model_membership_invoice",,1,1,1,1
+"access_membership_unpaid_invoice","membership.unpaid.invoice","model_membership_unpaid_invoice",,1,0,0,0
diff --git a/addons/mrp/mrp.py b/addons/mrp/mrp.py
index d5cea81933b..966572f772c 100644
--- a/addons/mrp/mrp.py
+++ b/addons/mrp/mrp.py
@@ -94,7 +94,7 @@ class mrp_routing_workcenter(osv.osv):
Defines working cycles and hours of a workcenter using routings.
"""
_name = 'mrp.routing.workcenter'
- _description = 'Routing workcenter usage'
+ _description = 'Workcenter Usage'
_columns = {
'workcenter_id': fields.many2one('mrp.workcenter', 'Work Center', required=True),
'name': fields.char('Name', size=64, required=True),
@@ -118,7 +118,7 @@ class mrp_bom(osv.osv):
Defines bills of material for a product.
"""
_name = 'mrp.bom'
- _description = 'Bills of Material'
+ _description = 'Bill of Material'
def _child_compute(self, cr, uid, ids, name, arg, context={}):
""" Gets child bom.
@@ -314,7 +314,6 @@ class mrp_bom(osv.osv):
d, m = divmod(factor, wc_use.workcenter_id.capacity_per_cycle)
mult = (d + (m and 1.0 or 0.0))
cycle = mult * wc_use.cycle_nbr
- print mult, wc_use.hour_nbr, wc.time_start, wc.time_stop, cycle
result2.append({
'name': bom.routing_id.name,
'workcenter_id': wc.id,
@@ -351,8 +350,7 @@ mrp_bom()
class mrp_bom_revision(osv.osv):
_name = 'mrp.bom.revision'
- _description = 'Bill of material revisions'
-
+ _description = 'Bill of Material Revision'
_columns = {
'name': fields.char('Modification name', size=64, required=True),
'description': fields.text('Description'),
@@ -419,8 +417,9 @@ class mrp_production(osv.osv):
Production Orders / Manufacturing Orders
"""
_name = 'mrp.production'
- _description = 'Production'
- _date_name = 'date_planned'
+ _description = 'Manufacturing Order'
+ _date_name = 'date_planned'
+ _log_create = True
def _production_calc(self, cr, uid, ids, prop, unknow_none, context={}):
""" Calculates total hours and total no. of cycles for a production order.
@@ -648,6 +647,9 @@ class mrp_production(osv.osv):
""" Changes the production state to Ready and location id of stock move.
@return: True
"""
+ for (id,name) in self.name_get(cr, uid, ids):
+ message = _('Manufacturing Order ') + " '" + name + "' "+ _("is ready to produce.")
+ self.log(cr, uid, id, message)
move_obj = self.pool.get('stock.move')
self.write(cr, uid, ids, {'state': 'ready'})
for production in self.browse(cr, uid, ids):
@@ -934,7 +936,7 @@ mrp_production()
class mrp_production_workcenter_line(osv.osv):
_name = 'mrp.production.workcenter.line'
- _description = 'Work Orders'
+ _description = 'Work Order'
_order = 'sequence'
_columns = {
@@ -954,8 +956,7 @@ mrp_production_workcenter_line()
class mrp_production_product_line(osv.osv):
_name = 'mrp.production.product.line'
- _description = 'Production scheduled products'
-
+ _description = 'Production Scheduled Product'
_columns = {
'name': fields.char('Name', size=64, required=True),
'product_id': fields.many2one('product.product', 'Product', required=True),
diff --git a/addons/mrp/mrp_demo.xml b/addons/mrp/mrp_demo.xml
index 8962eb6e1c8..581cc04c05e 100644
--- a/addons/mrp/mrp_demo.xml
+++ b/addons/mrp/mrp_demo.xml
@@ -170,7 +170,7 @@
1.0normal
-
+
@@ -179,21 +179,21 @@
1.0
-
+ Assembly Medium PC81.0
-
+ Assembly Customizable PC111.0
-
+ HDD on demand
@@ -201,7 +201,7 @@
1.0phantom
-
+ RAM on demand
@@ -209,7 +209,7 @@
1.0phantom
-
+ HDD on demand
@@ -217,7 +217,7 @@
1.0phantom
-
+ HDD on demand
@@ -225,7 +225,7 @@
1.0phantom
-
+ HDD Seagate
@@ -233,7 +233,7 @@
1.0normal
-
+ Assembly Basic PC
@@ -242,14 +242,14 @@
1.0normal
-
+ Complete PC with peripherals331.0
-
+ RAM on demand
@@ -257,7 +257,7 @@
1.0phantom
-
+
@@ -265,7 +265,7 @@
381.0
-
+
@@ -276,7 +276,7 @@
1.0normal
-
+ Keyboard
@@ -284,7 +284,7 @@
1.0
-
+ Mouse
@@ -292,7 +292,7 @@
1.0
-
+ Moon PC
@@ -300,7 +300,7 @@
1.0
-
+ Mainboard ASUStek A7N8X
@@ -308,7 +308,7 @@
1.0
-
+ Processor AMD Athlon 2200+
@@ -316,7 +316,7 @@
1.0
-
+ Regular Case Fan
@@ -324,7 +324,7 @@
1.0
-
+ DDR 256MB PC333
@@ -332,7 +332,7 @@
1.0
-
+ DDR 512MB PC400
@@ -340,7 +340,7 @@
1.0
-
+ DDR 1024MB PC400
@@ -348,7 +348,7 @@
1.0
-
+ HDD Seagate 7200.8 80GB
@@ -356,7 +356,7 @@
1.0
-
+ HDD Seagate 7200.8 120GB
@@ -365,7 +365,7 @@
1.0normal
-
+ RAM on demand
@@ -373,7 +373,7 @@
1.0
-
+ HDD on demand
@@ -381,7 +381,7 @@
1.0
-
+ ATX middle-size case
@@ -390,7 +390,7 @@
1.0normal
-
+ Processor on demand
@@ -399,7 +399,7 @@
1.0normal
-
+ ATX Middle-size case
@@ -408,7 +408,7 @@
1.0normal
-
+ HDD Seagate 7200.8 80GB
@@ -417,7 +417,7 @@
1.0normal
-
+ High speed processor config
@@ -426,7 +426,7 @@
1.0normal
-
+ HDD Seagate 7200.8 120GB
@@ -435,7 +435,7 @@
1.0normal
-
+ Regular processor config
@@ -444,7 +444,7 @@
1.0normal
-
+ ATX middle-size case
@@ -453,7 +453,7 @@
1.0normal
-
+ HDD Seagate 7200.8 120GB
@@ -462,7 +462,7 @@
1.0normal
-
+ processor
@@ -471,7 +471,7 @@
1.0normal
-
+ mainboard
@@ -480,7 +480,7 @@
1.0normal
-
+ fan
@@ -489,7 +489,7 @@
1.0normal
-
+ RAM
@@ -498,7 +498,7 @@
1.0normal
-
+ Regular processor config
@@ -507,7 +507,7 @@
1.0normal
-
+ HDD Seagate 7200.8 80GB
@@ -516,7 +516,7 @@
1.0normal
-
+ ATX Middle-size case
@@ -525,7 +525,7 @@
1.0normal
-
+
@@ -536,7 +536,7 @@
1.0normal
-
+ Mouse
@@ -544,7 +544,7 @@
1.0
-
+ Keyboard
@@ -552,7 +552,7 @@
1.0
-
+
diff --git a/addons/mrp/mrp_order_point.xml b/addons/mrp/mrp_order_point.xml
index ba2e56e8515..433078263c1 100644
--- a/addons/mrp/mrp_order_point.xml
+++ b/addons/mrp/mrp_order_point.xml
@@ -9,7 +9,7 @@
5.0
-
+
@@ -17,7 +17,7 @@
10.0
-
+
@@ -25,7 +25,7 @@
10.0
-
+
@@ -33,7 +33,7 @@
10.0
-
+
@@ -41,7 +41,7 @@
3.0
-
+
@@ -49,7 +49,7 @@
10.0
-
+
diff --git a/addons/mrp/stock.py b/addons/mrp/stock.py
index dcb7d4573c1..9bcc92e5c81 100644
--- a/addons/mrp/stock.py
+++ b/addons/mrp/stock.py
@@ -27,6 +27,77 @@ import ir
import netsvc
import time
+
+class stock_warehouse_orderpoint(osv.osv):
+ """
+ Defines Minimum stock rules.
+ """
+ _name = "stock.warehouse.orderpoint"
+ _description = "Minimum Inventory Rule"
+
+ _columns = {
+ 'name': fields.char('Name', size=32, required=True),
+ 'active': fields.boolean('Active', help="If the active field is set to true, it will allow you to hide the orderpoint without removing it."),
+ 'logic': fields.selection([('max','Order to Max'),('price','Best price (not yet active!)')], 'Reordering Mode', required=True),
+ 'warehouse_id': fields.many2one('stock.warehouse', 'Warehouse', required=True, ondelete="cascade"),
+ 'location_id': fields.many2one('stock.location', 'Location', required=True, ondelete="cascade"),
+ 'product_id': fields.many2one('product.product', 'Product', required=True, ondelete='cascade', domain=[('type','=','product')]),
+ 'product_uom': fields.many2one('product.uom', 'Product UOM', required=True),
+ 'product_min_qty': fields.float('Min Quantity', required=True,
+ help="When the virtual stock goes belong the Min Quantity, Open ERP generates "\
+ "a procurement to bring the virtual stock to the Max Quantity."),
+ 'product_max_qty': fields.float('Max Quantity', required=True,
+ help="When the virtual stock goes belong the Min Quantity, Open ERP generates "\
+ "a procurement to bring the virtual stock to the Max Quantity."),
+ 'qty_multiple': fields.integer('Qty Multiple', required=True,
+ help="The procurement quantity will by rounded up to this multiple."),
+ 'procurement_id': fields.many2one('mrp.procurement', 'Latest procurement', ondelete="set null"),
+ 'company_id': fields.many2one('res.company','Company',required=True),
+ }
+ _defaults = {
+ 'active': lambda *a: 1,
+ 'logic': lambda *a: 'max',
+ 'qty_multiple': lambda *a: 1,
+ 'name': lambda x,y,z,c: x.pool.get('ir.sequence').get(y,z,'mrp.warehouse.orderpoint') or '',
+ 'product_uom': lambda sel, cr, uid, context: context.get('product_uom', False),
+ 'company_id': lambda self, cr, uid, c: self.pool.get('res.company')._company_default_get(cr, uid, 'stock.warehouse.orderpoint', context=c)
+ }
+ _sql_constraints = [
+ ('qty_multiple_check', 'CHECK( qty_multiple > 0 )', _('Qty Multiple must be greater than zero.')),
+ ]
+
+ def onchange_warehouse_id(self, cr, uid, ids, warehouse_id, context={}):
+ """ Finds location id for changed warehouse.
+ @param warehouse_id: Changed id of warehouse.
+ @return: Dictionary of values.
+ """
+ if warehouse_id:
+ w = self.pool.get('stock.warehouse').browse(cr, uid, warehouse_id, context)
+ v = {'location_id': w.lot_stock_id.id}
+ return {'value': v}
+ return {}
+
+ def onchange_product_id(self, cr, uid, ids, product_id, context={}):
+ """ Finds UoM for changed product.
+ @param product_id: Changed id of product.
+ @return: Dictionary of values.
+ """
+ if product_id:
+ prod = self.pool.get('product.product').browse(cr,uid,product_id)
+ v = {'product_uom': prod.uom_id.id}
+ return {'value': v}
+ return {}
+
+ def copy(self, cr, uid, id, default=None,context={}):
+ if not default:
+ default = {}
+ default.update({
+ 'name': self.pool.get('ir.sequence').get(cr, uid, 'mrp.warehouse.orderpoint') or '',
+ })
+ return super(stock_warehouse_orderpoint, self).copy(cr, uid, id, default, context)
+
+stock_warehouse_orderpoint()
+
class StockMove(osv.osv):
_inherit = 'stock.move'
diff --git a/addons/mrp/wizard/mrp_product_produce.py b/addons/mrp/wizard/mrp_product_produce.py
index b64567a407a..4688f3fb15b 100644
--- a/addons/mrp/wizard/mrp_product_produce.py
+++ b/addons/mrp/wizard/mrp_product_produce.py
@@ -20,8 +20,6 @@
##############################################################################
from osv import fields, osv
-from tools.translate import _
-import netsvc
class mrp_product_produce(osv.osv_memory):
_name = "mrp.product.produce"
diff --git a/addons/mrp_jit/__openerp__.py b/addons/mrp_jit/__openerp__.py
index 77bc60e56dd..d9a862f5ddd 100644
--- a/addons/mrp_jit/__openerp__.py
+++ b/addons/mrp_jit/__openerp__.py
@@ -27,19 +27,15 @@
'description': """
This module allows Just In Time computation of procurement orders.
- If you install this module, you will not have to run the procurement scheduler
- manually anymore, or wait for it to execute.
- Each procurement order (resulting from a sale order, for instance) will be computed
- when confirmed, without waiting for the procurement scheduler to run.
-
- Warning: this does not take into account minimum stock rules (order points), which still
- require to run the appropriate scheduler, or wait for it to run nightly.
-
- Note that the procurement computation can be resource-intensive, so you may
- want to be careful with this, depending on your mrp configuration and system
- usage.
+ If you install this module, you will not have to run the regular procurement
+ scheduler anymore (but you still need to run the minimum order point rule
+ scheduler, or for example let it run daily.)
+ All procurement orders will be processed immediately, which could in some
+ cases entail a small performance impact.
+
It may also increase your stock size because products are reserved as soon
- as possible. In that case, you can not use priorities any more.
+ as possible and the scheduler time range is not taken into account anymore.
+ In that case, you can not use priorities any more on the different picking.
""",
diff --git a/addons/mrp_operations/mrp_operations.py b/addons/mrp_operations/mrp_operations.py
index 46e1dec1e12..e8a97a47d9d 100644
--- a/addons/mrp_operations/mrp_operations.py
+++ b/addons/mrp_operations/mrp_operations.py
@@ -185,7 +185,7 @@ class mrp_production(osv.osv):
def action_production_end(self, cr, uid, ids):
obj=self.browse(cr,uid,ids)[0]
for workcenter_line in obj.workcenter_lines:
- tmp=self.pool.get('mrp.production.workcenter.line').action_done(cr,uid,[workcenter_line.id])
+ tmp = self.pool.get('mrp.production.workcenter.line').action_done(cr,uid,[workcenter_line.id])
return super(mrp_production,self).action_production_end(cr,uid,ids)
def action_in_production(self, cr, uid, ids):
diff --git a/addons/mrp_procurement/mrp_procurement.py b/addons/mrp_procurement/mrp_procurement.py
index bd5b223779f..cb20f1561fd 100644
--- a/addons/mrp_procurement/mrp_procurement.py
+++ b/addons/mrp_procurement/mrp_procurement.py
@@ -68,8 +68,8 @@ class mrp_procurement(osv.osv):
"""
_name = "mrp.procurement"
_description = "Procurement"
- _order = 'priority,date_planned'
-
+ _order = 'priority,date_planned desc'
+ _log_create = False
_columns = {
'name': fields.char('Reason', size=64, required=True, help='Procurement name.'),
'origin': fields.char('Source Document', size=64,
@@ -328,14 +328,11 @@ class mrp_procurement(osv.osv):
'product_qty': procurement.product_qty,
'product_uom': procurement.product_uom.id,
'date_planned': procurement.date_planned,
- 'state': 'confirmed',
+ 'state': 'draft',
'company_id': procurement.company_id.id,
})
+ move_obj.action_confirm(cr, uid, [id], context=context)
self.write(cr, uid, [procurement.id], {'move_id': id, 'close_move': 1})
- else:
- # TODO: check this
- if procurement.procure_method == 'make_to_stock' and procurement.move_id.state in ('waiting',):
- id = move_obj.write(cr, uid, [procurement.move_id.id], {'state':'confirmed'})
self.write(cr, uid, ids, {'state': 'confirmed', 'message': ''})
return True
diff --git a/addons/mrp_procurement/schedulers.py b/addons/mrp_procurement/schedulers.py
index 7a89723e5ca..6ebc0f61fad 100644
--- a/addons/mrp_procurement/schedulers.py
+++ b/addons/mrp_procurement/schedulers.py
@@ -197,7 +197,7 @@ class mrp_procurement(osv.osv):
if reste > 0:
qty += op.qty_multiple - reste
newdate = DateTime.now() + DateTime.RelativeDateTime(
- days=int(op.product_id.seller_delay))
+ days = int(op.product_id.seller_delay))
if op.product_id.supply_method == 'buy':
location_id = op.warehouse_id.lot_input_id
elif op.product_id.supply_method == 'produce':
diff --git a/addons/mrp_repair/mrp_repair.py b/addons/mrp_repair/mrp_repair.py
index f59da6a751c..e31b4e05594 100644
--- a/addons/mrp_repair/mrp_repair.py
+++ b/addons/mrp_repair/mrp_repair.py
@@ -30,7 +30,7 @@ import decimal_precision as dp
class mrp_repair(osv.osv):
_name = 'mrp.repair'
- _description = 'Repairs Order'
+ _description = 'Repair Order'
def _amount_untaxed(self, cr, uid, ids, field_name, arg, context):
""" Calculates untaxed amount.
@@ -346,12 +346,14 @@ class mrp_repair(osv.osv):
}
invoice_obj.write(cr, uid, [inv_id], invoice_vals, context=context)
else:
- a = repair.partner_id.property_account_receivable.id
+ if not repair.partner_id.property_account_receivable:
+ raise osv.except_osv(_('Error !'), _('No account defined for partner "%s".') % repair.partner_id.name )
+ account_id = repair.partner_id.property_account_receivable.id
inv = {
'name': repair.name,
'origin':repair.name,
'type': 'out_invoice',
- 'account_id': a,
+ 'account_id': account_id,
'partner_id': repair.partner_id.id,
'address_invoice_id': repair.address_id.id,
'currency_id': repair.pricelist_id.currency_id.id,
@@ -368,11 +370,19 @@ class mrp_repair(osv.osv):
name = repair.name + '-' + operation.name
else:
name = operation.name
+
+ if operation.product_id.property_account_income:
+ account_id = operation.product_id.property_account_income
+ elif operation.product_id.categ_id.property_account_income_categ:
+ account_id = operation.product_id.categ_id.property_account_income_categ.id
+ else:
+ raise osv.except_osv(_('Error !'), _('No account defined for product "%s".') % operation.product_id.name )
+
invoice_line_id = inv_line_obj.create(cr, uid, {
'invoice_id': inv_id,
'name': name,
'origin': repair.name,
- 'account_id': operation.product_id and operation.product_id.property_account_income and operation.product_id.property_account_income.id,
+ 'account_id': account_id,
'quantity': operation.product_uom_qty,
'invoice_line_tax_id': [(6,0,[x.id for x in operation.tax_id])],
'uos_id': operation.product_uom.id,
@@ -580,7 +590,7 @@ class ProductChangeMixin(object):
class mrp_repair_line(osv.osv, ProductChangeMixin):
_name = 'mrp.repair.line'
- _description = 'Repair Operations Lines'
+ _description = 'Repair Line'
def copy_data(self, cr, uid, id, default=None, context=None):
if not default: default = {}
@@ -668,7 +678,7 @@ mrp_repair_line()
class mrp_repair_fee(osv.osv, ProductChangeMixin):
_name = 'mrp.repair.fee'
- _description = 'Repair Fees line'
+ _description = 'Repair Fees Line'
def copy_data(self, cr, uid, id, default=None, context=None):
if not default: default = {}
diff --git a/addons/mrp_repair/wizard/cancel_repair.py b/addons/mrp_repair/wizard/cancel_repair.py
index ecc88ef6aae..d866d70cb6a 100644
--- a/addons/mrp_repair/wizard/cancel_repair.py
+++ b/addons/mrp_repair/wizard/cancel_repair.py
@@ -19,7 +19,6 @@
#
##############################################################################
-import netsvc
from osv import osv,fields
from tools.translate import _
diff --git a/addons/mrp_subproduct/mrp_subproduct.py b/addons/mrp_subproduct/mrp_subproduct.py
index 22ae9c44bec..e64e757868f 100644
--- a/addons/mrp_subproduct/mrp_subproduct.py
+++ b/addons/mrp_subproduct/mrp_subproduct.py
@@ -24,7 +24,7 @@ from osv import osv
class mrp_subproduct(osv.osv):
_name = 'mrp.subproduct'
- _description = 'Mrp Sub Product'
+ _description = 'Sub Product'
_columns={
'product_id': fields.many2one('product.product', 'Product', required=True),
'product_qty': fields.float('Product Qty', required=True),
@@ -59,18 +59,20 @@ class mrp_production(osv.osv):
_inherit= 'mrp.production'
def action_confirm(self, cr, uid, ids):
- picking_id=super(mrp_production,self).action_confirm(cr, uid, ids)
- for production in self.browse(cr, uid, ids):
- source = production.product_id.product_tmpl_id.property_stock_production.id
- for sub_product in production.bom_id.sub_products:
- qty1 = sub_product.product_qty
- qty2 = production.product_uos and production.product_uos_qty or False
- if sub_product.subproduct_type=='variable':
+ picking_id=super(mrp_production,self).action_confirm(cr, uid, ids)
+ for production in self.browse(cr, uid, ids):
+ source = production.product_id.product_tmpl_id.property_stock_production.id
+ if not production.bom_id:
+ continue
+ for sub_product in production.bom_id.sub_products:
+ qty1 = sub_product.product_qty
+ qty2 = production.product_uos and production.product_uos_qty or False
+ if sub_product.subproduct_type=='variable':
if production.product_qty:
qty1 *= production.product_qty / (production.bom_id.product_qty or 1.0)
if production.product_uos_qty:
qty2 *= production.product_uos_qty / (production.bom_id.product_uos_qty or 1.0)
- data = {
+ data = {
'name':'PROD:'+production.name,
'date_planned': production.date_planned,
'product_id': sub_product.product_id.id,
@@ -83,9 +85,9 @@ class mrp_production(osv.osv):
'move_dest_id': production.move_prod_id.id,
'state': 'waiting',
'production_id':production.id
- }
- sub_prod_ids=self.pool.get('stock.move').create(cr, uid,data)
- return picking_id
+ }
+ sub_prod_ids=self.pool.get('stock.move').create(cr, uid,data)
+ return picking_id
mrp_production()
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
diff --git a/addons/point_of_sale/account_bank_statement.py b/addons/point_of_sale/account_bank_statement.py
index 57276219861..1f8ccc80162 100644
--- a/addons/point_of_sale/account_bank_statement.py
+++ b/addons/point_of_sale/account_bank_statement.py
@@ -49,7 +49,7 @@ class singer_statement(osv.osv):
""" Singer Statements """
_name = 'singer.statement'
- _description = 'Statements'
+ _description = 'Statement'
def _sub_total(self, cr, uid, ids, name, arg, context=None):
diff --git a/addons/point_of_sale/pos.py b/addons/point_of_sale/pos.py
index ede0f7bd15c..e2c41c118c0 100644
--- a/addons/point_of_sale/pos.py
+++ b/addons/point_of_sale/pos.py
@@ -31,11 +31,9 @@ import re
import decimal_precision as dp
class pos_config_journal(osv.osv):
-
""" Point of Sale journal configuration"""
-
_name = 'pos.config.journal'
- _description = "Point of Sale journal configuration"
+ _description = "Journal Configuration"
_columns = {
'name': fields.char('Description', size=64),
'code': fields.char('Code', size=64),
diff --git a/addons/point_of_sale/pos_view.xml b/addons/point_of_sale/pos_view.xml
index c36420da08a..7f052e472ee 100644
--- a/addons/point_of_sale/pos_view.xml
+++ b/addons/point_of_sale/pos_view.xml
@@ -65,7 +65,7 @@
+ attrs="{'invisible':[('state','!=','paid'),('state','!=','invoiced')]}"/>
@@ -157,9 +157,7 @@
-
-
-
+
@@ -171,12 +169,12 @@
-
+
-
+
@@ -188,8 +186,9 @@
tree,form['|',('state_2','=','to_verify'),('state','=','advance')]
-
-
+ {"search_default_user_id":uid}
+
+
@@ -200,8 +199,9 @@
tree,form[('state','!=', 'invoiced')]
-
-
+ {"search_default_user_id":uid}
+
+
@@ -212,7 +212,8 @@
formtree,form[('state','=', 'paid')]
-
+ {"search_default_user_id":uid}
+ Point of Sale
@@ -221,7 +222,8 @@
formtree,form[('date_order','<=', time.strftime('%Y-%m-%d 23:59:59'))]
-
+ {"search_default_user_id":uid}
+
@@ -230,7 +232,8 @@
pos.orderformtree,form
-
+ {"search_default_user_id":uid}
+ Opened Sales
@@ -238,7 +241,8 @@
pos.orderformform,tree
-
+ {"search_default_user_id":uid}
+
@@ -789,7 +793,7 @@
parent="menu_point_config_product"
action="action_product_output"
id="products_for_output_operations"/>
-
+
-
+
-
+
- CPU2
+ CPU3150.0100.0
@@ -303,7 +303,7 @@
- CPU_GEN
+ CPU_DEMproduce150.0100.0
diff --git a/addons/product/product_view.xml b/addons/product/product_view.xml
index 24976a71533..472a6ca5426 100644
--- a/addons/product/product_view.xml
+++ b/addons/product/product_view.xml
@@ -194,7 +194,7 @@
-
+
diff --git a/addons/product_margin/security/ir.model.access.csv b/addons/product_margin/security/ir.model.access.csv
new file mode 100644
index 00000000000..51d88da9d81
--- /dev/null
+++ b/addons/product_margin/security/ir.model.access.csv
@@ -0,0 +1,2 @@
+"id","name","model_id:id","group_id:id","perm_read","perm_write","perm_create","perm_unlink"
+"access_product_margin","product.margin","model_product_margin",,1,0,0,0
diff --git a/addons/profile_manufacturing/security/ir.model.access.csv b/addons/profile_manufacturing/security/ir.model.access.csv
index dc32d522e81..892aa4bce00 100644
--- a/addons/profile_manufacturing/security/ir.model.access.csv
+++ b/addons/profile_manufacturing/security/ir.model.access.csv
@@ -1,2 +1,2 @@
"id","name","model_id:id","group_id:id","perm_read","perm_write","perm_create","perm_unlink"
-"access_profile_manufacturing_wizard_install","profile manufacturing wizard install","model_profile_manufacturing_config_install_modules_wizard","base.group_system",1,1,1,1
+"access_profile_manufacturing_config_install_modules_wizard_all","profile_manufacturing_config_install_modules_wizard_all","model_profile_manufacturing_config_install_modules_wizard","base.group_system",1,1,1,1
diff --git a/addons/profile_tools/security/ir.model.access.csv b/addons/profile_tools/security/ir.model.access.csv
new file mode 100644
index 00000000000..dbe55929ecc
--- /dev/null
+++ b/addons/profile_tools/security/ir.model.access.csv
@@ -0,0 +1,2 @@
+"id","name","model_id:id","group_id:id","perm_read","perm_write","perm_create","perm_unlink"
+"access_misc_tools_installer","misc_tools.installer","model_misc_tools_installer",,1,1,1,1
diff --git a/addons/project/project.py b/addons/project/project.py
index f96740219e5..a6c703657d0 100644
--- a/addons/project/project.py
+++ b/addons/project/project.py
@@ -250,7 +250,8 @@ project()
class task(osv.osv):
_name = "project.task"
- _description = "Tasks"
+ _description = "Task"
+ _log_create = True
_date_name = "date_start"
def _str_get(self, task, level=0, border='***', context={}):
diff --git a/addons/project/project_view.xml b/addons/project/project_view.xml
index 005e76e44ab..b3810420dc7 100644
--- a/addons/project/project_view.xml
+++ b/addons/project/project_view.xml
@@ -415,7 +415,7 @@
-
+
@@ -629,7 +629,7 @@
formtree,form
- {"search_default_project_id":project_id, "search_default_my_msg":1, "search_default_user_id":uid}
+ {"search_default_project_id":project_id, "search_default_user_id":uid}
diff --git a/addons/project/report/project_report_view.xml b/addons/project/report/project_report_view.xml
index 1da8311f363..d6948cc8d86 100644
--- a/addons/project/report/project_report_view.xml
+++ b/addons/project/report/project_report_view.xml
@@ -135,8 +135,7 @@
formtree,graph
- {'search_default_month':1,'search_default_User':1,'search_default_project_id':project_id,'search_default_user_id':uid,'group_by_no_leaf':1,'group_by':[]}
-
+ {'search_default_month':1,'search_default_User':1,'search_default_user_id':uid,'group_by_no_leaf':1,'group_by':[]}
diff --git a/addons/project/security/ir.model.access.csv b/addons/project/security/ir.model.access.csv
index f31c6f0401f..0cbe980f2e6 100644
--- a/addons/project/security/ir.model.access.csv
+++ b/addons/project/security/ir.model.access.csv
@@ -17,3 +17,4 @@
"access_project_vs_remaining_hours","project.vs.remaining.hours","model_project_vs_remaining_hours","project.group_project_user",1,1,1,1
"access_task_by_days_vs_planned_hours","task.by.days.vs.planned.hour","model_task_by_days_vs_planned_hours","project.group_project_user",1,1,1,1
"access_task_by_days","task.by.days","model_task_by_days","project.group_project_user",1,1,1,1
+"access_close_task","close.task","model_close_task","project.group_project_manager",1,1,1,1
diff --git a/addons/project_gtd/project_gtd.py b/addons/project_gtd/project_gtd.py
index d45576cabb1..059c19e0f40 100644
--- a/addons/project_gtd/project_gtd.py
+++ b/addons/project_gtd/project_gtd.py
@@ -39,7 +39,7 @@ except ImportError:
class project_gtd_context(osv.osv):
_name = "project.gtd.context"
- _description = "Contexts"
+ _description = "Context"
_columns = {
'name': fields.char('Context', size=64, required=True, select=1),
'sequence': fields.integer('Sequence', help="Gives the sequence order when displaying a list of contexts."),
diff --git a/addons/project_issue/project_issue_view.xml b/addons/project_issue/project_issue_view.xml
index 40366bc26bd..210ad4ee737 100644
--- a/addons/project_issue/project_issue_view.xml
+++ b/addons/project_issue/project_issue_view.xml
@@ -188,17 +188,12 @@
-
+
-
-
-
+
@@ -292,12 +287,8 @@
-
-
-
+
+
diff --git a/addons/project_issue/report/project_issue_report_view.xml b/addons/project_issue/report/project_issue_report_view.xml
index a9f8f016dec..5729698392f 100644
--- a/addons/project_issue/report/project_issue_report_view.xml
+++ b/addons/project_issue/report/project_issue_report_view.xml
@@ -93,10 +93,7 @@
domain="[('section_id.user_id.company_id','=',uid)]"
help="My company"/>
-
-
-
-
+
@@ -182,7 +179,7 @@
project.issue.reportformgraph,tree
- {"search_default_This Month":1,"search_default_User":1,'group_by_no_leaf':1,'group_by':[]}
+ {"search_default_This Month":1,"search_default_User":1,"search_default_user_id":uid,'group_by_no_leaf':1,'group_by':[]}
@@ -206,4 +203,4 @@
-
\ No newline at end of file
+
diff --git a/addons/project_long_term/project_long_term.py b/addons/project_long_term/project_long_term.py
index a925aeeb7aa..ebcc62b7bc3 100644
--- a/addons/project_long_term/project_long_term.py
+++ b/addons/project_long_term/project_long_term.py
@@ -244,7 +244,6 @@ project_resource_allocation()
class project(osv.osv):
_inherit = "project.project"
- _description = "Project"
_columns = {
'phase_ids': fields.one2many('project.phase', 'project_id', "Project Phases"),
'resource_calendar_id': fields.many2one('resource.calendar', 'Working Time', help="Timetable working hours to adjust the gantt diagram report"),
@@ -254,7 +253,6 @@ project()
class task(osv.osv):
_inherit = "project.task"
- _description = "Task"
_columns = {
'phase_id': fields.many2one('project.phase', 'Project Phase'),
'occupation_rate': fields.float('Occupation Rate', help='The occupation rate fields indicates how much of his time a user is working on a task. A 100% occupation rate means the user works full time on the tasks. The ending date of a task is computed like this: Starting Date + Duration / Occupation Rate.'),
@@ -368,4 +366,4 @@ class task(osv.osv):
return super(task, self).write(cr, uid, ids, vals, context=context)
task()
-# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
\ No newline at end of file
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
diff --git a/addons/project_messages/security/ir.model.access.csv b/addons/project_messages/security/ir.model.access.csv
new file mode 100644
index 00000000000..96782d5fc82
--- /dev/null
+++ b/addons/project_messages/security/ir.model.access.csv
@@ -0,0 +1,2 @@
+"id","name","model_id:id","group_id:id","perm_read","perm_write","perm_create","perm_unlink"
+"access_project_messages","project.messages","model_project_messages",,1,1,1,1
diff --git a/addons/project_mrp/__openerp__.py b/addons/project_mrp/__openerp__.py
index 484b9a2e4f1..e94f43b3ad2 100644
--- a/addons/project_mrp/__openerp__.py
+++ b/addons/project_mrp/__openerp__.py
@@ -32,7 +32,7 @@ When installed, this module will automatically create a new task
for each procurement order line, when the corresponding product
meets the following characteristics:
* Type = Service
- * Procurement method (Order fulfillment) = MTO (make to order)
+ * Procurement method (Order fulfilment) = MTO (make to order)
* Supply/Procurement method = Produce
The new task is created outside of any existing project, but
diff --git a/addons/project_mrp/mrp.py b/addons/project_mrp/mrp.py
index 845d32815a9..350d6b006b7 100644
--- a/addons/project_mrp/mrp.py
+++ b/addons/project_mrp/mrp.py
@@ -29,27 +29,53 @@ class mrp_procurement(osv.osv):
def action_produce_assign_service(self, cr, uid, ids, context={}):
for procurement in self.browse(cr, uid, ids):
sline = self.pool.get('sale.order.line')
- sale_ids = sline.search(cr, uid, [('procurement_id','=',procurement.id)], context)
content = ''
+ sale_order = self.pool.get('sale.order')
+ so_ref = procurement.name.split(':')[0]
+ order_ids = sale_order.search(cr, uid, [('name','=',so_ref)], context)
+
+ if order_ids:
+ sale_ids = sale_order.read(cr, uid, order_ids[0],['order_line'],context=context)['order_line']
+ else:
+ so_ref = procurement.origin.split(':')[0]
+ sale_ids = sline.search(cr, uid, [('procurement_id','=',procurement.id)], context)
l = None
project_id = None
+ analytic_account_id = False
+ partner_id = False
+
for line in sline.browse(cr, uid, sale_ids, context=context):
content += (line.notes or '')
l = line
+ partner_id = line.order_id.partner_id.id
if line.order_id.project_id:
+ analytic_account_id = line.order_id.project_id.id
+ partner_id = line.order_id.partner_id.id
content+="\n\n"+line.order_id.project_id.complete_name
+ break
# Creating a project for task.Project is created from Procurement.
- proj_name = tools.ustr(procurement.name)
+ proj_name = tools.ustr(so_ref)
proj_exist_id = self.pool.get('project.project').search(cr, uid, [('name','=',proj_name)], context=context)
if not proj_exist_id:
- project_id = self.pool.get('project.project').create(cr, uid, {'name':proj_name})
+ project_id = self.pool.get('project.project').create(cr, uid, {'name':proj_name,'category_id':analytic_account_id, 'partner_id':partner_id})
else:
project_id = proj_exist_id[0]
self.write(cr, uid, [procurement.id], {'state':'running'})
+
+ name_task = ('','')
+ if procurement.product_id.type == 'service':
+ proc_name = procurement.name
+ if procurement.origin == proc_name:
+ proc_name = procurement.product_id.name
+
+ name_task = (procurement.origin, proc_name or '')
+ else:
+ name_task = (procurement.product_id.name or procurement.origin, procurement.name or '')
+
task_id = self.pool.get('project.task').create(cr, uid, {
- 'name': '%s:%s' %(procurement.product_id.name or procurement.origin, procurement.name or ''),
+ 'name': '%s:%s' % name_task,
'date_deadline': procurement.date_planned,
'planned_hours': procurement.product_qty,
'remaining_hours': procurement.product_qty,
diff --git a/addons/project_planning/project_planning.py b/addons/project_planning/project_planning.py
index bfd2af5566c..09a105cfb53 100644
--- a/addons/project_planning/project_planning.py
+++ b/addons/project_planning/project_planning.py
@@ -184,7 +184,6 @@ report_account_analytic_planning_line()
class account_analytic_account(osv.osv):
_name = 'account.analytic.account'
_inherit = 'account.analytic.account'
- _description = 'Analytic Accounts'
_columns = {
'planning_ids': fields.one2many('report_account_analytic.planning.line', 'account_id', 'Plannings'),
}
diff --git a/addons/project_planning/project_planning_view.xml b/addons/project_planning/project_planning_view.xml
index 6302bb7b440..0ebbcd8e519 100644
--- a/addons/project_planning/project_planning_view.xml
+++ b/addons/project_planning/project_planning_view.xml
@@ -162,12 +162,11 @@
-
-
+
@@ -215,6 +214,7 @@
report_account_analytic.planningformtree,form
+ {"search_default_user_id":uid}
diff --git a/addons/project_retro_planning/project_retro_planning.py b/addons/project_retro_planning/project_retro_planning.py
index 60c8279f16f..3300ac0eebe 100644
--- a/addons/project_retro_planning/project_retro_planning.py
+++ b/addons/project_retro_planning/project_retro_planning.py
@@ -26,7 +26,6 @@ from datetime import datetime
class project_project(osv.osv):
_inherit = 'project.project'
- _description = 'project.project'
def write(self, cr, uid, ids,vals, *args, **kwargs):
if 'date' in vals and vals['date']:
diff --git a/addons/project_timesheet/project_timesheet.py b/addons/project_timesheet/project_timesheet.py
index 3ab09a390cc..f332067b88f 100644
--- a/addons/project_timesheet/project_timesheet.py
+++ b/addons/project_timesheet/project_timesheet.py
@@ -28,7 +28,6 @@ from tools.translate import _
class project_work(osv.osv):
_inherit = "project.task.work"
- _description = "Task Work"
def get_user_related_details(self, cr, uid, user_id):
res = {}
@@ -144,7 +143,6 @@ project_work()
class task(osv.osv):
_inherit = "project.task"
- _description = "Tasks"
def unlink(self, cr, uid, ids, *args, **kwargs):
for task_obj in self.browse(cr, uid, ids, *args, **kwargs):
diff --git a/addons/project_timesheet/report/task_report_view.xml b/addons/project_timesheet/report/task_report_view.xml
index e44e399b292..ce5a86b13a7 100644
--- a/addons/project_timesheet/report/task_report_view.xml
+++ b/addons/project_timesheet/report/task_report_view.xml
@@ -80,9 +80,7 @@
-
-
-
+ formtree,graph[]
+ {"search_default_user_id":uid}
@@ -156,9 +155,7 @@
-
-
-
+
@@ -174,6 +171,7 @@
report.timesheet.task.userformtree
+ {"search_default_user_id":uid}
diff --git a/addons/project_timesheet/security/ir.model.access.csv b/addons/project_timesheet/security/ir.model.access.csv
index 42c3ea0d15c..69075f64e05 100644
--- a/addons/project_timesheet/security/ir.model.access.csv
+++ b/addons/project_timesheet/security/ir.model.access.csv
@@ -1,3 +1,2 @@
"id","name","model_id:id","group_id:id","perm_read","perm_write","perm_create","perm_unlink"
-"access_task_report","report.task.report","model_task_report","project.group_project_manager",1,0,0,0
"access_report_timesheet_task_user","report.timesheet.task.user","model_report_timesheet_task_user","project.group_project_manager",1,0,0,0
diff --git a/addons/purchase/__openerp__.py b/addons/purchase/__openerp__.py
index 909b785fe72..1ba4360028d 100644
--- a/addons/purchase/__openerp__.py
+++ b/addons/purchase/__openerp__.py
@@ -51,7 +51,7 @@
'process/purchase_process.xml',
'report/purchase_report_view.xml',
],
- 'demo_xml': ['purchase_demo.xml'],
+ 'demo_xml': ['purchase_demo.xml','purchase_unit_test.xml'],
'installable': True,
'active': False,
'certificate': '0057234283549',
diff --git a/addons/purchase/purchase.py b/addons/purchase/purchase.py
index a7d69159873..6cc30883909 100644
--- a/addons/purchase/purchase.py
+++ b/addons/purchase/purchase.py
@@ -162,7 +162,7 @@ class purchase_order(osv.osv):
"In this case, it will remove the warehouse link and set the customer location."
),
'warehouse_id': fields.many2one('stock.warehouse', 'Warehouse', states={'posted':[('readonly',True)]}),
- 'location_id': fields.many2one('stock.location', 'Destination', required=True),
+ 'location_id': fields.many2one('stock.location', 'Destination', required=True, domain=[('usage','<>','view')]),
'pricelist_id':fields.many2one('product.pricelist', 'Pricelist', required=True, states={'confirmed':[('readonly',True)], 'approved':[('readonly',True)],'done':[('readonly',True)]}, help="The pricelist sets the currency used for this purchase order. It also computes the supplier price for the selected products/quantities."),
'state': fields.selection([('draft', 'Request for Quotation'), ('wait', 'Waiting'), ('confirmed', 'Waiting Supplier Ack'), ('approved', 'Approved'),('except_picking', 'Shipping Exception'), ('except_invoice', 'Invoice Exception'), ('done', 'Done'), ('cancel', 'Cancelled')], 'State', readonly=True, help="The state of the purchase order or the quotation request. A quotation is a purchase order in a 'Draft' state. Then the order has to be confirmed by the user, the state switch to 'Confirmed'. Then the supplier must confirm the order to change the state to 'Approved'. When the purchase order is paid and received, the state becomes 'Done'. If a cancel action occurs in the invoice or in the reception of goods, the state becomes in exception.", select=True),
'order_line': fields.one2many('purchase.order.line', 'order_id', 'Order Lines', states={'approved':[('readonly',True)],'done':[('readonly',True)]}),
@@ -210,7 +210,8 @@ class purchase_order(osv.osv):
'company_id': lambda self,cr,uid,c: self.pool.get('res.company')._company_default_get(cr, uid, 'purchase.order', context=c),
}
_name = "purchase.order"
- _description = "Purchase order"
+ _description = "Purchase Order"
+ _log_create = True
_order = "name desc"
def unlink(self, cr, uid, ids, context=None):
@@ -414,6 +415,7 @@ class purchase_order(osv.osv):
'purchase_id': order.id,
'company_id': order.company_id.id,
})
+ todo_moves = []
for order_line in order.order_line:
if not order_line.product_id:
continue
@@ -437,8 +439,9 @@ class purchase_order(osv.osv):
})
if order_line.move_dest_id:
self.pool.get('stock.move').write(cr, uid, [order_line.move_dest_id.id], {'location_id':order.location_id.id})
- self.pool.get('stock.move').action_confirm(cr, uid, [move])
- self.pool.get('stock.move').force_assign(cr,uid, [move])
+ todo_moves.append(move)
+ self.pool.get('stock.move').action_confirm(cr, uid, todo_moves)
+ self.pool.get('stock.move').force_assign(cr, uid, todo_moves)
wf_service = netsvc.LocalService("workflow")
wf_service.trg_validate(uid, 'stock.picking', picking_id, 'button_confirm', cr)
return picking_id
@@ -516,6 +519,7 @@ class purchase_order(osv.osv):
'state': 'draft',
'order_line': {},
'notes': '%s' % (porder.notes or '',),
+ 'fiscal_position': porder.fiscal_position and porder.fiscal_position.id or False,
})
else:
#order_infos['name'] += ', %s' % porder.name
@@ -608,7 +612,7 @@ class purchase_order_line(osv.osv):
}
_table = 'purchase_order_line'
_name = 'purchase.order.line'
- _description = 'Purchase Order lines'
+ _description = 'Purchase Order Line'
def copy_data(self, cr, uid, id, default=None,context={}):
if not default:
default = {}
diff --git a/addons/purchase/purchase_unit_test.xml b/addons/purchase/purchase_unit_test.xml
index 890062a66b9..00678589999 100644
--- a/addons/purchase/purchase_unit_test.xml
+++ b/addons/purchase/purchase_unit_test.xml
@@ -8,7 +8,7 @@
-
+
@@ -63,10 +63,10 @@
-
+
-
+
diff --git a/addons/purchase/purchase_view.xml b/addons/purchase/purchase_view.xml
index 555d1fb085c..3386b2e0715 100644
--- a/addons/purchase/purchase_view.xml
+++ b/addons/purchase/purchase_view.xml
@@ -160,9 +160,7 @@
-
-
-
+
@@ -200,8 +198,9 @@
ir.actions.act_windowpurchase.orderform
- {'search_default_draft': 1}
+ {'search_default_draft': 1,'search_create_uid':uid}tree,form,graph,calendar
+
@@ -211,7 +210,8 @@
ir.actions.act_windowpurchase.ordertree,form,graph,calendar
- {'search_default_approved': 1}
+ {'search_default_approved': 1,'search_create_uid':uid}
+
@@ -323,11 +323,11 @@
-
-
-
+
mrp.procurement.form.inheritmrp.procurement
diff --git a/addons/purchase/report/purchase_report_view.xml b/addons/purchase/report/purchase_report_view.xml
index 93918160bd1..6f923c0440e 100644
--- a/addons/purchase/report/purchase_report_view.xml
+++ b/addons/purchase/report/purchase_report_view.xml
@@ -72,10 +72,6 @@
-
-
-
-
+
@@ -133,6 +131,7 @@
purchase.requisitionformtree,form
+ {"search_default_user_id":uid}
diff --git a/addons/resource/resource_view.xml b/addons/resource/resource_view.xml
index 6c6349cddae..68cd5ccbe9b 100644
--- a/addons/resource/resource_view.xml
+++ b/addons/resource/resource_view.xml
@@ -12,9 +12,7 @@
-
-
-
+
@@ -58,7 +56,7 @@
-
+
@@ -191,6 +189,7 @@
Resourcesresource.resourcetree,form
+ {"search_default_user_id":uid}
diff --git a/addons/sale/report/order.rml b/addons/sale/report/order.rml
index 1c205b6c256..1b1256cee19 100644
--- a/addons/sale/report/order.rml
+++ b/addons/sale/report/order.rml
@@ -134,7 +134,7 @@
Shipping address :
- [[ o.partner_id.name ]] [[ o.partner_id.title or '' ]]
+ [[ o.partner_id.title or '' ]] [[ o.partner_id.name ]][[ o.partner_shipping_id.title or '' ]] [[ o.partner_shipping_id.name ]][[ o.partner_shipping_id.street ]][[ o.partner_shipping_id.street2 or '' ]]
@@ -144,10 +144,10 @@
Invoice address :
- [[ o.partner_invoice_id.title or '' ]] [[ o.partner_invoice_id.name or '' ]]
+ [[ o.partner_invoice_id.title or '' ]] [[ o.partner_invoice_id.name or '' ]][[ o.partner_invoice_id.street ]] [[ o.partner_invoice_id.street2 and (', %s' % o.partner_invoice_id.street2 or '') ]][[ o.partner_invoice_id.zip or '' ]] [[ o.partner_invoice_id.city or '' ]]
- [[ o.partner_invoice_id.state_id and o.partner_invoice_id.state_id.name or '' ]] [[ o.partner_invoice_id.country_id and o.partner_invoice_id.country_id.name or '' ]]
+ [[ o.partner_invoice_id.state_id and o.partner_invoice_id.state_id.name or '' ]][[ o.partner_invoice_id.country_id and o.partner_invoice_id.country_id.name or '' ]]
@@ -155,7 +155,7 @@
- [[ o.partner_id.name ]] [[ o.partner_id.title or '' ]]
+ [[ o.partner_id.title or '' ]] [[ o.partner_id.name ]][[ o.partner_order_id.title or '' ]] [[ o.partner_order_id.name ]][[ o.partner_order_id.street ]][[ o.partner_order_id.street2 or '' ]]
@@ -187,7 +187,8 @@
Your Reference
- [[ o.state=='draft' and 'Quotation Date' or 'Date Ordered' ]]
+ [[ o.state=='draft' and removeParentNode('para') ]] Date Ordered
+ [[ o.state <> 'draft' and removeParentNode('para') ]] Quotation Date
[[ line.name ]]
@@ -370,4 +371,4 @@
-
+
\ No newline at end of file
diff --git a/addons/sale/report/sale_report_view.xml b/addons/sale/report/sale_report_view.xml
index 72707f6e01d..fdfb1b5d2c9 100644
--- a/addons/sale/report/sale_report_view.xml
+++ b/addons/sale/report/sale_report_view.xml
@@ -72,10 +72,6 @@
- formtree,graph
- {'search_default_month':1,'search_default_User':1,'group_by_no_leaf':1,'group_by':[]}
+ {'search_default_month':1,'search_default_User':1,'search_default_user_id':uid,'group_by_no_leaf':1,'group_by':[]}
diff --git a/addons/sale/sale.py b/addons/sale/sale.py
index 718f29f12d7..272ee0ecd70 100644
--- a/addons/sale/sale.py
+++ b/addons/sale/sale.py
@@ -52,6 +52,7 @@ def _incoterm_get(self, cr, uid, context=None):
class sale_order(osv.osv):
_name = "sale.order"
+ _log_create = True
_description = "Sale Order"
def copy(self, cr, uid, id, default=None, context=None):
@@ -106,17 +107,19 @@ class sale_order(osv.osv):
for id in ids:
res[id] = [0.0, 0.0]
cr.execute('''SELECT
- p.sale_id,sum(m.product_qty), m.state
+ p.sale_id,sum(m.product_qty), mp.state as mp_state
FROM
stock_move m
LEFT JOIN
stock_picking p on (p.id=m.picking_id)
+ LEFT JOIN
+ mrp_procurement mp on (mp.move_id=m.id)
WHERE
- p.sale_id = ANY(%s) GROUP BY m.state, p.sale_id''',(ids,))
- for oid, nbr, state in cr.fetchall():
- if state == 'cancel':
+ p.sale_id = ANY(%s) GROUP BY mp.state, p.sale_id''',(ids,))
+ for oid, nbr, mp_state in cr.fetchall():
+ if mp_state == 'cancel':
continue
- if state == 'done':
+ if mp_state == 'done':
res[oid][0] += nbr or 0.0
res[oid][1] += nbr or 0.0
else:
@@ -434,7 +437,7 @@ class sale_order(osv.osv):
'currency_id': order.pricelist_id.currency_id.id,
'comment': order.note,
'payment_term': pay_term,
- 'fiscal_position': order.partner_id.property_account_position.id,
+ 'fiscal_position': order.fiscal_position.id or order.partner_id.property_account_position.id,
'date_invoice' : context.get('date_invoice',False),
'company_id' : order.company_id.id,
}
@@ -508,18 +511,14 @@ class sale_order(osv.osv):
def action_invoice_end(self, cr, uid, ids, context=None):
if context is None:
context = {}
+
for order in self.browse(cr, uid, ids, context=context):
- val = {'invoiced': True}
- if order.state == 'invoice_except':
- val['state'] = 'progress'
-
for line in order.order_line:
- towrite = []
if line.state == 'exception':
- towrite.append(line.id)
- if towrite:
- self.pool.get('sale.order.line').write(cr, uid, towrite, {'state': 'confirmed'}, context=context)
- self.write(cr, uid, [order.id], val)
+ self.pool.get('sale.order.line').write(cr, uid, [line.id], {'state': 'confirmed'}, context=context)
+
+ if order.state == 'invoice_except':
+ self.write(cr, uid, [order.id], {'state' : 'progress'}, context=context)
return True
@@ -553,16 +552,10 @@ class sale_order(osv.osv):
return True
def action_wait(self, cr, uid, ids, *args):
- event_p = self.pool.get('res.partner.event.type').check(cr, uid, 'sale_open')
- event_obj = self.pool.get('res.partner.event')
+ for (id,name) in self.name_get(cr, uid, ids):
+ message = _('Quotation ') + " '" + name + "' "+ _("converted to sale order.")
+ self.log(cr, uid, id, message)
for o in self.browse(cr, uid, ids):
- if event_p:
- event_obj.create(cr, uid, {'name': 'Sale Order: '+ o.name,\
- 'partner_id': o.partner_id.id,\
- 'date': time.strftime('%Y-%m-%d %H:%M:%S'),\
- 'user_id': (o.user_id and o.user_id.id) or uid,\
- 'partner_type': 'customer', 'probability': 1.0,\
- 'planned_revenue': o.amount_untaxed})
if (o.order_policy == 'manual'):
self.write(cr, uid, [o.id], {'state': 'manual', 'date_confirm': time.strftime('%Y-%m-%d')})
else:
@@ -813,7 +806,7 @@ class sale_order_line(osv.osv):
return res
_name = 'sale.order.line'
- _description = 'Sale Order line'
+ _description = 'Sale Order Line'
_columns = {
'order_id': fields.many2one('sale.order', 'Order Reference', required=True, ondelete='cascade', select=True, readonly=True, states={'draft':[('readonly',False)]}),
'name': fields.char('Description', size=256, required=True, select=True, readonly=True, states={'draft':[('readonly',False)]}),
@@ -1072,7 +1065,7 @@ class sale_order_line(osv.osv):
'product_uos':
[('category_id', '=', uos_category_id)]}
- elif uos: # only happens if uom is False
+ elif uos and not uom: # only happens if uom is False
result['product_uom'] = product_obj.uom_id and product_obj.uom_id.id
result['product_uom_qty'] = qty_uos / product_obj.uos_coeff
result['th_weight'] = result['product_uom_qty'] * product_obj.weight
@@ -1117,7 +1110,7 @@ class sale_order_line(osv.osv):
uom=False, qty_uos=0, uos=False, name='', partner_id=False,
lang=False, update_tax=True, date_order=False):
res = self.product_id_change(cursor, user, ids, pricelist, product,
- qty=0, uom=uom, qty_uos=qty_uos, uos=uos, name=name,
+ qty=qty, uom=uom, qty_uos=qty_uos, uos=uos, name=name,
partner_id=partner_id, lang=lang, update_tax=update_tax,
date_order=date_order)
if 'product_uom' in res['value']:
diff --git a/addons/sale/sale_view.xml b/addons/sale/sale_view.xml
index 894ff6b2e6c..8ddc39406e9 100644
--- a/addons/sale/sale_view.xml
+++ b/addons/sale/sale_view.xml
@@ -110,7 +110,7 @@
-
+
@@ -130,7 +130,8 @@
on_change="product_id_change(parent.pricelist_id,product_id,product_uom_qty,product_uom,product_uos_qty,product_uos,name,parent.partner_id, 'lang' in context and context['lang'], False, parent.date_order, product_packaging, parent.fiscal_position, True)"
select="1"/>
+ on_change="product_uom_change(parent.pricelist_id,product_id,product_uom_qty,product_uom,product_uos_qty,product_uos,name,parent.partner_id, 'lang' in context and context['lang'], False, parent.date_order)"
+ widget="selection"/>
-
-
@@ -191,7 +190,7 @@
-
+
@@ -238,7 +237,7 @@
-
+
@@ -258,16 +257,15 @@
-
-
-
+
-
-
+
+
+
@@ -279,6 +277,7 @@
sale.orderformtree,form,calendar,graph
+ {"search_default_user_id":uid}
diff --git a/addons/sale/stock.py b/addons/sale/stock.py
index e2f632bf711..48c00d8afba 100644
--- a/addons/sale/stock.py
+++ b/addons/sale/stock.py
@@ -63,11 +63,8 @@ class stock_picking(osv.osv):
user, picking)
def _get_comment_invoice(self, cursor, user, picking):
- if picking.sale_id and picking.sale_id.note:
- if picking.note:
- return picking.note + '\n' + picking.sale_id.note
- else:
- return picking.sale_id.note
+ if picking.note or (picking.sale_id and picking.sale_id.note):
+ return picking.note or picking.sale_id.note
return super(stock_picking, self)._get_comment_invoice(cursor, user,
picking)
@@ -139,6 +136,10 @@ class stock_picking(osv.osv):
sale_lines = picking.sale_id.order_line
invoice_created = invoices[result[picking.id]]
+ for inv in invoice_obj.browse(cursor, user, [invoice_created.id], context=context):
+ if not inv.fiscal_position:
+ invoice_obj.write(cursor, user, [inv.id], {'fiscal_position': picking.sale_id.fiscal_position.id}, context=context)
+
if picking.sale_id.client_order_ref:
inv_name = picking.sale_id.client_order_ref + " : " + invoice_created.name
invoice_obj.write(cursor, user, [invoice_created.id], {'name': inv_name}, context=context)
@@ -188,6 +189,19 @@ class stock_picking(osv.osv):
})
return result
+
+ def action_cancel(self, cr, uid, ids, context={}):
+ res = super(stock_picking, self).action_cancel(cr, uid, ids, context=context)
+ for pick in self.browse(cr, uid, ids, context):
+ call_ship_end = True
+ if pick.sale_id:
+ for picks in pick.sale_id.picking_ids:
+ if picks.state not in ('done','cancel'):
+ call_ship_end = False
+ break
+ if call_ship_end:
+ self.pool.get('sale.order').action_ship_end(cr, uid, [pick.sale_id.id], context)
+ return res
stock_picking()
diff --git a/addons/sale/wizard/sale_line_invoice.py b/addons/sale/wizard/sale_line_invoice.py
index 4bf3074db54..05f7c4c8e3f 100644
--- a/addons/sale/wizard/sale_line_invoice.py
+++ b/addons/sale/wizard/sale_line_invoice.py
@@ -20,11 +20,7 @@
##############################################################################
from osv import fields, osv
-from service import web_services
-import wizard
-import netsvc
-import ir
-import pooler
+from tools.translate import _
class sale_order_line_make_invoice(osv.osv_memory):
_name = "sale.order.line.make.invoice"
@@ -82,7 +78,7 @@ class sale_order_line_make_invoice(osv.osv_memory):
'currency_id' : order.pricelist_id.currency_id.id,
'comment': order.note,
'payment_term': pay_term,
- 'fiscal_position': order.partner_id.property_account_position.id
+ 'fiscal_position': order.fiscal_position.id or order.partner_id.property_account_position.id,
}
inv_id = self.pool.get('account.invoice').create(cr, uid, inv)
return inv_id
@@ -110,6 +106,8 @@ class sale_order_line_make_invoice(osv.osv_memory):
wf_service.trg_validate(uid, 'sale.order', line.order_id.id, 'all_lines', cr)
sales_order_obj.write(cr,uid,[line.order_id.id],{'state' : 'progress'})
+ if not invoices:
+ raise osv.except_osv(_('Warning'),_('Invoice cannot be created for this Sale Order Line due to one of the following reasons:\n1.The state of this sale order line is either "draft" or "cancel"!\n2.The Sale Order Line is Invoiced!'))
for result in invoices.values():
order = result[0][0].order_id
il = map(lambda x: x[1], result)
diff --git a/addons/sale/wizard/sale_make_invoice_advance.py b/addons/sale/wizard/sale_make_invoice_advance.py
index 6c9ca17b836..e1b6492e7df 100644
--- a/addons/sale/wizard/sale_make_invoice_advance.py
+++ b/addons/sale/wizard/sale_make_invoice_advance.py
@@ -22,9 +22,6 @@ from osv import fields, osv
from service import web_services
from tools.translate import _
import ir
-import netsvc
-import pooler
-import wizard
class sale_advance_payment_inv(osv.osv_memory):
@@ -95,7 +92,7 @@ class sale_advance_payment_inv(osv.osv_memory):
'currency_id' :sale.pricelist_id.currency_id.id,
'comment': '',
'payment_term':sale.payment_term.id,
- 'fiscal_position': sale.partner_id.property_account_position.id
+ 'fiscal_position': sale.fiscal_position.id or sale.partner_id.property_account_position.id
}
inv_id = inv_obj.create(cr, uid, inv)
diff --git a/addons/sale_crm/sale_crm.py b/addons/sale_crm/sale_crm.py
index 613d8af7b7a..14c1a07e336 100644
--- a/addons/sale_crm/sale_crm.py
+++ b/addons/sale_crm/sale_crm.py
@@ -23,7 +23,6 @@ from osv import osv,fields
class sale_order(osv.osv):
_inherit = 'sale.order'
- _description = 'Sale orders'
_columns = {
'section_id': fields.many2one('crm.case.section', 'Sales Team'),
}
diff --git a/addons/sale_crm/sale_crm_view.xml b/addons/sale_crm/sale_crm_view.xml
index 7660dcc5cd2..a45536772da 100644
--- a/addons/sale_crm/sale_crm_view.xml
+++ b/addons/sale_crm/sale_crm_view.xml
@@ -34,7 +34,7 @@
-
+ [[line.product_id.code ]] [[ line.product_id and line.product_id.name or '']]
- [[ (line.prodlot_id and (line.prodlot_id.name + '/' + line.prodlot_id.ref)) or ' ' ]]
+ [[ (line.prodlot_id and (line.prodlot_id.name + (line.prodlot_id.ref and ('/' + line.prodlot_id.ref) or ''))) or ' ' ]]
[[ formatLang(line.product_qty) ]]
diff --git a/addons/sale_journal/picking_journal_view.xml b/addons/sale_journal/picking_journal_view.xml
index 7d2d657b7de..ae4edd4e49b 100644
--- a/addons/sale_journal/picking_journal_view.xml
+++ b/addons/sale_journal/picking_journal_view.xml
@@ -57,7 +57,6 @@
-
@@ -73,6 +72,7 @@
sale_journal.picking.journalformtree,form
+ {"search_default_user_id":uid}
diff --git a/addons/sale_journal/sale_journal.py b/addons/sale_journal/sale_journal.py
index c041a934274..8b636241285 100644
--- a/addons/sale_journal/sale_journal.py
+++ b/addons/sale_journal/sale_journal.py
@@ -25,7 +25,7 @@ import time
class sale_journal_invoice_type(osv.osv):
_name = 'sale_journal.invoice.type'
- _description = 'Invoice Types'
+ _description = 'Invoice Type'
_columns = {
'name': fields.char('Invoice Type', size=64, required=True),
'active': fields.boolean('Active', help="If the active field is set to true, it will allow you to hide the invoice type without removing it."),
diff --git a/addons/sale_journal/sale_journal_view.xml b/addons/sale_journal/sale_journal_view.xml
index 7783f646292..a1989da389f 100644
--- a/addons/sale_journal/sale_journal_view.xml
+++ b/addons/sale_journal/sale_journal_view.xml
@@ -99,7 +99,6 @@
-
@@ -115,6 +114,7 @@
sale_journal.sale.journalformtree,form
+ {"search_default_user_id":uid}
diff --git a/addons/scrum/scrum_view.xml b/addons/scrum/scrum_view.xml
index 379dc66a4fd..394ea4c4219 100644
--- a/addons/scrum/scrum_view.xml
+++ b/addons/scrum/scrum_view.xml
@@ -44,11 +44,9 @@
-
+
-
-
@@ -149,13 +147,7 @@
domain="[('sprint_id','=',False)]"
help="Backlogs Not Assigned To Sprints."/>
-
-
-
+
@@ -173,6 +165,7 @@
Product Backlogsscrum.product.backlogform
+ {"search_default_user_id":uid}
-
+
Create Stock Planning Lines
@@ -305,7 +304,7 @@
@@ -322,14 +321,14 @@
-
-
@@ -353,7 +352,7 @@
-
+
@@ -362,13 +361,13 @@
-
+
-
+
-
-
+
+
@@ -424,9 +423,9 @@
-
+
diff --git a/addons/subscription/subscription.py b/addons/subscription/subscription.py
index e9899156326..b05bf099d09 100644
--- a/addons/subscription/subscription.py
+++ b/addons/subscription/subscription.py
@@ -29,7 +29,7 @@ from tools.translate import _
class subscription_document(osv.osv):
_name = "subscription.document"
- _description = "Subscription document"
+ _description = "Subscription Document"
_columns = {
'name': fields.char('Name', size=60, required=True),
'active': fields.boolean('Active', help="If the active field is set to true, it will allow you to hide the subscription document without removing it."),
@@ -49,7 +49,7 @@ subscription_document()
class subscription_document_fields(osv.osv):
_name = "subscription.document.fields"
- _description = "Subscription document fields"
+ _description = "Subscription Document Fields"
_rec_name = 'field'
_columns = {
'field': fields.many2one('ir.model.fields', 'Field', domain="[('model_id', '=', parent.model)]", required=True),
diff --git a/addons/warning/warning.py b/addons/warning/warning.py
index 466283702c6..0aec93f1c90 100644
--- a/addons/warning/warning.py
+++ b/addons/warning/warning.py
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
##############################################################################
-#
+#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL ().
#
@@ -15,7 +15,7 @@
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
-# along with this program. If not, see .
+# along with this program. If not, see .
#
##############################################################################
@@ -49,7 +49,7 @@ class res_partner(osv.osv):
'picking_warn' : lambda *a: 'no-message',
'invoice_warn' : lambda *a: 'no-message',
}
-
+
res_partner()
@@ -73,11 +73,11 @@ class sale_order(osv.osv):
}
result = super(sale_order, self).onchange_partner_id(cr, uid, ids, part)
-
+
if result.get('warning',False):
warning['title'] = title and title +' & '+ result['warning']['title'] or result['warning']['title']
warning['message'] = message and message + ' ' + result['warning']['message'] or result['warning']['message']
-
+
return {'value': result.get('value',{}), 'warning':warning}
sale_order()
@@ -101,21 +101,20 @@ class purchase_order(osv.osv):
'message': message
}
result = super(purchase_order, self).onchange_partner_id(cr, uid, ids, part)
-
+
if result.get('warning',False):
warning['title'] = title and title +' & '+ result['warning']['title'] or result['warning']['title']
warning['message'] = message and message + ' ' + result['warning']['message'] or result['warning']['message']
-
+
return {'value': result.get('value',{}), 'warning':warning}
-
+
purchase_order()
class account_invoice(osv.osv):
_inherit = 'account.invoice'
def onchange_partner_id(self, cr, uid, ids, type, partner_id,
- date_invoice=False, payment_term=False, partner_bank_id=False):
-
+ date_invoice=False, payment_term=False, partner_bank=False, company_id=False):
if not partner_id:
return {'value': {
'address_contact_id': False ,
@@ -131,7 +130,7 @@ class account_invoice(osv.osv):
if partner.invoice_warn != 'no-message':
if partner.invoice_warn == 'block':
raise osv.except_osv(_('Alert for %s !') % (partner.name), partner.invoice_warn_msg)
-
+
title = _("Warning for %s") % partner.name
message = partner.invoice_warn_msg
warning = {
@@ -139,19 +138,19 @@ class account_invoice(osv.osv):
'message': message
}
result = super(account_invoice, self).onchange_partner_id(cr, uid, ids, type, partner_id,
- date_invoice=False, payment_term=False, partner_bank_id=False)
-
+ date_invoice=False, payment_term=False, partner_bank=False)
+
if result.get('warning',False):
warning['title'] = title and title +' & '+ result['warning']['title'] or result['warning']['title']
warning['message'] = message and message + ' ' + result['warning']['message'] or result['warning']['message']
-
+
return {'value': result.get('value',{}), 'warning':warning}
-
+
account_invoice()
class stock_picking(osv.osv):
_inherit = 'stock.picking'
-
+
def onchange_partner_in(self, cr, uid, context, partner_id=None):
if not partner_id:
return {}
@@ -172,9 +171,9 @@ class stock_picking(osv.osv):
if result.get('warning',False):
warning['title'] = title and title +' & '+ result['warning']['title'] or result['warning']['title']
warning['message'] = message and message + ' ' + result['warning']['message'] or result['warning']['message']
-
+
return {'value': result.get('value',{}), 'warning':warning}
-
+
stock_picking()
class product_product(osv.osv):
@@ -185,12 +184,12 @@ class product_product(osv.osv):
'purchase_line_warn' : fields.selection(WARNING_MESSAGE,'Purchase Order Line', help=WARNING_HELP),
'purchase_line_warn_msg' : fields.text('Message for Purchase Order Line'),
}
-
+
_defaults = {
'sale_line_warn' : lambda *a: 'no-message',
'purchase_line_warn' : lambda *a: 'no-message',
}
-
+
product_product()
class sale_order_line(osv.osv):
@@ -204,11 +203,11 @@ class sale_order_line(osv.osv):
return {'value': {'th_weight' : 0, 'product_packaging': False,
'product_uos_qty': qty}, 'domain': {'product_uom': [],
'product_uos': []}}
- product_obj = self.pool.get('product.product')
+ product_obj = self.pool.get('product.product')
product_info = product_obj.browse(cr, uid, product)
title = False
message = False
-
+
if product_info.sale_line_warn != 'no-message':
if product_info.sale_line_warn == 'block':
raise osv.except_osv(_('Alert for %s !') % (product_info.name), product_info.sale_line_warn_msg)
@@ -216,7 +215,7 @@ class sale_order_line(osv.osv):
message = product_info.sale_line_warn_msg
warning['title'] = title
warning['message'] = message
-
+
result = super(sale_order_line, self).product_id_change( cr, uid, ids, pricelist, product, qty,
uom, qty_uos, uos, name, partner_id,
lang, update_tax, date_order, packaging, fiscal_position, flag)
@@ -227,9 +226,9 @@ class sale_order_line(osv.osv):
if result.get('warning',False):
warning['title'] = title and title +' & '+result['warning']['title'] or result['warning']['title']
warning['message'] = message and message +'\n\n'+result['warning']['message'] or result['warning']['message']
-
+
return {'value': result.get('value',{}), 'warning':warning}
-
+
sale_order_line()
class purchase_order_line(osv.osv):
@@ -239,11 +238,11 @@ class purchase_order_line(osv.osv):
warning = {}
if not product:
return {'value': {'price_unit': 0.0, 'name':'','notes':'', 'product_uom' : False}, 'domain':{'product_uom':[]}}
- product_obj = self.pool.get('product.product')
+ product_obj = self.pool.get('product.product')
product_info = product_obj.browse(cr, uid, product)
title = False
message = False
-
+
if product_info.purchase_line_warn != 'no-message':
if product_info.purchase_line_warn == 'block':
raise osv.except_osv(_('Alert for %s !') % (product_info.name), product_info.purchase_line_warn_msg)
@@ -251,16 +250,16 @@ class purchase_order_line(osv.osv):
message = product_info.purchase_line_warn_msg
warning['title'] = title
warning['message'] = message
-
+
result = super(purchase_order_line, self).product_id_change(cr, uid, ids, pricelist, product, qty, uom,
partner_id, date_order, fiscal_position)
if result.get('warning',False):
warning['title'] = title and title +' & '+result['warning']['title'] or result['warning']['title']
warning['message'] = message and message +'\n\n'+result['warning']['message'] or result['warning']['message']
-
+
return {'value': result.get('value',{}), 'warning':warning}
-
+
purchase_order_line()
diff --git a/addons/wiki/wiki_view.xml b/addons/wiki/wiki_view.xml
index 4675cea75f9..93f0df72361 100644
--- a/addons/wiki/wiki_view.xml
+++ b/addons/wiki/wiki_view.xml
@@ -155,12 +155,12 @@
-
+
@@ -174,7 +174,7 @@
formtree,form
- {'section':'1'}
+ {'section':'1','search_default_create_uid':uid}