diff --git a/addons/account/__openerp__.py b/addons/account/__openerp__.py
index ca5caee014d..1ff58367b47 100644
--- a/addons/account/__openerp__.py
+++ b/addons/account/__openerp__.py
@@ -68,6 +68,10 @@ module named account_voucherss
'wizard/account_validate_move_view.xml',
'wizard/account_statement_from_invoice_view.xml',
'wizard/account_pay_invoice_view.xml',
+ 'wizard/account_unreconcile_view.xml',
+ 'wizard/account_invoice_state_view.xml',
+ 'wizard/account_use_model_view.xml',
+ 'wizard/account_partner_balance_report_view.xml',
'project/wizard/project_account_analytic_line_view.xml',
'account_view.xml',
'account_end_fy.xml',
diff --git a/addons/account/account_view.xml b/addons/account/account_view.xml
index c0bd50eb7bc..a386901a083 100644
--- a/addons/account/account_view.xml
+++ b/addons/account/account_view.xml
@@ -1176,7 +1176,7 @@
-
+
diff --git a/addons/account/account_wizard.xml b/addons/account/account_wizard.xml
index 09ae2bafede..e5825f6b2da 100644
--- a/addons/account/account_wizard.xml
+++ b/addons/account/account_wizard.xml
@@ -49,7 +49,7 @@
-
+
-
+
-
-
+
@@ -85,9 +85,9 @@
-
-
-
+
+
+
-
-
+
+
-
+
diff --git a/addons/account/i18n/bg.po b/addons/account/i18n/bg.po
index 21d61219493..91dfbca2279 100644
--- a/addons/account/i18n/bg.po
+++ b/addons/account/i18n/bg.po
@@ -13,7 +13,7 @@ msgstr ""
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
-"X-Launchpad-Export-Date: 2010-04-20 03:33+0000\n"
+"X-Launchpad-Export-Date: 2010-04-21 04:05+0000\n"
"X-Generator: Launchpad (build Unknown)\n"
#. module: account
diff --git a/addons/account/i18n/ca.po b/addons/account/i18n/ca.po
index 5337799482b..9f2c82ec366 100644
--- a/addons/account/i18n/ca.po
+++ b/addons/account/i18n/ca.po
@@ -14,7 +14,7 @@ msgstr ""
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
-"X-Launchpad-Export-Date: 2010-04-20 03:33+0000\n"
+"X-Launchpad-Export-Date: 2010-04-21 04:06+0000\n"
"X-Generator: Launchpad (build Unknown)\n"
#. module: account
diff --git a/addons/account/i18n/de.po b/addons/account/i18n/de.po
index 0ec2f0fc2a3..e978a71d610 100644
--- a/addons/account/i18n/de.po
+++ b/addons/account/i18n/de.po
@@ -13,7 +13,7 @@ msgstr ""
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
-"X-Launchpad-Export-Date: 2010-04-20 03:33+0000\n"
+"X-Launchpad-Export-Date: 2010-04-21 04:06+0000\n"
"X-Generator: Launchpad (build Unknown)\n"
#. module: account
diff --git a/addons/account/i18n/sv.po b/addons/account/i18n/sv.po
index c1c5599e2d3..5959bd7abbe 100644
--- a/addons/account/i18n/sv.po
+++ b/addons/account/i18n/sv.po
@@ -7,13 +7,13 @@ msgstr ""
"Project-Id-Version: OpenERP Server 5.0.0\n"
"Report-Msgid-Bugs-To: support@openerp.com\n"
"POT-Creation-Date: 2009-08-28 16:01+0000\n"
-"PO-Revision-Date: 2010-03-24 14:33+0000\n"
-"Last-Translator: Anders Eriksson (Mobila System) \n"
+"PO-Revision-Date: 2010-04-21 15:12+0000\n"
+"Last-Translator: djn (XCLUDE) \n"
"Language-Team: <> <>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
-"X-Launchpad-Export-Date: 2010-04-17 04:08+0000\n"
+"X-Launchpad-Export-Date: 2010-04-22 03:43+0000\n"
"X-Generator: Launchpad (build Unknown)\n"
#. module: account
@@ -26,12 +26,6 @@ msgstr "Internt namn"
msgid "Account Tax Code"
msgstr "Konto, skattekod"
-#. module: account
-#: model:ir.actions.act_window,name:account.action_invoice_tree9
-#: model:ir.ui.menu,name:account.menu_action_invoice_tree9
-msgid "Unpaid Supplier Invoices"
-msgstr "Obetalda leverantörsfakturor"
-
#. module: account
#: model:ir.ui.menu,name:account.menu_finance_entries
msgid "Entries Encoding"
@@ -1593,7 +1587,7 @@ msgstr "Moms"
#. module: account
#: rml:account.analytic.account.journal:0
msgid "Account n°"
-msgstr ""
+msgstr "Konto Nr"
#. module: account
#: view:account.tax:0
diff --git a/addons/account/invoice.py b/addons/account/invoice.py
index 20eea676611..c66dda115b2 100644
--- a/addons/account/invoice.py
+++ b/addons/account/invoice.py
@@ -324,6 +324,17 @@ class account_invoice(osv.osv):
'user_id': lambda s,cr,u,c: u,
}
+ def create(self, cr, uid, vals, context={}):
+ try:
+ res = super(account_invoice, self).create(cr, uid, vals, context)
+ return res
+ except Exception,e:
+ if '"journal_id" viol' in e.args[0]:
+ raise except_orm(_('Configuration Error!'),
+ _('There is no Accounting Journal of type Sale/Purchase defined!'))
+ else:
+ raise except_orm(_('UnknownError'), str(e))
+
def unlink(self, cr, uid, ids, context=None):
invoices = self.read(cr, uid, ids, ['state'])
unlink_ids = []
diff --git a/addons/account/report/partner_balance.py b/addons/account/report/partner_balance.py
index a5b746a0bde..f296475cb3f 100755
--- a/addons/account/report/partner_balance.py
+++ b/addons/account/report/partner_balance.py
@@ -67,10 +67,10 @@ class partner_balance(report_sxw.rml_parse):
## Get All Period Date
#
# If we have no period we will take all perdio in the FiscalYear.
- if not data['form']['periods'][0][2] :
+ if not data['form']['periods']:
periods_id = self.pool.get('account.period').search(self.cr, self.uid, [('fiscalyear_id','=',data['form']['fiscalyear'])])
else:
- periods_id = data['form']['periods'][0][2]
+ periods_id = data['form']['periods']
date_array = []
for period_id in periods_id:
period_obj = self.pool.get('account.period').browse(self.cr, self.uid, period_id)
@@ -85,35 +85,38 @@ class partner_balance(report_sxw.rml_parse):
self.date_lst.sort()
def transform_both_into_date_array(self,data):
- if not data['form']['periods'][0][2] :
+ final_date_array = []
+ date_start_date = data['form']['date1']
+ date_stop_date = data['form']['date2']
+ if not data['form']['periods']:
periods_id = self.pool.get('account.period').search(self.cr, self.uid, [('fiscalyear_id','=',data['form']['fiscalyear'])])
else:
- periods_id = data['form']['periods'][0][2]
+ periods_id = data['form']['periods']
date_array = []
- for period_id in periods_id:
- period_obj = self.pool.get('account.period').browse(self.cr, self.uid, period_id)
- date_array = date_array + self.date_range(period_obj.date_start,period_obj.date_stop)
+ if periods_id:
+ for period_id in periods_id:
+ period_obj = self.pool.get('account.period').browse(self.cr, self.uid, period_id)
+ date_array = date_array + self.date_range(period_obj.date_start,period_obj.date_stop)
+ period_start_date = date_array[0]
+ period_stop_date = date_array[-1]
- period_start_date = date_array[0]
- date_start_date = data['form']['date1']
- period_stop_date = date_array[-1]
- date_stop_date = data['form']['date2']
+ if period_start_date).
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as
+# published by the Free Software Foundation, either version 3 of the
+# License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# 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 .
+#
+##############################################################################
+from osv import fields, osv
+from tools.translate import _
+import netsvc
+
+class account_invoice_confirm(osv.osv_memory):
+ """
+ This wizard will confirm the all the selected draft invoices
+ """
+
+ _name = "account.invoice.confirm"
+ _description = "Confirm the selected invoices"
+
+ def invoice_confirm(self, cr, uid, ids, context=None):
+ wf_service = netsvc.LocalService('workflow')
+ if context is None:
+ context = {}
+ for id in context['active_ids']:
+ wf_service.trg_validate(uid, 'account.invoice', id, 'invoice_open', cr)
+ return {}
+
+account_invoice_confirm()
+
+class account_invoice_cancel(osv.osv_memory):
+ """
+ This wizard will cancel the all the selected invoices.
+ If in the journal, the option allow cancelling entry is not selected then it will give warning message.
+ """
+
+ _name = "account.invoice.cancel"
+ _description = "Cancel the selected invoices"
+
+ def invoice_cancel(self, cr, uid, ids, context=None):
+ wf_service = netsvc.LocalService('workflow')
+ if context is None:
+ context = {}
+ for id in context['active_ids']:
+ wf_service.trg_validate(uid, 'account.invoice', id, 'invoice_cancel', cr)
+ return {}
+
+account_invoice_cancel()
+
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
\ No newline at end of file
diff --git a/addons/account/wizard/account_invoice_state_view.xml b/addons/account/wizard/account_invoice_state_view.xml
new file mode 100644
index 00000000000..8748edbb688
--- /dev/null
+++ b/addons/account/wizard/account_invoice_state_view.xml
@@ -0,0 +1,73 @@
+
+
+
+
+ account.invoice.confirm.form
+ account.invoice.confirm
+ form
+
+
+
+
+
+
+ Confirm draft invoices
+ account.invoice.confirm
+ form
+ form
+
+ new
+
+
+
+
+
+ Confirm draft invoices
+ client_action_multi
+
+ action
+ account.invoice
+
+
+
+ account.invoice.cancel.form
+ account.invoice.cancel
+ form
+
+
+
+
+
+
+ Cancel selected invoices
+ account.invoice.cancel
+ form
+ form
+
+ new
+
+
+
+
+
+ Cancel selected invoices
+ client_action_multi
+
+ action
+ account.invoice
+
+
+
+
\ No newline at end of file
diff --git a/addons/account/wizard/account_partner_balance_report.py b/addons/account/wizard/account_partner_balance_report.py
new file mode 100644
index 00000000000..b1b283feef6
--- /dev/null
+++ b/addons/account/wizard/account_partner_balance_report.py
@@ -0,0 +1,109 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+# OpenERP, Open Source Management Solution
+# Copyright (C) 2004-2010 Tiny SPRL ().
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as
+# published by the Free Software Foundation, either version 3 of the
+# License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# 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 .
+#
+##############################################################################
+
+import time
+
+from tools.translate import _
+from osv import fields, osv
+
+class account_partner_balance(osv.osv_memory):
+ """
+ This wizard will provide the partner balance report by periods, between any two dates.
+ """
+ _name = 'account.partner.balance'
+ _description = 'Account Partner Balance'
+ _columns = {
+ 'company_id': fields.many2one('res.company', 'Company', required=True),
+ 'state': fields.selection([('bydate','By Date'),
+ ('byperiod','By Period'),
+ ('all','By Date and Period'),
+ ('none','No Filter')
+ ],'Date/Period Filter'),
+ 'fiscalyear': fields.many2one('account.fiscalyear', 'Fiscal year', help='Keep empty for all open fiscal year'),
+ 'periods': fields.many2many('account.period', 'period_report_rel', 'report_id', 'period_id', 'Periods', help='All periods if empty'),
+ 'result_selection': fields.selection([('customer','Receivable Accounts'),
+ ('supplier','Payable Accounts'),
+ ('all','Receivable and Payable Accounts')],
+ 'Partner', required=True),
+ 'soldeinit': fields.boolean('Include initial balances'),
+ 'date1': fields.date('Start date', required=True),
+ 'date2': fields.date('End date', required=True),
+ }
+
+ def _get_company(self, cr, uid, ids, context=None):
+ user_obj = self.pool.get('res.users')
+ company_obj = self.pool.get('res.company')
+ user = user_obj.browse(cr, uid, uid, context=context)
+ if user.company_id:
+ return user.company_id.id
+ else:
+ return company_obj.search(cr, uid, [('parent_id', '=', False)])[0]
+
+ _defaults={
+ 'state' : 'none',
+ 'date1' : lambda *a: time.strftime('%Y-01-01'),
+ 'date2' : lambda *a: time.strftime('%Y-%m-%d'),
+ 'result_selection' : lambda *a: 'all',
+ 'soldeinit' : True,
+ 'company_id' : _get_company,
+ 'fiscalyear' : False,
+ }
+
+ def check_state(self, cr, uid, ids, context=None):
+ data = {
+ 'ids':[],
+ 'model': 'res.partner',
+ 'form': self.read(cr, uid, ids, [])[0],
+ }
+
+ if data['form']['state'] == 'bydate' :
+ return self._check_date(cr, uid, data, context)
+ if data['form']['state'] == 'byperiod':
+ if not data['form']['periods']:
+ raise osv.except_osv(_('Warning'),_('Please Enter Periods ! '))
+
+ return {
+ 'type': 'ir.actions.report.xml',
+ 'report_name': 'account.partner.balance',
+ 'datas': data,
+ }
+
+ def _check_date(self, cr, uid, data, context):
+ sql = """
+ SELECT f.id, f.date_start, f.date_stop FROM account_fiscalyear f Where %s between f.date_start and f.date_stop """
+ cr.execute(sql,(data['form']['date1'],))
+ res = cr.dictfetchall()
+ if res:
+ if (data['form']['date2'] > res[0]['date_stop'] or data['form']['date2'] < res[0]['date_start']):
+ raise osv.except_osv(_('UserError'),_('Date to must be set between %s and %s') % (str(res[0]['date_start']), str(res[0]['date_stop'])))
+ else:
+ return {
+ 'type': 'ir.actions.report.xml',
+ 'report_name': 'account.partner.balance',
+ 'datas': data,
+ }
+ else:
+ raise osv.except_osv(_('UserError'),_('Date not in a defined fiscal year'))
+
+account_partner_balance()
+
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
+
diff --git a/addons/account/wizard/account_partner_balance_report_view.xml b/addons/account/wizard/account_partner_balance_report_view.xml
new file mode 100644
index 00000000000..02c2ec03a25
--- /dev/null
+++ b/addons/account/wizard/account_partner_balance_report_view.xml
@@ -0,0 +1,59 @@
+
+
+
+
+
+ Select period
+ account.partner.balance
+ form
+
+
+
+
+
+
+ Select Period
+ account.partner.balance
+ ir.actions.act_window
+ form
+ tree,form
+
+ {'record_id':active_id}
+ new
+
+
+
+
+
+
\ No newline at end of file
diff --git a/addons/account/wizard/account_unreconcile.py b/addons/account/wizard/account_unreconcile.py
new file mode 100644
index 00000000000..d50994a6f28
--- /dev/null
+++ b/addons/account/wizard/account_unreconcile.py
@@ -0,0 +1,55 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+# OpenERP, Open Source Management Solution
+# Copyright (C) 2004-2010 Tiny SPRL ().
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as
+# published by the Free Software Foundation, either version 3 of the
+# License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# 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 .
+#
+##############################################################################
+from osv import fields, osv
+
+class account_unreconcile(osv.osv_memory):
+ _name = "account.unreconcile"
+ _description = "Account Unreconcile"
+
+ def trans_unrec(self, cr, uid, ids, context=None):
+ obj_move_line = self.pool.get('account.move.line')
+ obj_move_reconcile = self.pool.get('account.move.reconcile')
+ if context is None:
+ context = {}
+ recs = obj_move_line.read(cr, uid, context['active_ids'], ['reconcile_id',])
+ recs = filter(lambda x: x['reconcile_id'], recs)
+ rec_ids = [rec['reconcile_id'][0] for rec in recs]
+ if len(rec_ids):
+ obj_move_reconcile.unlink(cr, uid, rec_ids)
+ return {}
+
+account_unreconcile()
+
+class account_unreconcile_reconcile(osv.osv_memory):
+ _name = "account.unreconcile.reconcile"
+ _description = "Account Unreconcile Reconcile"
+
+ def trans_unrec_reconcile(self, cr, uid, ids, context=None):
+ obj_move_reconcile = self.pool.get('account.move.reconcile')
+ if context is None:
+ context = {}
+ if len(rec_ids):
+ obj_move_reconcile.unlink(cr, uid, context['active_ids'])
+ return {}
+
+account_unreconcile_reconcile()
+
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
\ No newline at end of file
diff --git a/addons/account/wizard/account_unreconcile_view.xml b/addons/account/wizard/account_unreconcile_view.xml
new file mode 100644
index 00000000000..3ac038329d9
--- /dev/null
+++ b/addons/account/wizard/account_unreconcile_view.xml
@@ -0,0 +1,83 @@
+
+
+
+
+
+ Unreconcile Entries
+ account.unreconcile
+ form
+
+
+
+
+
+
+ Unreconcile Entries
+ account.unreconcile
+ form
+ form
+
+ new
+
+
+
+
+
+ Unreconcile Entries
+ client_action_multi
+
+ action
+ account.move.line
+
+
+
+ Unreconcile Entries
+ account.unreconcile.reconcile
+ form
+
+
+
+
+
+
+ Unreconcile Entries
+ ir.actions.act_window
+ account.unreconcile.reconcile
+ form
+ form
+
+ {'record_id' : active_id}
+ new
+
+
+
+
+
+ Unreconcile Entries
+ client_action_multi
+
+ action
+ account.move.reconcile
+
+
+
+
+
diff --git a/addons/account/wizard/account_use_model.py b/addons/account/wizard/account_use_model.py
new file mode 100644
index 00000000000..28a892a398b
--- /dev/null
+++ b/addons/account/wizard/account_use_model.py
@@ -0,0 +1,116 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+# OpenERP, Open Source Management Solution
+# Copyright (C) 2004-2010 Tiny SPRL ().
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as
+# published by the Free Software Foundation, either version 3 of the
+# License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# 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 .
+#
+##############################################################################
+import time
+import datetime
+
+from osv import fields, osv
+from tools.translate import _
+
+class account_use_model(osv.osv_memory):
+
+ _name = 'account.use.model'
+ _description = 'Use model'
+ _columns = {
+ 'model': fields.many2many('account.model', 'account_use_model_relation','account_id','model_id','Account Model'),
+ }
+
+ def create_entries(self, cr, uid, ids, context=None):
+ account_model_obj = self.pool.get('account.model')
+ account_period_obj = self.pool.get('account.period')
+ account_move_obj = self.pool.get('account.move')
+ account_move_line_obj = self.pool.get('account.move.line')
+ mod_obj = self.pool.get('ir.model.data')
+ if context is None:
+ context = {}
+
+ data = self.read(cr, uid, ids,context=context)[0]
+ record_id = context and context.get('model_line', False) or False
+ if record_id:
+ data_model = account_model_obj.browse(cr,uid,data['model'])
+ else:
+ data_model = account_model_obj.browse(cr,uid,context['active_ids'])
+ move_ids = []
+ for model in data_model:
+ period_id = account_period_obj.find(cr, uid, context=context)
+ if not period_id:
+ raise osv.except_osv(_('No period found !'), _('Unable to find a valid period !'))
+ period_id = period_id[0]
+ move_id = account_move_obj.create(cr, uid, {
+ 'ref': model.ref,
+ 'period_id': period_id,
+ 'journal_id': model.journal_id.id,
+ })
+ move_ids.append(move_id)
+ for line in model.lines_id:
+ val = {
+ 'move_id': move_id,
+ 'journal_id': model.journal_id.id,
+ 'period_id': period_id
+ }
+ val.update({
+ 'name': line.name,
+ 'quantity': line.quantity,
+ 'debit': line.debit,
+ 'credit': line.credit,
+ 'account_id': line.account_id.id,
+ 'move_id': move_id,
+ 'ref': line.ref,
+ 'partner_id': line.partner_id.id,
+ 'date': time.strftime('%Y-%m-%d'),
+ 'date_maturity': time.strftime('%Y-%m-%d')
+ })
+ c = context.copy()
+ c.update({'journal_id': model.journal_id.id,'period_id': period_id})
+ id_line = account_move_line_obj.create(cr, uid, val, context=c)
+ context.update({'move_ids':move_ids})
+ model_data_ids = mod_obj.search(cr, uid,[('model','=','ir.ui.view'),('name','=','view_account_use_model_open_entry')], context=context)
+ resource_id = mod_obj.read(cr, uid, model_data_ids, fields=['res_id'], context=context)[0]['res_id']
+ return {
+ 'name': _('Use Model'),
+ 'context': context,
+ 'view_type': 'form',
+ 'view_mode': 'form',
+ 'res_model': 'account.use.model',
+ 'views': [(resource_id,'form')],
+ 'type': 'ir.actions.act_window',
+ 'target': 'new',
+ }
+
+ def open_moves(self, cr, uid, ids, context=None):
+ mod_obj = self.pool.get('ir.model.data')
+ if context is None:
+ context = {}
+ model_data_ids = mod_obj.search(cr, uid,[('model','=','ir.ui.view'),('name','=','view_move_form')], context=context)
+ resource_id = mod_obj.read(cr, uid, model_data_ids, fields=['res_id'], context=context)[0]['res_id']
+ return {
+ 'domain': "[('id','in', ["+','.join(map(str,context['move_ids']))+"])]",
+ 'name': 'Entries',
+ 'view_type': 'form',
+ 'view_mode': 'tree,form',
+ 'res_model': 'account.move',
+ 'views': [(False,'tree'),(resource_id,'form')],
+ 'type': 'ir.actions.act_window',
+ }
+
+account_use_model()
+
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
+
diff --git a/addons/account/wizard/account_use_model_view.xml b/addons/account/wizard/account_use_model_view.xml
new file mode 100644
index 00000000000..877a83dbb00
--- /dev/null
+++ b/addons/account/wizard/account_use_model_view.xml
@@ -0,0 +1,88 @@
+
+
+
+
+
+ account.use.model.form
+ account.use.model
+ form
+
+
+
+
+
+
+ Create Entries From Models
+ account.use.model
+ form
+ tree,form
+
+ new
+ {'model_line':'model_line'}
+
+
+
+
+
+ Create Entries From Models
+ client_action_multi
+
+ action
+ account.move.line
+
+
+
+
+
+ account.use.model.open.entry.form
+ account.use.model
+ form
+
+
+
+
+
+
+ account.use.model.create.entry.form
+ account.use.model
+ form
+
+
+
+
+
+
+ Create Entries From Models
+ account.use.model
+ form
+ tree,form
+
+ new
+
+
+
+
diff --git a/addons/account/wizard/account_validate_move_view.xml b/addons/account/wizard/account_validate_move_view.xml
index dd116ca478c..27ca48662bc 100644
--- a/addons/account/wizard/account_validate_move_view.xml
+++ b/addons/account/wizard/account_validate_move_view.xml
@@ -64,7 +64,7 @@
new
-
+
Validate Ledger Postings
diff --git a/addons/account/wizard/wizard_invoice_state.py b/addons/account/wizard/wizard_invoice_state.py
deleted file mode 100644
index 342ce5a97be..00000000000
--- a/addons/account/wizard/wizard_invoice_state.py
+++ /dev/null
@@ -1,59 +0,0 @@
-# -*- coding: utf-8 -*-
-##############################################################################
-#
-# OpenERP, Open Source Management Solution
-# Copyright (C) 2004-2010 Tiny SPRL ().
-#
-# This program is free software: you can redistribute it and/or modify
-# it under the terms of the GNU Affero General Public License as
-# published by the Free Software Foundation, either version 3 of the
-# License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# 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 .
-#
-##############################################################################
-
-import wizard
-import netsvc
-
-def _invoice_confirm(self, cr, uid, data, context):
- wf_service = netsvc.LocalService('workflow')
- for id in data['ids']:
- wf_service.trg_validate(uid, 'account.invoice', id, 'invoice_open', cr)
- return {}
-
-class wizard_invoice_confirm(wizard.interface):
- states = {
- 'init': {
- 'actions': [_invoice_confirm],
- 'result': {'type':'state', 'state':'end'}
- }
- }
-wizard_invoice_confirm('account.invoice.state.confirm')
-
-
-def _invoice_cancel(self, cr, uid, data, context):
- wf_service = netsvc.LocalService('workflow')
- for id in data['ids']:
- wf_service.trg_validate(uid, 'account.invoice', id, 'invoice_cancel', cr)
- return {}
-
-class wizard_invoice_cancel(wizard.interface):
- states = {
- 'init': {
- 'actions': [_invoice_cancel],
- 'result': {'type':'state', 'state':'end'}
- }
- }
-wizard_invoice_cancel('account.invoice.state.cancel')
-
-
-
-# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
-
diff --git a/addons/account/wizard/wizard_partner_balance_report.py b/addons/account/wizard/wizard_partner_balance_report.py
deleted file mode 100644
index f7b049a4f0f..00000000000
--- a/addons/account/wizard/wizard_partner_balance_report.py
+++ /dev/null
@@ -1,127 +0,0 @@
-# -*- coding: utf-8 -*-
-##############################################################################
-#
-# OpenERP, Open Source Management Solution
-# Copyright (C) 2004-2010 Tiny SPRL ().
-#
-# This program is free software: you can redistribute it and/or modify
-# it under the terms of the GNU Affero General Public License as
-# published by the Free Software Foundation, either version 3 of the
-# License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# 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 .
-#
-##############################################################################
-
-import time
-import wizard
-import pooler
-from tools.translate import _
-
-period_form = '''
-'''
-
-period_fields = {
- 'company_id': {'string': 'Company', 'type': 'many2one', 'relation': 'res.company', 'required': True},
- 'state':{
- 'string':"Date/Period Filter",
- 'type':'selection',
- 'selection':[('bydate','By Date'),('byperiod','By Period'),('all','By Date and Period'),('none','No Filter')],
- 'default': lambda *a:'none'
- },
- 'fiscalyear': {
- 'string':'Fiscal year', 'type': 'many2one', 'relation': 'account.fiscalyear',
- 'default': lambda *a:False,
- 'help': 'Keep empty for all open fiscal year'
- },
- 'periods': {'string': 'Periods', 'type': 'many2many', 'relation': 'account.period', 'help': 'All periods if empty'},
- 'result_selection':{
- 'string':"Partner",
- 'type':'selection',
- 'selection':[('customer','Receivable Accounts'),('supplier','Payable Accounts'),('all','Receivable and Payable Accounts')],
- 'required':True
- },
- 'soldeinit':{'string':"Include initial balances",'type':'boolean'},
- 'date1': {'string':' Start date', 'type':'date', 'required':True,'default': lambda *a: time.strftime('%Y-01-01')},
- 'date2': {'string':'End date', 'type':'date', 'required':True,'default': lambda *a: time.strftime('%Y-%m-%d')},
-}
-
-class wizard_report(wizard.interface):
-
- def _get_defaults(self,cr,uid,data,context):
- user = pooler.get_pool(cr.dbname).get('res.users').browse(cr, uid, uid, context=context)
- if user.company_id:
- company_id = user.company_id.id
- else:
- company_id = pooler.get_pool(cr.dbname).get('res.company').search(cr, uid, [('parent_id', '=', False)])[0]
-
- fiscalyear_obj = pooler.get_pool(cr.dbname).get('account.fiscalyear')
- periods_obj=pooler.get_pool(cr.dbname).get('account.period')
- data['form']['fiscalyear'] = fiscalyear_obj.find(cr, uid)
- data['form']['periods'] =periods_obj.search(cr, uid, [('fiscalyear_id','=',data['form']['fiscalyear'])])
- data['form']['company_id'] = company_id
- data['form']['soldeinit'] = True
- data['form']['fiscalyear'] = False
- data['form']['result_selection'] = 'all'
- return data['form']
-
- def _check_state(self, cr, uid, data, context):
-
- if data['form']['state'] == 'bydate' :
- self._check_date(cr, uid, data, context)
- return data['form']
-
- def _check_date(self, cr, uid, data, context):
- sql = """
- SELECT f.id, f.date_start, f.date_stop FROM account_fiscalyear f Where %s between f.date_start and f.date_stop """
- cr.execute(sql,(data['form']['date1'],))
- res = cr.dictfetchall()
- if res:
- if (data['form']['date2'] > res[0]['date_stop'] or data['form']['date2'] < res[0]['date_start']):
- raise wizard.except_wizard(_('UserError'),_('Date to must be set between %s and %s') % (str(res[0]['date_start']), str(res[0]['date_stop'])))
- else:
- return 'report'
-
- else:
- raise wizard.except_wizard(_('UserError'),_('Date not in a defined fiscal year'))
-
- states = {
- 'init': {
- 'actions': [_get_defaults],
- 'result': {'type':'form', 'arch':period_form, 'fields':period_fields, 'state':[('end','Cancel','gtk-cancel'),('report','Print','gtk-print')]}
- },
-
- 'report': {
- 'actions': [_check_state],
- 'result': {'type':'print', 'report':'account.partner.balance', 'state':'end'}
- }
- }
-wizard_report('account.partner.balance.report')
-# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
diff --git a/addons/account/wizard/wizard_unreconcile.py b/addons/account/wizard/wizard_unreconcile.py
deleted file mode 100644
index e42a1bc080b..00000000000
--- a/addons/account/wizard/wizard_unreconcile.py
+++ /dev/null
@@ -1,76 +0,0 @@
-# -*- coding: utf-8 -*-
-##############################################################################
-#
-# OpenERP, Open Source Management Solution
-# Copyright (C) 2004-2010 Tiny SPRL ().
-#
-# This program is free software: you can redistribute it and/or modify
-# it under the terms of the GNU Affero General Public License as
-# published by the Free Software Foundation, either version 3 of the
-# License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# 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 .
-#
-##############################################################################
-
-import wizard
-import pooler
-
-_info_form = '''
-'''
-
-def _trans_unrec(self, cr, uid, data, context):
- pool = pooler.get_pool(cr.dbname)
- recs = pool.get('account.move.line').read(cr, uid, data['ids'], ['reconcile_id',])
- recs = filter(lambda x: x['reconcile_id'], recs)
- rec_ids = [rec['reconcile_id'][0] for rec in recs]
- if len(rec_ids):
- pooler.get_pool(cr.dbname).get('account.move.reconcile').unlink(cr, uid, rec_ids)
- return {}
-
-class wiz_unreconcile(wizard.interface):
- states = {
- 'init': {
- 'actions': [],
- 'result': {'type': 'form', 'arch': _info_form, 'fields': {}, 'state':[('end', 'Cancel', 'gtk-cancel'), ('unrec', 'Unreconcile', 'gtk-ok')]}
- },
- 'unrec': {
- 'actions': [_trans_unrec],
- 'result': {'type': 'state', 'state':'end'}
- }
- }
-wiz_unreconcile('account.move.line.unreconcile')
-
-
-def _trans_unrec_reconcile(self, cr, uid, data, context):
- rec_ids = data['ids']
- if len(rec_ids):
- pooler.get_pool(cr.dbname).get('account.move.reconcile').unlink(cr, uid, rec_ids)
- return {}
-
-class wiz_unreconcile_reconcile(wizard.interface):
- states = {
- 'init': {
- 'actions': [],
- 'result': {'type': 'form', 'arch': _info_form, 'fields': {}, 'state':[('end', 'Cancel', 'gtk-cancel'), ('unrec', 'Unreconcile', 'gtk-ok')]}
- },
- 'unrec': {
- 'actions': [_trans_unrec_reconcile],
- 'result': {'type': 'state', 'state':'end'}
- }
- }
-wiz_unreconcile_reconcile('account.reconcile.unreconcile')
-
-
-# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
-
diff --git a/addons/account/wizard/wizard_use_model.py b/addons/account/wizard/wizard_use_model.py
deleted file mode 100644
index ef3a4ba1310..00000000000
--- a/addons/account/wizard/wizard_use_model.py
+++ /dev/null
@@ -1,131 +0,0 @@
-# -*- coding: utf-8 -*-
-##############################################################################
-#
-# OpenERP, Open Source Management Solution
-# Copyright (C) 2004-2010 Tiny SPRL ().
-#
-# This program is free software: you can redistribute it and/or modify
-# it under the terms of the GNU Affero General Public License as
-# published by the Free Software Foundation, either version 3 of the
-# License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# 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 .
-#
-##############################################################################
-
-import wizard
-import time
-import datetime
-import pooler
-from tools.translate import _
-
-model_form = """
-"""
-
-model_fields = {
- 'model': {'string': 'Account Model', 'type': 'many2many', 'relation': 'account.model', 'required': True},
- }
-
-form = """
-
-"""
-fields = {
- }
-def _create_entries(self, cr, uid, data, context):
- pool_obj = pooler.get_pool(cr.dbname)
- if data['model']=='ir.ui.menu' or data['model']=='account.move.line':
- model_ids = data['form']['model'][0][2]
- data_model = pool_obj.get('account.model').browse(cr,uid,model_ids)
- else:
- data_model = pool_obj.get('account.model').browse(cr,uid,data['ids'])
- move_ids = []
- for model in data_model:
-
- period_id = pool_obj.get('account.period').find(cr,uid, context=context)
- if not period_id:
- raise wizard.except_wizard(_('No period found !'), _('Unable to find a valid period !'))
- period_id = period_id[0]
- move_id = pool_obj.get('account.move').create(cr, uid, {
- 'ref': model.ref,
- 'period_id': period_id,
- 'journal_id': model.journal_id.id,
- })
- move_ids.append(move_id)
- for line in model.lines_id:
- val = {
- 'move_id': move_id,
- 'journal_id': model.journal_id.id,
- 'period_id': period_id
- }
- val.update({
- 'name': line.name,
- 'quantity': line.quantity,
- 'debit': line.debit,
- 'credit': line.credit,
- 'account_id': line.account_id.id,
- 'move_id': move_id,
- 'ref': line.ref,
- 'partner_id': line.partner_id.id,
- 'date': time.strftime('%Y-%m-%d'),
- 'date_maturity': time.strftime('%Y-%m-%d')
- })
- c = context.copy()
- c.update({'journal_id': model.journal_id.id,'period_id': period_id})
- id_line = pool_obj.get('account.move.line').create(cr, uid, val, context=c)
- data['form']['move_ids']=move_ids
- return data['form']
-
-class use_model(wizard.interface):
-
- def _open_moves(self, cr, uid, data, context):
- pool_obj = pooler.get_pool(cr.dbname)
- model_data_ids = pool_obj.get('ir.model.data').search(cr,uid,[('model','=','ir.ui.view'),('name','=','view_move_form')])
- resource_id = pool_obj.get('ir.model.data').read(cr,uid,model_data_ids,fields=['res_id'])[0]['res_id']
- return {
- 'domain': "[('id','in', ["+','.join(map(str,data['form']['move_ids']))+"])]",
- 'name': 'Entries',
- 'view_type': 'form',
- 'view_mode': 'tree,form',
- 'res_model': 'account.move',
- 'views': [(False,'tree'),(resource_id,'form')],
- 'type': 'ir.actions.act_window'
- }
-
- def _check(self, cr, uid, data, context):
- if data['model']=='ir.ui.menu' or data['model']=='account.move.line':
- return 'init_form'
- return 'create'
-
- states = {
- 'init': {
- 'actions': [],
- 'result': {'type':'choice','next_state':_check}
- },
- 'init_form': {
- 'actions': [],
- 'result': {'type':'form', 'arch':model_form, 'fields':model_fields, 'state':[('end','Cancel', 'gtk-cancel'),('create','Create', 'gtk-ok')]},
- },
- 'create': {
- 'actions': [_create_entries],
- 'result': {'type': 'form','arch':form, 'fields':fields, 'state':[('end','Ok'),('open_move','Open')]},
- },
- 'open_move': {
- 'actions': [],
- 'result': {'type':'action', 'action':_open_moves, 'state':'end'}
- }
- }
-
-use_model("account_use_models")# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
-
-# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
-
diff --git a/addons/account_analytic_plans/account_analytic_plans.py b/addons/account_analytic_plans/account_analytic_plans.py
index 7f1e3854f6a..ea3dbdd0475 100644
--- a/addons/account_analytic_plans/account_analytic_plans.py
+++ b/addons/account_analytic_plans/account_analytic_plans.py
@@ -234,6 +234,9 @@ class account_analytic_plan_instance_line(osv.osv):
'analytic_account_id':fields.many2one('account.analytic.account','Analytic Account', required=True),
'rate':fields.float('Rate (%)', required=True),
}
+ _defaults = {
+ 'rate': lambda *args: 100.0
+ }
def name_get(self, cr, uid, ids, context={}):
if not len(ids):
return []
diff --git a/addons/account_analytic_plans/i18n/ko.po b/addons/account_analytic_plans/i18n/ko.po
index b0f4a4ab8d3..82e86a1bc4d 100644
--- a/addons/account_analytic_plans/i18n/ko.po
+++ b/addons/account_analytic_plans/i18n/ko.po
@@ -14,7 +14,7 @@ msgstr ""
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
-"X-Launchpad-Export-Date: 2010-04-20 03:33+0000\n"
+"X-Launchpad-Export-Date: 2010-04-21 04:06+0000\n"
"X-Generator: Launchpad (build Unknown)\n"
#. module: account_analytic_plans
diff --git a/addons/account_anglo_saxon/i18n/es.po b/addons/account_anglo_saxon/i18n/es.po
index 89400a43155..f6a07fae485 100644
--- a/addons/account_anglo_saxon/i18n/es.po
+++ b/addons/account_anglo_saxon/i18n/es.po
@@ -14,7 +14,7 @@ msgstr ""
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
-"X-Launchpad-Export-Date: 2010-04-20 03:33+0000\n"
+"X-Launchpad-Export-Date: 2010-04-21 04:06+0000\n"
"X-Generator: Launchpad (build Unknown)\n"
#. module: account_anglo_saxon
diff --git a/addons/account_balance/i18n/oc.po b/addons/account_balance/i18n/oc.po
index b0818900099..221f387930a 100644
--- a/addons/account_balance/i18n/oc.po
+++ b/addons/account_balance/i18n/oc.po
@@ -14,7 +14,7 @@ msgstr ""
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
-"X-Launchpad-Export-Date: 2010-04-20 03:33+0000\n"
+"X-Launchpad-Export-Date: 2010-04-21 04:06+0000\n"
"X-Generator: Launchpad (build Unknown)\n"
#. module: account_balance
diff --git a/addons/account_followup/i18n/oc.po b/addons/account_followup/i18n/oc.po
index 4f531d50472..7db5e861ed2 100644
--- a/addons/account_followup/i18n/oc.po
+++ b/addons/account_followup/i18n/oc.po
@@ -14,7 +14,7 @@ msgstr ""
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
-"X-Launchpad-Export-Date: 2010-04-20 03:32+0000\n"
+"X-Launchpad-Export-Date: 2010-04-21 04:05+0000\n"
"X-Generator: Launchpad (build Unknown)\n"
#. module: account_followup
diff --git a/addons/account_invoice_layout/i18n/oc.po b/addons/account_invoice_layout/i18n/oc.po
index 88dc0b3b1ae..48d6406d4eb 100644
--- a/addons/account_invoice_layout/i18n/oc.po
+++ b/addons/account_invoice_layout/i18n/oc.po
@@ -14,7 +14,7 @@ msgstr ""
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
-"X-Launchpad-Export-Date: 2010-04-20 03:33+0000\n"
+"X-Launchpad-Export-Date: 2010-04-21 04:06+0000\n"
"X-Generator: Launchpad (build Unknown)\n"
#. module: account_invoice_layout
diff --git a/addons/account_tax_include/i18n/cs.po b/addons/account_tax_include/i18n/cs.po
index bb8f08ae2a7..1b6c23eccc0 100644
--- a/addons/account_tax_include/i18n/cs.po
+++ b/addons/account_tax_include/i18n/cs.po
@@ -13,7 +13,7 @@ msgstr ""
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
-"X-Launchpad-Export-Date: 2010-04-20 03:32+0000\n"
+"X-Launchpad-Export-Date: 2010-04-21 04:05+0000\n"
"X-Generator: Launchpad (build Unknown)\n"
#. module: account_tax_include
diff --git a/addons/analytic_user_function/i18n/ko.po b/addons/analytic_user_function/i18n/ko.po
index 79fa7192edc..8577f274c8e 100644
--- a/addons/analytic_user_function/i18n/ko.po
+++ b/addons/analytic_user_function/i18n/ko.po
@@ -14,7 +14,7 @@ msgstr ""
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
-"X-Launchpad-Export-Date: 2010-04-20 03:33+0000\n"
+"X-Launchpad-Export-Date: 2010-04-21 04:06+0000\n"
"X-Generator: Launchpad (build Unknown)\n"
#. module: analytic_user_function
diff --git a/addons/analytic_user_function/i18n/ru.po b/addons/analytic_user_function/i18n/ru.po
index 052f0387292..dba8c233370 100644
--- a/addons/analytic_user_function/i18n/ru.po
+++ b/addons/analytic_user_function/i18n/ru.po
@@ -13,7 +13,7 @@ msgstr ""
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
-"X-Launchpad-Export-Date: 2010-04-20 03:33+0000\n"
+"X-Launchpad-Export-Date: 2010-04-21 04:06+0000\n"
"X-Generator: Launchpad (build Unknown)\n"
#. module: analytic_user_function
diff --git a/addons/auction/auction.py b/addons/auction/auction.py
index cf5f27775df..b7a379cd387 100644
--- a/addons/auction/auction.py
+++ b/addons/auction/auction.py
@@ -481,10 +481,11 @@ class auction_lots(osv.osv):
return result
def name_search(self, cr, user, name, args=None, operator='ilike', context={}):
- if not args:
+ if not len(args):
args = []
-
- ids = self.search(cr, user, [('obj_num','=',int(name))] + args)
+ ids = []
+ if name:
+ ids = self.search(cr, user, [('obj_num','=',int(name))] + args)
if not ids:
ids = self.search(cr, user, [('name',operator,name)] + args)
return self.name_get(cr, user, ids)
diff --git a/addons/base_module_merge/i18n/ru.po b/addons/base_module_merge/i18n/ru.po
index 3de045ac954..e47a7b00e10 100644
--- a/addons/base_module_merge/i18n/ru.po
+++ b/addons/base_module_merge/i18n/ru.po
@@ -13,7 +13,7 @@ msgstr ""
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
-"X-Launchpad-Export-Date: 2010-04-20 03:33+0000\n"
+"X-Launchpad-Export-Date: 2010-04-21 04:06+0000\n"
"X-Generator: Launchpad (build Unknown)\n"
#. module: base_module_merge
diff --git a/addons/base_module_publish/i18n/ru.po b/addons/base_module_publish/i18n/ru.po
index f8a4d09a982..c032b5ea044 100644
--- a/addons/base_module_publish/i18n/ru.po
+++ b/addons/base_module_publish/i18n/ru.po
@@ -13,7 +13,7 @@ msgstr ""
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
-"X-Launchpad-Export-Date: 2010-04-20 03:32+0000\n"
+"X-Launchpad-Export-Date: 2010-04-21 04:05+0000\n"
"X-Generator: Launchpad (build Unknown)\n"
#. module: base_module_publish
diff --git a/addons/base_module_record/i18n/ru.po b/addons/base_module_record/i18n/ru.po
index 9e578b177c1..e52b4b28a2e 100644
--- a/addons/base_module_record/i18n/ru.po
+++ b/addons/base_module_record/i18n/ru.po
@@ -13,7 +13,7 @@ msgstr ""
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
-"X-Launchpad-Export-Date: 2010-04-20 03:32+0000\n"
+"X-Launchpad-Export-Date: 2010-04-21 04:05+0000\n"
"X-Generator: Launchpad (build Unknown)\n"
#. module: base_module_record
diff --git a/addons/board_manufacturing/i18n/ru.po b/addons/board_manufacturing/i18n/ru.po
index 7b3b847ae72..d7ac2d1156e 100644
--- a/addons/board_manufacturing/i18n/ru.po
+++ b/addons/board_manufacturing/i18n/ru.po
@@ -13,7 +13,7 @@ msgstr ""
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
-"X-Launchpad-Export-Date: 2010-04-20 03:32+0000\n"
+"X-Launchpad-Export-Date: 2010-04-21 04:05+0000\n"
"X-Generator: Launchpad (build Unknown)\n"
#. module: board_manufacturing
diff --git a/addons/board_sale/i18n/ru.po b/addons/board_sale/i18n/ru.po
index b5bf9118f35..8d038adc8a7 100644
--- a/addons/board_sale/i18n/ru.po
+++ b/addons/board_sale/i18n/ru.po
@@ -13,7 +13,7 @@ msgstr ""
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
-"X-Launchpad-Export-Date: 2010-04-20 03:32+0000\n"
+"X-Launchpad-Export-Date: 2010-04-21 04:05+0000\n"
"X-Generator: Launchpad (build Unknown)\n"
#. module: board_sale
diff --git a/addons/crm_profiling/i18n/ko.po b/addons/crm_profiling/i18n/ko.po
index 919e0c79acf..1b59c77929b 100644
--- a/addons/crm_profiling/i18n/ko.po
+++ b/addons/crm_profiling/i18n/ko.po
@@ -14,7 +14,7 @@ msgstr ""
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
-"X-Launchpad-Export-Date: 2010-04-20 03:33+0000\n"
+"X-Launchpad-Export-Date: 2010-04-21 04:06+0000\n"
"X-Generator: Launchpad (build Unknown)\n"
#. module: crm_profiling
diff --git a/addons/event/i18n/pl.po b/addons/event/i18n/pl.po
index 24eeefb9d23..c53c8ece373 100644
--- a/addons/event/i18n/pl.po
+++ b/addons/event/i18n/pl.po
@@ -13,7 +13,7 @@ msgstr ""
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
-"X-Launchpad-Export-Date: 2010-04-20 03:32+0000\n"
+"X-Launchpad-Export-Date: 2010-04-21 04:05+0000\n"
"X-Generator: Launchpad (build Unknown)\n"
#. module: event
diff --git a/addons/fetchmail/fetchmail.py b/addons/fetchmail/fetchmail.py
index 041e469a99e..565c4434607 100644
--- a/addons/fetchmail/fetchmail.py
+++ b/addons/fetchmail/fetchmail.py
@@ -253,7 +253,8 @@ class mail_server(osv.osv):
msg['body'] = body
msg['attachments'] = attachents
-
+
+ res_id = False
if msg.get('references', False):
id = False
ref = msg.get('references')
@@ -274,12 +275,20 @@ class mail_server(osv.osv):
vals = {
}
- model_pool.message_update(cr, uid, [history.res_id], vals, msg, context=context)
+ if hasattr(model_pool, 'message_update'):
+ model_pool.message_update(cr, uid, [history.res_id], vals, msg, context=context)
+ else:
+ logger.notifyChannel('imap', netsvc.LOG_WARNING, 'method def message_update is not define in model %s' % (model_pool._name))
+ return False
res_id = id
else:
model_pool = self.pool.get(server.object_id.model)
- res_id = model_pool.message_new(cr, uid, msg, context)
-
+ if hasattr(model_pool, 'message_new'):
+ res_id = model_pool.message_new(cr, uid, msg, context)
+ else:
+ logger.notifyChannel('imap', netsvc.LOG_WARNING, 'method def message_new is not define in model %s' % (model_pool._name))
+ return False
+
for attactment in attachents or []:
data_attach = {
'name': attactment,
@@ -333,10 +342,10 @@ class mail_server(osv.osv):
result, data = imap_server.search(None, '(UNSEEN)')
for num in data[0].split():
result, data = imap_server.fetch(num, '(RFC822)')
- self._process_email(cr, uid, server, data[0][1], context)
- imap_server.store(num, '+FLAGS', '\\Seen')
- count += 1
- logger.notifyChannel('imap', netsvc.LOG_INFO, 'fetchmail fetch %s email(s) from %s' % (count, server.name))
+ if self._process_email(cr, uid, server, data[0][1], context):
+ imap_server.store(num, '+FLAGS', '\\Seen')
+ count += 1
+ logger.notifyChannel('imap', netsvc.LOG_INFO, 'fetchmail fetch/process %s email(s) from %s' % (count, server.name))
imap_server.close()
imap_server.logout()
diff --git a/addons/hr/i18n/ko.po b/addons/hr/i18n/ko.po
index 7b9df87d9fb..85e36a286c8 100644
--- a/addons/hr/i18n/ko.po
+++ b/addons/hr/i18n/ko.po
@@ -14,7 +14,7 @@ msgstr ""
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
-"X-Launchpad-Export-Date: 2010-04-20 03:33+0000\n"
+"X-Launchpad-Export-Date: 2010-04-21 04:06+0000\n"
"X-Generator: Launchpad (build Unknown)\n"
#. module: hr
diff --git a/addons/hr/i18n/sv.po b/addons/hr/i18n/sv.po
index e3acd524000..661e079515f 100644
--- a/addons/hr/i18n/sv.po
+++ b/addons/hr/i18n/sv.po
@@ -7,13 +7,13 @@ msgstr ""
"Project-Id-Version: OpenERP Server 5.0.0\n"
"Report-Msgid-Bugs-To: support@openerp.com\n"
"POT-Creation-Date: 2009-08-28 16:01+0000\n"
-"PO-Revision-Date: 2010-03-09 21:10+0000\n"
-"Last-Translator: Anders Eriksson (Mobila System) \n"
+"PO-Revision-Date: 2010-04-21 15:10+0000\n"
+"Last-Translator: djn (XCLUDE) \n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
-"X-Launchpad-Export-Date: 2010-04-17 04:16+0000\n"
+"X-Launchpad-Export-Date: 2010-04-22 03:43+0000\n"
"X-Generator: Launchpad (build Unknown)\n"
#. module: hr
@@ -189,7 +189,7 @@ msgstr "Medlemmar"
#. module: hr
#: field:hr.employee,ssnid:0
msgid "SSN No"
-msgstr ""
+msgstr "Personnummer"
#. module: hr
#: model:process.transition,note:hr.process_transition_contactofemployee0
@@ -315,7 +315,7 @@ msgstr "Aktiv"
#. module: hr
#: constraint:hr.employee:0
msgid "Error ! You cannot create recursive Hierarchy of Employees."
-msgstr ""
+msgstr "Fel! Du kan inte skapa omvänd rangordning av anställda."
#. module: hr
#: model:process.process,name:hr.process_process_employeecontractprocess0
diff --git a/addons/hr_timesheet/__openerp__.py b/addons/hr_timesheet/__openerp__.py
index 976242edc0c..4bd6d3525fc 100644
--- a/addons/hr_timesheet/__openerp__.py
+++ b/addons/hr_timesheet/__openerp__.py
@@ -44,7 +44,10 @@ to set up a management by affair.
'hr_timesheet_view.xml',
'hr_timesheet_report.xml',
'hr_timesheet_wizard.xml',
- 'process/hr_timesheet_process.xml'
+ 'process/hr_timesheet_process.xml',
+ 'wizard/hr_timesheet_print_employee_view.xml',
+ 'wizard/hr_timesheet_print_users_view.xml',
+ 'wizard/hr_timesheet_sign_in_out_view.xml',
],
'demo_xml': ['hr_timesheet_demo.xml'],
'installable': True,
diff --git a/addons/hr_timesheet/hr_timesheet_report.xml b/addons/hr_timesheet/hr_timesheet_report.xml
index 9b7c527fea9..6fa7185c7e9 100644
--- a/addons/hr_timesheet/hr_timesheet_report.xml
+++ b/addons/hr_timesheet/hr_timesheet_report.xml
@@ -13,32 +13,32 @@
sequence="1" />
-
-
+
-
-
+ />-->
+
-
-
+-->
diff --git a/addons/hr_timesheet/hr_timesheet_wizard.xml b/addons/hr_timesheet/hr_timesheet_wizard.xml
index 8d84a261ba6..fa36c03ae10 100644
--- a/addons/hr_timesheet/hr_timesheet_wizard.xml
+++ b/addons/hr_timesheet/hr_timesheet_wizard.xml
@@ -1,8 +1,8 @@
-
-
-
-
+
diff --git a/addons/hr_timesheet/report/users_timesheet.py b/addons/hr_timesheet/report/users_timesheet.py
index c179c3d3fff..9755d2d5871 100644
--- a/addons/hr_timesheet/report/users_timesheet.py
+++ b/addons/hr_timesheet/report/users_timesheet.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 .
#
##############################################################################
@@ -42,24 +42,24 @@ def emp_create_xml(cr, id, som, eom):
"and line.user_id=%s and line.date >= %s and line.date < %s "
"order by line.date",
(id, som.strftime('%Y-%m-%d'), eom.strftime('%Y-%m-%d')))
-
+
# Sum by day
month = {}
for presence in cr.dictfetchall():
day = int(presence['date'][-2:])
month[day] = month.get(day, 0.0) + presence['amount']
-
+
xml = '''
%.2f
'''
time_xml = ([xml % (day, amount) for day, amount in month.iteritems()])
-
+
# Computing the employee
cr.execute("select name from res_users where id=%s", (id,))
emp = cr.fetchone()[0]
-
+
# Computing the xml
xml = '''
@@ -73,13 +73,13 @@ class report_custom(report_rml):
def get_month_name(self, cr, uid, month):
_months = {1:_("January"), 2:_("February"), 3:_("March"), 4:_("April"), 5:_("May"), 6:_("June"), 7:_("July"), 8:_("August"), 9:_("September"), 10:_("October"), 11:_("November"), 12:_("December")}
return _months[month]
-
+
def get_weekday_name(self, cr, uid, weekday):
_weekdays = {1:_('Mon'), 2:_('Tue'), 3:_('Wed'), 4:_('Thu'), 5:_('Fri'), 6:_('Sat'), 7:_('Sun')}
return _weekdays[weekday]
def create_xml(self, cr, uid, ids, data, context):
-
+
# Computing the dates (start of month: som, and end of month: eom)
som = datetime.date(data['form']['year'], data['form']['month'], 1)
eom = som + datetime.timedelta(lengthmonth(som.year, som.month))
@@ -87,9 +87,9 @@ class report_custom(report_rml):
date_xml += ['' % (x, self.get_weekday_name(cr, uid, som.replace(day=x).weekday()+1), som.replace(day=x).weekday()+1) for x in range(1, lengthmonth(som.year, som.month)+1)]
date_xml.append('')
date_xml.append('2.5cm%s,2cm\n' % (',0.7cm' * lengthmonth(som.year, som.month)))
-
+
emp_xml=''
- for id in data['form']['user_ids'][0][2]:
+ for id in data['form']['user_ids']:
emp_xml += emp_create_xml(cr, id, som, eom)
# Computing the xml
diff --git a/addons/hr_timesheet/wizard/__init__.py b/addons/hr_timesheet/wizard/__init__.py
index 88b1cb40415..5f2bc1443e3 100644
--- a/addons/hr_timesheet/wizard/__init__.py
+++ b/addons/hr_timesheet/wizard/__init__.py
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
##############################################################################
-#
+#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL ().
#
@@ -15,13 +15,13 @@
# 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 .
#
##############################################################################
-import sign_in_out
-import wizard_print_timesheet
-import wizard_print_timesheet_users
+import hr_timesheet_sign_in_out
+import hr_timesheet_print_employee
+import hr_timesheet_print_users
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
diff --git a/addons/hr_timesheet/wizard/hr_timesheet_print_employee.py b/addons/hr_timesheet/wizard/hr_timesheet_print_employee.py
new file mode 100644
index 00000000000..d2e9a54f836
--- /dev/null
+++ b/addons/hr_timesheet/wizard/hr_timesheet_print_employee.py
@@ -0,0 +1,57 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+# OpenERP, Open Source Management Solution
+# Copyright (C) 2004-2010 Tiny SPRL ().
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as
+# published by the Free Software Foundation, either version 3 of the
+# License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# 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 .
+#
+##############################################################################
+import datetime
+
+from osv import osv, fields
+
+class analytical_timesheet_employee(osv.osv_memory):
+ _name = 'hr.analytical.timesheet.employee'
+ _description = 'Print Employee Timesheet & Print My Timesheet'
+ _columns = {
+ 'month': fields.selection([(x, datetime.date(2000, x, 1).strftime('%B')) for x in range(1, 13)],
+ 'Month', required=True),
+ 'year': fields.integer('Year', required=True),
+ 'user_id': fields.many2one('res.users', 'User', required=True)
+ }
+
+ def _get_user(self, cr, uid, context=None):
+ return uid
+
+ _defaults = {
+ 'month': datetime.date.today().month,
+ 'year': datetime.date.today().year,
+ 'user_id': _get_user
+ }
+
+ def print_report(self, cr, uid, ids, context=None):
+ data = self.read(cr, uid, ids, context=context)[0]
+ datas = {
+ 'ids': [],
+ 'model': 'hr.employee',
+ 'form': data
+ }
+ return {
+ 'type': 'ir.actions.report.xml',
+ 'report_name': 'hr.analytical.timesheet',
+ 'datas': datas,
+ }
+analytical_timesheet_employee()
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
\ No newline at end of file
diff --git a/addons/hr_timesheet/wizard/hr_timesheet_print_employee_view.xml b/addons/hr_timesheet/wizard/hr_timesheet_print_employee_view.xml
new file mode 100644
index 00000000000..a3b53a05d22
--- /dev/null
+++ b/addons/hr_timesheet/wizard/hr_timesheet_print_employee_view.xml
@@ -0,0 +1,75 @@
+
+
+
+
+
+
+ hr.analytical.timesheet.employee.form
+ hr.analytical.timesheet.employee
+ form
+
+
+
+
+
+
+ Employee Timesheet
+ hr.analytical.timesheet.employee
+ form
+ tree,form
+
+ new
+
+
+
+
+
+
+
+ hr.analytical.timesheet.my.form
+ hr.analytical.timesheet.employee
+ form
+
+
+
+
+
+
+ Print My Timesheet
+ hr.analytical.timesheet.employee
+ form
+ tree,form
+
+ new
+
+
+
+
+
+
diff --git a/addons/hr_timesheet/wizard/hr_timesheet_print_users.py b/addons/hr_timesheet/wizard/hr_timesheet_print_users.py
new file mode 100644
index 00000000000..3931e41e185
--- /dev/null
+++ b/addons/hr_timesheet/wizard/hr_timesheet_print_users.py
@@ -0,0 +1,56 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+# OpenERP, Open Source Management Solution
+# Copyright (C) 2004-2010 Tiny SPRL ().
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as
+# published by the Free Software Foundation, either version 3 of the
+# License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# 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 .
+#
+##############################################################################
+
+import datetime
+
+from osv import osv, fields
+
+class analytical_timesheet_employees(osv.osv_memory):
+ _name = 'hr.analytical.timesheet.users'
+ _description = 'Print Employees Timesheet'
+ _columns = {
+ 'month': fields.selection([(x, datetime.date(2000, x, 1).strftime('%B')) for x in range(1, 13)],
+ 'Month', required=True),
+ 'year': fields.integer('Year', required=True),
+ 'user_ids': fields.many2many('res.users', 'timesheet_users_rel', 'timesheet_id', 'user_id', 'Users', required=True)
+ }
+
+ _defaults = {
+ 'month': datetime.date.today().month,
+ 'year': datetime.date.today().year,
+ }
+
+ def print_report(self, cr, uid, ids, context=None):
+ data = self.read(cr, uid, ids, context=context)[0]
+ datas = {
+ 'ids': [],
+ 'model': 'hr.employee',
+ 'form': data
+ }
+ return {
+ 'type': 'ir.actions.report.xml',
+ 'report_name': 'hr.analytical.timesheet_users',
+ 'datas': datas,
+ }
+
+analytical_timesheet_employees()
+
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
\ No newline at end of file
diff --git a/addons/hr_timesheet/wizard/hr_timesheet_print_users_view.xml b/addons/hr_timesheet/wizard/hr_timesheet_print_users_view.xml
new file mode 100644
index 00000000000..4e12f4f2333
--- /dev/null
+++ b/addons/hr_timesheet/wizard/hr_timesheet_print_users_view.xml
@@ -0,0 +1,41 @@
+
+
+
+
+
+
+ hr.analytical.timesheet.users.form
+ hr.analytical.timesheet.users
+ form
+
+
+
+
+
+
+ Employees Timesheet
+ hr.analytical.timesheet.users
+ form
+ tree,form
+
+ new
+
+
+
+
+
+
+
diff --git a/addons/hr_timesheet/wizard/hr_timesheet_sign_in_out.py b/addons/hr_timesheet/wizard/hr_timesheet_sign_in_out.py
new file mode 100644
index 00000000000..fa57cfdd1a5
--- /dev/null
+++ b/addons/hr_timesheet/wizard/hr_timesheet_sign_in_out.py
@@ -0,0 +1,169 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+# OpenERP, Open Source Management Solution
+# Copyright (C) 2004-2010 Tiny SPRL ().
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as
+# published by the Free Software Foundation, either version 3 of the
+# License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# 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 .
+#
+##############################################################################
+import time
+
+from osv import osv, fields
+from tools.translate import _
+
+class hr_so_project(osv.osv_memory):
+ _name = 'hr.sign.out.project'
+ _description = 'Sign Out By Project'
+ _columns = {
+ 'account_id': fields.many2one('account.analytic.account', 'Analytic Account', required=True, domain=[('type','=','normal')]),
+ 'info': fields.char('Work Description', size=256, required=True),
+ 'date_start': fields.datetime('Starting Date', readonly=True),
+ 'date': fields.datetime('Closing Date'),
+ 'analytic_amount': fields.float('Minimum Analytic Amount'),
+ 'name': fields.char('Employees name', size=32, required=True, readonly=True),
+ 'state': fields.char('Current state', size=32, required=True, readonly=True),
+ 'server_date': fields.datetime('Current Date', required=True, readonly=True),
+ 'emp_id': fields.char('Employee ID', size=256, required=False),
+ }
+
+ def _get_empid(self, cr, uid, context=None):
+ emp_obj = self.pool.get('hr.employee')
+ emp_id = emp_obj.search(cr, uid, [('user_id', '=', uid)])
+ if emp_id:
+ employee = emp_obj.read(cr, uid, emp_id)[0]
+ return {'name': employee['name'], 'state': employee['state'], 'emp_id': emp_id[0], 'server_date':time.strftime('%Y-%m-%d %H:%M:%S')}
+ raise osv.except_osv(_('UserError'), _('No employee defined for your user !'))
+
+ def _get_empid2(self, cr, uid, context):
+ res = self._get_empid(cr, uid, context)
+ cr.execute('select name,action from hr_attendance where employee_id=%s order by name desc limit 1', (res['emp_id'],))
+ res['server_date'] = time.strftime('%Y-%m-%d %H:%M:%S')
+ res['date_start'] = cr.fetchone()[0]
+ return res
+
+ def default_get(self, cr, uid, fields_list, context=None):
+ res = super(hr_so_project, self).default_get(cr, uid, fields_list, context=context)
+ res.update(self._get_empid2(cr, uid, context=context))
+ return res
+
+ def _write(self, cr, uid, data, emp_id, context=None):
+ timesheet_obj = self.pool.get('hr.analytic.timesheet')
+ emp_obj = self.pool.get('hr.employee')
+ hour = (time.mktime(time.strptime(data['date'] or time.strftime('%Y-%m-%d %H:%M:%S'), '%Y-%m-%d %H:%M:%S')) -
+ time.mktime(time.strptime(data['date_start'], '%Y-%m-%d %H:%M:%S'))) / 3600.0
+ minimum = data['analytic_amount']
+ if minimum:
+ hour = round(round((hour + minimum / 2) / minimum) * minimum, 2)
+ res = timesheet_obj.default_get(cr, uid, ['product_id','product_uom_id'])
+ if not res['product_uom_id']:
+ raise osv.except_osv(_('UserError'), _('No cost unit defined for this employee !'))
+ up = timesheet_obj.on_change_unit_amount(cr, uid, False, res['product_id'], hour, res['product_uom_id'])['value']
+ res['name'] = data['info']
+ res['account_id'] = data['account_id']
+ res['unit_amount'] = hour
+ emp_journal = emp_obj.browse(cr, uid, emp_id, context).journal_id
+ res['journal_id'] = emp_journal and emp_journal.id or False
+ res.update(up)
+ up = timesheet_obj.on_change_account_id(cr, uid, [], res['account_id']).get('value', {})
+ res.update(up)
+ return timesheet_obj.create(cr, uid, res, context=context)
+
+ def sign_out_result_end(self, cr, uid, ids, context=None):
+ emp_obj = self.pool.get('hr.employee')
+ data = self.read(cr, uid, ids, [])[0]
+ emp_id = data['emp_id']
+ emp_obj.attendance_action_change(cr, uid, [emp_id], type='sign_out',dt=data['date'])
+ self._write(cr, uid, data, emp_id, context=context)
+ return {}
+
+ def sign_out_result(self, cr, uid, ids, context=None):
+ emp_obj = self.pool.get('hr.employee')
+ data = self.read(cr, uid, ids, [])[0]
+ emp_id = data['emp_id']
+ emp_obj.attendance_action_change(cr, uid, [emp_id], type='action', dt=data['date'])
+ self._write(cr, uid, data, emp_id, context=context)
+ return {}
+
+hr_so_project()
+
+class hr_si_project(osv.osv_memory):
+ _name = 'hr.sign.in.project'
+ _description = 'Sign In By Project'
+ _columns = {
+ 'name': fields.char('Employees name', size=32, required=True, readonly=True),
+ 'state': fields.char('Current state', size=32, required=True, readonly=True),
+ 'date': fields.datetime('Starting Date'),
+ 'server_date': fields.datetime('Current Date', required=True, readonly=True),
+ 'emp_id': fields.char('Employee ID', size=512, required=False),
+ }
+
+ def check_state(self, cr, uid, ids, context=None):
+ obj_model = self.pool.get('ir.model.data')
+ emp_id = self._get_empid(cr, uid, context)['emp_id']
+ # get the latest action (sign_in or out) for this employee
+ cr.execute('select action from hr_attendance where employee_id=%s and action in (\'sign_in\',\'sign_out\') order by name desc limit 1', (emp_id,))
+ res = (cr.fetchone() or ('sign_out',))[0]
+ #TODO: invert sign_in et sign_out
+ if res == 'sign_out':
+ model_data_ids = obj_model.search(cr,uid,[('model','=','ir.ui.view'),('name','=','view_hr_timesheet_sign_in')])
+ resource_id = obj_model.read(cr,uid,model_data_ids,fields=['res_id'])[0]['res_id']
+ return {
+ 'name': 'Sign in / Sign out',
+ 'view_type': 'form',
+ 'view_mode': 'tree,form',
+ 'res_model': 'hr.sign.in.project',
+ 'views': [(False,'tree'), (resource_id,'form')],
+ 'type': 'ir.actions.act_window',
+ 'target': 'new'
+ }
+ else:
+ model_data_ids = obj_model.search(cr,uid,[('model','=','ir.ui.view'),('name','=','view_hr_timesheet_sign_out')])
+ resource_id = obj_model.read(cr,uid,model_data_ids,fields=['res_id'])[0]['res_id']
+ return {
+ 'name': 'Sign in / Sign out',
+ 'view_type': 'form',
+ 'view_mode': 'tree,form',
+ 'res_model': 'hr.sign.out.project',
+ 'views': [(False,'tree'), (resource_id,'form')],
+ 'type': 'ir.actions.act_window',
+ 'target': 'new'
+ }
+
+ def _get_empid(self, cr, uid, context=None):
+ emp_obj = self.pool.get('hr.employee')
+ emp_id = emp_obj.search(cr, uid, [('user_id', '=', uid)])
+ if emp_id:
+ employee = emp_obj.read(cr, uid, emp_id)[0]
+ return {'name': employee['name'], 'state': employee['state'], 'emp_id': emp_id[0], 'server_date':time.strftime('%Y-%m-%d %H:%M:%S')}
+ raise osv.except_osv(_('UserError'), _('No employee defined for your user !'))
+
+ def sign_in_result(self, cr, uid, ids, context):
+ emp_obj = self.pool.get('hr.employee')
+ data = self.read(cr, uid, ids, [], context)[0]
+ emp_id = data['emp_id']
+ try:
+ success = emp_obj.attendance_action_change(cr, uid, [emp_id], type = 'sign_in' ,dt=data['date'] or False)
+ except except_osv, e:
+ raise osv.except_osv(e.name, e.value)
+ return {}
+
+ def default_get(self, cr, uid, fields_list, context=None):
+ res = super(hr_si_project, self).default_get(cr, uid, fields_list, context=context)
+ res.update(self._get_empid(cr, uid, context=context))
+ return res
+
+hr_si_project()
+
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
\ No newline at end of file
diff --git a/addons/hr_timesheet/wizard/hr_timesheet_sign_in_out_view.xml b/addons/hr_timesheet/wizard/hr_timesheet_sign_in_out_view.xml
new file mode 100644
index 00000000000..487208bfbf6
--- /dev/null
+++ b/addons/hr_timesheet/wizard/hr_timesheet_sign_in_out_view.xml
@@ -0,0 +1,95 @@
+
+
+
+
+ hr.sign.in.project.message.form
+ hr.sign.in.project
+ form
+
+
+
+
+
+
+ hr.sign.in.project.form
+ hr.sign.in.project
+ form
+
+
+
+
+
+
+ Sign in / Sign out by project
+ hr.sign.in.project
+ form
+ tree,form
+
+ new
+
+
+
+
+
+ hr.sign.out.project.form
+ hr.sign.out.project
+ form
+
+
+
+
+
+
+ Sign in / Sign out by project
+ hr.sign.out.project
+ form
+ tree,form
+
+ new
+
+
+
+
diff --git a/addons/hr_timesheet/wizard/sign_in_out.py b/addons/hr_timesheet/wizard/sign_in_out.py
deleted file mode 100644
index 4aea035f829..00000000000
--- a/addons/hr_timesheet/wizard/sign_in_out.py
+++ /dev/null
@@ -1,171 +0,0 @@
-# -*- coding: utf-8 -*-
-##############################################################################
-#
-# OpenERP, Open Source Management Solution
-# Copyright (C) 2004-2010 Tiny SPRL ().
-#
-# This program is free software: you can redistribute it and/or modify
-# it under the terms of the GNU Affero General Public License as
-# published by the Free Software Foundation, either version 3 of the
-# License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# 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 .
-#
-##############################################################################
-
-
-import wizard
-import time
-import pooler
-from tools.translate import _
-
-si_form ='''
-'''
-
-si_fields = {
- 'name': {'string': "Employee's name", 'type':'char', 'required':True, 'readonly':True},
- 'state': {'string': "Current state", 'type' : 'char', 'required' : True, 'readonly': True},
- 'date': {'string':"Starting Date", 'type':'datetime'},
- 'server_date': {'string':"Current Date", 'type':'datetime', 'readonly':True},
-}
-
-so_form = '''
-'''
-
-so_fields = {
- 'name': {'string':"Employee's name", 'type':'char', 'required':True, 'readonly':True},
- 'state': {'string':"Current state", 'type':'char', 'required':True, 'readonly':True},
- 'account_id': {'string':"Analytic Account", 'type':'many2one', 'relation':'account.analytic.account', 'required':True, 'domain':"[('type','=','normal')]"},
- 'info': {'string':"Work Description", 'type':'char', 'size':256, 'required':True},
- 'date': {'string':"Closing Date", 'type':'datetime'},
- 'date_start': {'string':"Starting Date", 'type':'datetime', 'readonly':True},
- 'server_date': {'string':"Current Server Date", 'type':'datetime', 'readonly':True},
- 'analytic_amount': {'string':"Minimum Analytic Amount", 'type':'float'},
-}
-
-def _get_empid(self, cr, uid, data, context):
- emp_obj = pooler.get_pool(cr.dbname).get('hr.employee')
- emp_id = emp_obj.search(cr, uid, [('user_id', '=', uid)])
- if emp_id:
- employee = emp_obj.read(cr, uid, emp_id)[0]
- return {'name': employee['name'], 'state': employee['state'], 'emp_id': emp_id[0], 'date':False, 'server_date':time.strftime('%Y-%m-%d %H:%M:%S')}
- raise wizard.except_wizard(_('UserError'), _('No employee defined for your user !'))
-
-def _get_empid2(self, cr, uid, data, context):
- res = _get_empid(self,cr, uid, data, context)
- cr.execute('select name,action from hr_attendance where employee_id=%s order by name desc limit 1', (res['emp_id'],))
- res['server_date'] = time.strftime('%Y-%m-%d %H:%M:%S')
- res['date_start'] = cr.fetchone()[0]
- res['info'] = ''
- res['account_id'] = False
- return res
-
-def _sign_in_result(self, cr, uid, data, context):
- emp_obj = pooler.get_pool(cr.dbname).get('hr.employee')
- emp_id = data['form']['emp_id']
- from osv.osv import except_osv
- try:
- success = emp_obj.attendance_action_change(cr, uid, [emp_id], type = 'sign_in' ,dt=data['form']['date'] or False)
- except except_osv, e:
- raise wizard.except_wizard(e.name, e.value)
- return {}
-
-def _write(self, cr, uid, data, emp_id, context):
- timesheet_obj = pooler.get_pool(cr.dbname).get('hr.analytic.timesheet')
- hour = (time.mktime(time.strptime(data['form']['date'] or time.strftime('%Y-%m-%d %H:%M:%S'), '%Y-%m-%d %H:%M:%S')) -
- time.mktime(time.strptime(data['form']['date_start'], '%Y-%m-%d %H:%M:%S'))) / 3600.0
- minimum = data['form']['analytic_amount']
- if minimum:
- hour = round(round((hour + minimum / 2) / minimum) * minimum, 2)
- res = timesheet_obj.default_get(cr, uid, ['product_id','product_uom_id'])
- if not res['product_uom_id']:
- raise wizard.except_wizard(_('UserError'), _('No cost unit defined for this employee !'))
- up = timesheet_obj.on_change_unit_amount(cr, uid, False, res['product_id'], hour, res['product_uom_id'])['value']
- res['name'] = data['form']['info']
- res['account_id'] = data['form']['account_id']
- res['unit_amount'] = hour
- res.update(up)
- up = timesheet_obj.on_change_account_id(cr, uid, [], res['account_id']).get('value', {})
- res.update(up)
- return timesheet_obj.create(cr, uid, res, context)
-
-def _sign_out_result_end(self, cr, uid, data, context):
- emp_obj = pooler.get_pool(cr.dbname).get('hr.employee')
- emp_id = data['form']['emp_id']
- emp_obj.attendance_action_change(cr, uid, [emp_id], type='sign_out',dt=data['form']['date'])
- _write(self, cr, uid, data, emp_id, context)
- return {}
-
-def _sign_out_result(self, cr, uid, data, context):
- emp_obj = pooler.get_pool(cr.dbname).get('hr.employee')
- emp_id = data['form']['emp_id']
- emp_obj.attendance_action_change(cr, uid, [emp_id], type='action',dt=data['form']['date'])
- _write(self, cr, uid, data, emp_id, context)
- return {}
-
-def _state_check(self, cr, uid, data, context):
- emp_id = _get_empid(self, cr, uid, data, context)['emp_id']
- # get the latest action (sign_in or out) for this employee
- cr.execute('select action from hr_attendance where employee_id=%s and action in (\'sign_in\',\'sign_out\') order by name desc limit 1', (emp_id,))
- res = (cr.fetchone() or ('sign_out',))[0]
-#TODO: invert sign_in et sign_out
- return res
-
-class wiz_si_so(wizard.interface):
- states = {
- 'init' : {
- 'actions' : [_get_empid],
- 'result' : {'type' : 'choice', 'next_state': _state_check}
- },
- 'sign_out' : { # this means sign_in...
- 'actions' : [_get_empid],
- 'result' : {'type':'form', 'arch':si_form, 'fields' : si_fields, 'state':[('end', 'Cancel'),('si_result', 'Start Working') ] }
- },
- 'si_result' : {
- 'actions' : [_sign_in_result],
- 'result' : {'type':'state', 'state':'end'}
- },
- 'sign_in' : { # this means sign_out...
- 'actions' : [_get_empid2],
- 'result' : {'type':'form', 'arch':so_form, 'fields':so_fields, 'state':[('end', 'Cancel'),('so_result', 'Change Work'),('so_result_end', 'Stop Working') ] }
- },
- 'so_result' : {
- 'actions' : [_sign_out_result],
- 'result' : {'type':'state', 'state':'end'}
- },
- 'so_result_end' : {
- 'actions' : [_sign_out_result_end],
- 'result' : {'type':'state', 'state':'end'}
- },
- }
-wiz_si_so('hr_timesheet.si_so')
-
-
-# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
-
diff --git a/addons/hr_timesheet/wizard/wizard_print_timesheet.py b/addons/hr_timesheet/wizard/wizard_print_timesheet.py
deleted file mode 100644
index ba11d301762..00000000000
--- a/addons/hr_timesheet/wizard/wizard_print_timesheet.py
+++ /dev/null
@@ -1,80 +0,0 @@
-# -*- coding: utf-8 -*-
-##############################################################################
-#
-# OpenERP, Open Source Management Solution
-# Copyright (C) 2004-2010 Tiny SPRL ().
-#
-# This program is free software: you can redistribute it and/or modify
-# it under the terms of the GNU Affero General Public License as
-# published by the Free Software Foundation, either version 3 of the
-# License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# 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 .
-#
-##############################################################################
-
-import datetime
-
-import wizard
-import netsvc
-
-dates_form = '''
-'''
-
-
-dates_form_ro = '''
-'''
-
-dates_fields = {
- 'month': dict(string=u'Month', type='selection', required=True, selection=[(x, datetime.date(2000, x, 1).strftime('%B')) for x in range(1, 13)]),
- 'year': dict(string=u'Year', type=u'integer', required=True),
- 'user_id' : dict(string=u'User', type='many2one', relation='res.users', required=True),
-}
-
-def _get_value(self, cr, uid, data, context):
- today = datetime.date.today()
- return dict(month=today.month, year=today.year, user_id=uid)
-
-class wizard_report(wizard.interface):
- states = {
- 'init': {
- 'actions': [_get_value],
- 'result': {'type':'form', 'arch':dates_form, 'fields':dates_fields, 'state':[ ('end','Cancel','gtk-cancel'),('report','Print','gtk-print')]}
- },
- 'report': {
- 'actions': [],
- 'result': {'type':'print', 'report':'hr.analytical.timesheet', 'state':'end'}
- }
- }
-wizard_report('hr.analytical.timesheet')
-
-class wizard_report_my(wizard.interface):
- states = {
- 'init': {
- 'actions': [_get_value],
- 'result': {'type':'form', 'arch':dates_form_ro, 'fields':dates_fields, 'state':[ ('end','Cancel','gtk-cancel'),('report','Print','gtk-print')]}
- },
- 'report': {
- 'actions': [],
- 'result': {'type':'print', 'report':'hr.analytical.timesheet', 'state':'end'}
- }
- }
-wizard_report_my('hr.analytical.timesheet.my')
-
-
-# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
-
diff --git a/addons/hr_timesheet/wizard/wizard_print_timesheet_users.py b/addons/hr_timesheet/wizard/wizard_print_timesheet_users.py
deleted file mode 100644
index a00ddd00084..00000000000
--- a/addons/hr_timesheet/wizard/wizard_print_timesheet_users.py
+++ /dev/null
@@ -1,56 +0,0 @@
-# -*- coding: utf-8 -*-
-##############################################################################
-#
-# OpenERP, Open Source Management Solution
-# Copyright (C) 2004-2010 Tiny SPRL ().
-#
-# This program is free software: you can redistribute it and/or modify
-# it under the terms of the GNU Affero General Public License as
-# published by the Free Software Foundation, either version 3 of the
-# License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# 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 .
-#
-##############################################################################
-
-import wizard
-import datetime
-
-form='''
-'''
-
-fields = {
- 'month': dict(string=u'Month', type='selection', required=True, selection=[(x, datetime.date(2000, x, 1).strftime('%B')) for x in range(1, 13)]),
- 'year': dict(string=u'Year', type='integer', required=True),
- 'user_ids': dict(string=u'Users', type='many2many', relation='res.users', required=True),
-}
-
-def _get_value(self, cr, uid, data, context):
- today=datetime.date.today()
- return dict(month=today.month, year=today.year)
-
-class wizard_report(wizard.interface):
- states={
- 'init':{
- 'actions':[_get_value],
- 'result':{'type':'form', 'arch':form, 'fields':fields, 'state':[('end','Cancel','gtk-cancel'),('report','Print','gtk-print')]}
- },
- 'report':{
- 'actions':[],
- 'result':{'type':'print', 'report':'hr.analytical.timesheet_users', 'state':'end'}
- }
- }
-wizard_report('hr.analytical.timesheet_users')
-
-# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
-
diff --git a/addons/hr_timesheet_invoice/__openerp__.py b/addons/hr_timesheet_invoice/__openerp__.py
index f335c7dbd77..3f4aecb9d3f 100644
--- a/addons/hr_timesheet_invoice/__openerp__.py
+++ b/addons/hr_timesheet_invoice/__openerp__.py
@@ -39,6 +39,7 @@ reports, eso.""",
'hr_timesheet_invoice_report.xml',
'report/report_analytic_view.xml',
'report/hr_timesheet_invoice_report_view.xml',
+ 'wizard/hr_timesheet_invoice_analytic_cost_ledger_view.xml',
],
'demo_xml': ['hr_timesheet_invoice_demo.xml'],
'installable': True,
diff --git a/addons/hr_timesheet_invoice/hr_timesheet_invoice_report.xml b/addons/hr_timesheet_invoice/hr_timesheet_invoice_report.xml
index 5db8bfeb921..bed54ff7d0d 100644
--- a/addons/hr_timesheet_invoice/hr_timesheet_invoice_report.xml
+++ b/addons/hr_timesheet_invoice/hr_timesheet_invoice_report.xml
@@ -13,7 +13,7 @@
sequence="2" />
-
+
).
#
@@ -15,14 +15,14 @@
# 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 .
#
##############################################################################
import hr_timesheet_invoice_create
import account_analytic_profit
import hr_timesheet_final_invoice_create
-import wizard_account_analytic_cost_ledger_report
+import hr_timesheet_analytic_cost_ledger_report
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
diff --git a/addons/hr_timesheet_invoice/wizard/hr_timesheet_analytic_cost_ledger_report.py b/addons/hr_timesheet_invoice/wizard/hr_timesheet_analytic_cost_ledger_report.py
new file mode 100644
index 00000000000..418aac5edd3
--- /dev/null
+++ b/addons/hr_timesheet_invoice/wizard/hr_timesheet_analytic_cost_ledger_report.py
@@ -0,0 +1,52 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+# OpenERP, Open Source Management Solution
+# Copyright (C) 2004-2010 Tiny SPRL ().
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as
+# published by the Free Software Foundation, either version 3 of the
+# License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# 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 .
+#
+##############################################################################
+import time
+
+from osv import osv, fields
+
+class hr_timesheet_analytic_cost_ledger(osv.osv_memory):
+ _name = 'hr.timesheet.analytic.cost.ledger'
+ _description = 'hr.timesheet.analytic.cost.ledger'
+ _columns = {
+ 'date1': fields.date('Start of period', required=True),
+ 'date2': fields.date('End of period', required=True)
+ }
+ _defaults = {
+ 'date1': lambda *a: time.strftime('%Y-01-01'),
+ 'date2': lambda *a: time.strftime('%Y-%m-%d')
+ }
+ def print_report(self, cr, uid, ids, context=None):
+ if context is None:
+ context = {}
+ datas = {
+ 'ids': 'active_ids' in context and context['active_ids'] or [],
+ 'model': 'account.analytic.account',
+ 'form': self.read(cr, uid, ids)[0]
+ }
+ return {
+ 'type': 'ir.actions.report.xml',
+ 'report_name': 'hr.timesheet.invoice.account.analytic.account.cost_ledger',
+ 'datas': datas,
+ }
+
+hr_timesheet_analytic_cost_ledger()
+
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
\ No newline at end of file
diff --git a/addons/hr_timesheet_invoice/wizard/hr_timesheet_invoice_analytic_cost_ledger_view.xml b/addons/hr_timesheet_invoice/wizard/hr_timesheet_invoice_analytic_cost_ledger_view.xml
new file mode 100644
index 00000000000..c8f9806a309
--- /dev/null
+++ b/addons/hr_timesheet_invoice/wizard/hr_timesheet_invoice_analytic_cost_ledger_view.xml
@@ -0,0 +1,44 @@
+
+
+
+
+
+ Cost Ledger
+ hr.timesheet.analytic.cost.ledger
+ form
+
+
+
+
+
+
+ Cost Ledger
+ ir.actions.act_window
+ hr.timesheet.analytic.cost.ledger
+ form
+ form
+ new
+
+
+
+
+
+ Cost Ledger
+ client_print_multi
+
+ action
+ account.analytic.account
+
+
+
+
\ No newline at end of file
diff --git a/addons/hr_timesheet_invoice/wizard/wizard_account_analytic_cost_ledger_report.py b/addons/hr_timesheet_invoice/wizard/wizard_account_analytic_cost_ledger_report.py
deleted file mode 100644
index 632f7f84268..00000000000
--- a/addons/hr_timesheet_invoice/wizard/wizard_account_analytic_cost_ledger_report.py
+++ /dev/null
@@ -1,52 +0,0 @@
-# -*- coding: utf-8 -*-
-##############################################################################
-#
-# OpenERP, Open Source Management Solution
-# Copyright (C) 2004-2010 Tiny SPRL ().
-#
-# This program is free software: you can redistribute it and/or modify
-# it under the terms of the GNU Affero General Public License as
-# published by the Free Software Foundation, either version 3 of the
-# License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# 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 .
-#
-##############################################################################
-
-import time
-import wizard
-
-dates_form = '''
-'''
-
-dates_fields = {
- 'date1': {'string':'Start of period', 'type':'date', 'required':True, 'default': lambda *a: time.strftime('%Y-01-01')},
- 'date2': {'string':'End of period', 'type':'date', 'required':True, 'default': lambda *a: time.strftime('%Y-%m-%d')},
-}
-
-class wizard_report(wizard.interface):
- states = {
- 'init': {
- 'actions': [],
- 'result': {'type':'form', 'arch':dates_form, 'fields':dates_fields, 'state':[('end','Cancel'),('report','Print')]}
- },
- 'report': {
- 'actions': [],
- 'result': {'type':'print', 'report':'hr.timesheet.invoice.account.analytic.account.cost_ledger', 'state':'end'}
- }
- }
-wizard_report('hr.timesheet.invoice.account.analytic.account.cost_ledger.report')
-
-
-
-# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
-
diff --git a/addons/l10n_ch/invoice.py b/addons/l10n_ch/invoice.py
index 0cd99338041..3d707b3b39e 100755
--- a/addons/l10n_ch/invoice.py
+++ b/addons/l10n_ch/invoice.py
@@ -154,7 +154,7 @@ class account_invoice(osv.osv):
## @param partner_bank_id the partner linked invoice bank
## @return the dict of values with the partner_bank value updated
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):
""" Function that is call when the partner of the invoice is changed
it will retriev and set the good bank partner bank"""
res = super(account_invoice, self).onchange_partner_id(
@@ -175,7 +175,7 @@ class account_invoice(osv.osv):
if type in ('in_invoice', 'in_refund'):
res['value']['partner_bank'] = bank_id
- if partner_bank_id != bank_id:
+ if partner_bank != bank_id:
to_update = self.onchange_partner_bank(cr, uid, ids, bank_id)
res['value'].update(to_update['value'])
return res
diff --git a/addons/l10n_chart_uk_minimal/i18n/oc.po b/addons/l10n_chart_uk_minimal/i18n/oc.po
index acadaf67691..7697bdc53cf 100644
--- a/addons/l10n_chart_uk_minimal/i18n/oc.po
+++ b/addons/l10n_chart_uk_minimal/i18n/oc.po
@@ -14,7 +14,7 @@ msgstr ""
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
-"X-Launchpad-Export-Date: 2010-04-20 03:33+0000\n"
+"X-Launchpad-Export-Date: 2010-04-21 04:06+0000\n"
"X-Generator: Launchpad (build Unknown)\n"
#. module: l10n_chart_uk_minimal
diff --git a/addons/mrp/installer.py b/addons/mrp/installer.py
index d595860ba39..361998f50bd 100644
--- a/addons/mrp/installer.py
+++ b/addons/mrp/installer.py
@@ -26,23 +26,23 @@ class mrp_installer(osv.osv_memory):
_columns = {
# Manufacturing Resource Planning
- 'stock_location':fields.boolean('Advanced Routes',
+ 'stock_location': fields.boolean('Advanced Routes',
help="Manages product routes and paths within and between "
"locations (e.g. warehouses)"),
- 'mrp_jit':fields.boolean('Just In Time Scheduling',
+ 'mrp_jit': fields.boolean('Just In Time Scheduling',
help="Enables Just In Time computation of procurement orders."
"\n\nWhile it's more resource intensive than the default "
"setup, the JIT computer avoids having to wait for the "
"procurement scheduler to run or having to run the "
"procurement scheduler manually."),
- 'mrp_operations':fields.boolean('Manufacturing Operations',
+ 'mrp_operations': fields.boolean('Manufacturing Operations',
help="Enhances production orders with readiness states as well "
"as the dates of start and end of execution of the order."),
- 'mrp_subproduct':fields.boolean('MRP Subproducts',
+ 'mrp_subproduct': fields.boolean('MRP Subproducts',
help="Enables multiple product output from a single production "
"order: without this, a productio order can have only one "
"output product."),
- 'mrp_repair':fields.boolean('Repairs',
+ 'mrp_repair': fields.boolean('Repairs',
help="Enables warranty and repair management (and their impact "
"on stocks and invoicing)."),
}
diff --git a/addons/mrp/mrp.py b/addons/mrp/mrp.py
index 8fee7293663..429a3497634 100644
--- a/addons/mrp/mrp.py
+++ b/addons/mrp/mrp.py
@@ -161,15 +161,16 @@ class mrp_bom(osv.osv):
@return: Dictionary of values
"""
result = {}
+ bom_obj = self.pool.get('mrp.bom')
for bom in self.browse(cr, uid, ids, context=context):
result[bom.id] = map(lambda x: x.id, bom.bom_lines)
if bom.bom_lines:
continue
ok = ((name=='child_complete_ids') and (bom.product_id.supply_method=='produce'))
if bom.type=='phantom' or ok:
- sids = self.pool.get('mrp.bom').search(cr, uid, [('bom_id','=',False),('product_id','=',bom.product_id.id)])
+ sids = bom_obj.search(cr, uid, [('bom_id','=',False),('product_id','=',bom.product_id.id)])
if sids:
- bom2 = self.pool.get('mrp.bom').browse(cr, uid, sids[0], context=context)
+ bom2 = bom_obj.browse(cr, uid, sids[0], context=context)
result[bom.id] += map(lambda x: x.id, bom2.bom_lines)
return result
@@ -182,13 +183,13 @@ class mrp_bom(osv.osv):
"""
res = dict(map(lambda x: (x,''), ids))
for line in self.browse(cr, uid, ids):
- if line.type=='phantom' and not line.bom_id:
+ if line.type == 'phantom' and not line.bom_id:
res[line.id] = 'set'
continue
- if line.bom_lines or line.type=='phantom':
+ if line.bom_lines or line.type == 'phantom':
continue
- if line.product_id.supply_method=='produce':
- if line.product_id.procure_method=='make_to_stock':
+ if line.product_id.supply_method == 'produce':
+ if line.product_id.procure_method == 'make_to_stock':
res[line.id] = 'stock'
else:
res[line.id] = 'order'
@@ -223,7 +224,6 @@ class mrp_bom(osv.osv):
'child_complete_ids': fields.function(_child_compute,relation='mrp.bom', method=True, string="BoM Hierarchy", type='many2many'),
'company_id': fields.many2one('res.company','Company',required=True),
'multi_level_bom': fields.boolean('Multi-level BoM'),
-
}
_defaults = {
'active': lambda *a: 1,
@@ -261,8 +261,8 @@ class mrp_bom(osv.osv):
@return: Dictionary of changed values
"""
if product_id:
- prod=self.pool.get('product.product').browse(cr,uid,[product_id])[0]
- v = {'product_uom':prod.uom_id.id}
+ prod = self.pool.get('product.product').browse(cr, uid, [product_id])[0]
+ v = {'product_uom': prod.uom_id.id}
if not name:
v['name'] = prod.name
return {'value': v}
@@ -285,8 +285,8 @@ class mrp_bom(osv.osv):
prop = 0
for prop_id in bom.property_ids:
if prop_id.id in properties:
- prop+=1
- if (prop>max_prop) or ((max_prop==0) and not result):
+ prop += 1
+ if (prop > max_prop) or ((max_prop == 0) and not result):
result = bom.id
max_prop = prop
return result
@@ -303,20 +303,20 @@ class mrp_bom(osv.osv):
"""
factor = factor / (bom.product_efficiency or 1.0)
factor = rounding(factor, bom.product_rounding)
- if factor'internal':
+ if routing_loc.usage <> 'internal':
pick_type = 'out'
address_id = routing_loc.address_id and routing_loc.address_id.id or False
routing_loc = routing_loc.id
- pick_name = seq_obj.get(cr, uid, 'stock.picking.'+pick_type)
+ pick_name = seq_obj.get(cr, uid, 'stock.picking.' + pick_type)
picking_id = pick_obj.create(cr, uid, {
'name': pick_name,
- 'origin': (production.origin or '').split(':')[0] +':'+production.name,
+ 'origin': (production.origin or '').split(':')[0] + ':' + production.name,
'type': pick_type,
'move_type': 'one',
'state': 'auto',
@@ -867,7 +870,7 @@ class mrp_production(osv.osv):
source = production.product_id.product_tmpl_id.property_stock_production.id
data = {
- 'name':'PROD:'+production.name,
+ 'name':'PROD:' + production.name,
'date_planned': production.date_planned,
'product_id': production.product_id.id,
'product_qty': production.product_qty,
@@ -885,11 +888,11 @@ class mrp_production(osv.osv):
self.write(cr, uid, [production.id], {'move_created_ids': [(6, 0, [res_final_id])]})
moves = []
for line in production.product_lines:
- move_id=False
+ move_id = False
newdate = production.date_planned
if line.product_id.type in ('product', 'consu'):
res_dest_id = move_obj.create(cr, uid, {
- 'name':'PROD:'+production.name,
+ 'name':'PROD:' + production.name,
'date_planned': production.date_planned,
'product_id': line.product_id.id,
'product_qty': line.product_qty,
@@ -904,7 +907,7 @@ class mrp_production(osv.osv):
})
moves.append(res_dest_id)
move_id = move_obj.create(cr, uid, {
- 'name':'PROD:'+production.name,
+ 'name':'PROD:' + production.name,
'picking_id':picking_id,
'product_id': line.product_id.id,
'product_qty': line.product_qty,
@@ -932,12 +935,10 @@ class mrp_production(osv.osv):
'move_id': move_id,
'company_id': production.company_id.id,
})
- wf_service = netsvc.LocalService("workflow")
wf_service.trg_validate(uid, 'mrp.procurement', proc_id, 'button_confirm', cr)
proc_ids.append(proc_id)
- wf_service = netsvc.LocalService("workflow")
wf_service.trg_validate(uid, 'stock.picking', picking_id, 'button_confirm', cr)
- self.write(cr, uid, [production.id], {'picking_id':picking_id, 'move_lines': [(6,0,moves)], 'state':'confirmed'})
+ self.write(cr, uid, [production.id], {'picking_id': picking_id, 'move_lines': [(6,0,moves)], 'state':'confirmed'})
return picking_id
def force_production(self, cr, uid, ids, *args):
@@ -955,6 +956,7 @@ class mrp_production_workcenter_line(osv.osv):
_name = 'mrp.production.workcenter.line'
_description = 'Work Orders'
_order = 'sequence'
+
_columns = {
'name': fields.char('Work Order', size=64, required=True),
'workcenter_id': fields.many2one('mrp.workcenter', 'Work Center', required=True),
@@ -973,6 +975,7 @@ mrp_production_workcenter_line()
class mrp_production_product_line(osv.osv):
_name = 'mrp.production.product.line'
_description = 'Production scheduled products'
+
_columns = {
'name': fields.char('Name', size=64, required=True),
'product_id': fields.many2one('product.product', 'Product', required=True),
@@ -998,6 +1001,7 @@ class mrp_procurement(osv.osv):
_name = "mrp.procurement"
_description = "Procurement"
_order = 'priority,date_planned'
+
_columns = {
'name': fields.char('Reason', size=64, required=True, help='Procurement name.'),
'origin': fields.char('Source Document', size=64,
@@ -1038,7 +1042,7 @@ class mrp_procurement(osv.osv):
('waiting','Waiting')], 'State', required=True,
help='When a procurement is created the state is set to \'Draft\'.\n If the procurement is confirmed, the state is set to \'Confirmed\'.\
\nAfter confirming the state is set to \'Running\'.\n If any exception arises in the order then the state is set to \'Exception\'.\n Once the exception is removed the state becomes \'Ready\'.\n It is in \'Waiting\'. state when the procurement is waiting for another one to finish.'),
- 'note' : fields.text('Note'),
+ 'note': fields.text('Note'),
'company_id': fields.many2one('res.company','Company',required=True),
}
_defaults = {
@@ -1047,7 +1051,7 @@ class mrp_procurement(osv.osv):
'date_planned': lambda *a: time.strftime('%Y-%m-%d %H:%M:%S'),
'close_move': lambda *a: 0,
'procure_method': lambda *a: 'make_to_order',
- 'company_id': lambda self,cr,uid,c: self.pool.get('res.company')._company_default_get(cr, uid, 'mrp.procurement', context=c)
+ 'company_id': lambda self, cr, uid, c: self.pool.get('res.company')._company_default_get(cr, uid, 'mrp.procurement', context=c)
}
def unlink(self, cr, uid, ids, context=None):
@@ -1066,10 +1070,10 @@ class mrp_procurement(osv.osv):
@return: Dictionary of values.
"""
if product_id:
- w=self.pool.get('product.product').browse(cr,uid,product_id, context)
+ w = self.pool.get('product.product').browse(cr, uid, product_id, context)
v = {
- 'product_uom':w.uom_id.id,
- 'product_uos':w.uos_id and w.uos_id.id or w.uom_id.id
+ 'product_uom': w.uom_id.id,
+ 'product_uos': w.uos_id and w.uos_id.id or w.uom_id.id
}
return {'value': v}
return {}
@@ -1092,7 +1096,7 @@ class mrp_procurement(osv.osv):
for procurement in self.browse(cr, uid, ids, context):
if procurement.move_id:
ok = True
- if not procurement.move_id.state=='cancel':
+ if not procurement.move_id.state == 'cancel':
res = False
return res and ok
@@ -1103,7 +1107,7 @@ class mrp_procurement(osv.osv):
res = True
for proc in self.browse(cr, uid, ids, context):
if proc.move_id:
- if not proc.move_id.state=='done':
+ if not proc.move_id.state == 'done':
res = False
return res
@@ -1116,7 +1120,7 @@ class mrp_procurement(osv.osv):
@param proc: Current procurement.
@return: Quantity or False.
"""
- if proc.product_id.type=='product':
+ if proc.product_id.type == 'product':
if proc.move_id.product_uos:
return proc.move_id.product_uos_qty
return False
@@ -1126,7 +1130,7 @@ class mrp_procurement(osv.osv):
@param proc: Current procurement.
@return: UoS or False.
"""
- if proc.product_id.type=='product':
+ if proc.product_id.type == 'product':
if proc.move_id.product_uos:
return proc.move_id.product_uos.id
return False
@@ -1160,7 +1164,7 @@ class mrp_procurement(osv.osv):
@return: True or False
"""
for procurement in self.browse(cr, uid, ids, context=context):
- if procurement.move_id and procurement.move_id.state=='auto':
+ if procurement.move_id and procurement.move_id.state == 'auto':
return True
return False
@@ -1185,7 +1189,7 @@ class mrp_procurement(osv.osv):
"""
ok = True
for procurement in self.browse(cr, uid, ids, context=context):
- if procurement.product_id.type=='service':
+ if procurement.product_id.type == 'service':
ok = ok and self._check_make_to_stock_service(cr, uid, procurement, context)
else:
ok = ok and self._check_make_to_stock_product(cr, uid, procurement, context)
@@ -1198,7 +1202,7 @@ class mrp_procurement(osv.osv):
res = True
user = self.pool.get('res.users').browse(cr, uid, uid)
for procurement in self.browse(cr, uid, ids):
- if procurement.product_id.product_tmpl_id.supply_method<>'produce':
+ if procurement.product_id.product_tmpl_id.supply_method <> 'produce':
if procurement.product_id.seller_ids:
partner = procurement.product_id.seller_ids[0].name
if user.company_id and user.company_id.partner_id:
@@ -1220,7 +1224,7 @@ class mrp_procurement(osv.osv):
user = self.pool.get('res.users').browse(cr, uid, uid)
partner_obj = self.pool.get('res.partner')
for procurement in self.browse(cr, uid, ids):
- if procurement.product_id.product_tmpl_id.supply_method<>'buy':
+ if procurement.product_id.product_tmpl_id.supply_method <> 'buy':
return False
if not procurement.product_id.seller_ids:
cr.execute('update mrp_procurement set message=%s where id=%s', (_('No supplier defined for this product !'), procurement.id))
@@ -1240,7 +1244,7 @@ class mrp_procurement(osv.osv):
@return: True or False
"""
for record in self.browse(cr, uid, ids):
- if record.move_id and record.move_id.state=='cancel':
+ if record.move_id and record.move_id.state == 'cancel':
return True
return False
@@ -1255,32 +1259,32 @@ class mrp_procurement(osv.osv):
if procurement.product_id.type in ('product', 'consu'):
if not procurement.move_id:
source = procurement.location_id.id
- if procurement.procure_method=='make_to_order':
+ if procurement.procure_method == 'make_to_order':
source = procurement.product_id.product_tmpl_id.property_stock_procurement.id
id = move_obj.create(cr, uid, {
- 'name': 'PROC:'+procurement.name,
+ 'name': 'PROC:' + procurement.name,
'location_id': source,
'location_dest_id': procurement.location_id.id,
'product_id': procurement.product_id.id,
- 'product_qty':procurement.product_qty,
+ 'product_qty': procurement.product_qty,
'product_uom': procurement.product_uom.id,
'date_planned': procurement.date_planned,
- 'state':'confirmed',
+ 'state': 'confirmed',
'company_id': procurement.company_id.id,
})
- self.write(cr, uid, [procurement.id], {'move_id': id, 'close_move':1})
+ 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',):
+ 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':''})
+ self.write(cr, uid, ids, {'state': 'confirmed', 'message': ''})
return True
def action_move_assigned(self, cr, uid, ids, context={}):
""" Changes procurement state to Running and writes message.
@return: True
"""
- self.write(cr, uid, ids, {'state':'running','message':_('from stock: products assigned.')})
+ self.write(cr, uid, ids, {'state': 'running', 'message': _('from stock: products assigned.')})
return True
def _check_make_to_stock_service(self, cr, uid, procurement, context={}):
@@ -1306,7 +1310,7 @@ class mrp_procurement(osv.osv):
@return: True
"""
for procurement in self.browse(cr, uid, ids):
- self.write(cr, uid, [procurement.id], {'state':'running'})
+ self.write(cr, uid, [procurement.id], {'state': 'running'})
return True
def action_produce_assign_product(self, cr, uid, ids, context={}):
@@ -1346,12 +1350,12 @@ class mrp_procurement(osv.osv):
'company_id': procurement.company_id.id,
})
res[procurement.id] = produce_id
- self.write(cr, uid, [procurement.id], {'state':'running'})
+ self.write(cr, uid, [procurement.id], {'state': 'running'})
bom_result = production_obj.action_compute(cr, uid,
[produce_id], properties=[x.id for x in procurement.property_ids])
wf_service.trg_validate(uid, 'mrp.production', produce_id, 'button_confirm', cr)
move_obj.write(cr, uid, [res_id],
- {'location_id':procurement.location_id.id})
+ {'location_id': procurement.location_id.id})
return res
def action_po_assign(self, cr, uid, ids, context={}):
@@ -1385,7 +1389,7 @@ class mrp_procurement(osv.osv):
qty = uom_obj._compute_qty(cr, uid, procurement.product_uom.id, procurement.product_qty, uom_id)
if procurement.product_id.seller_ids[0].qty:
- qty=max(qty,procurement.product_id.seller_ids[0].qty)
+ qty = max(qty,procurement.product_id.seller_ids[0].qty)
price = pricelist_obj.price_get(cr, uid, [pricelist_id], procurement.product_id.id, qty, False, {'uom': uom_id})[pricelist_id]
@@ -1394,9 +1398,9 @@ class mrp_procurement(osv.osv):
newdate = newdate - procurement.product_id.seller_ids[0].delay
#Passing partner_id to context for purchase order line integrity of Line name
- context.update({'lang':partner.lang, 'partner_id':partner_id})
+ context.update({'lang': partner.lang, 'partner_id': partner_id})
- product = prod_obj.browse(cr,uid,procurement.product_id.id,context=context)
+ product = prod_obj.browse(cr, uid, procurement.product_id.id, context=context)
line = {
'name': product.partner_ref,
@@ -1406,13 +1410,13 @@ class mrp_procurement(osv.osv):
'price_unit': price,
'date_planned': newdate.strftime('%Y-%m-%d %H:%M:%S'),
'move_dest_id': res_id,
- 'notes':product.description_purchase,
+ 'notes': product.description_purchase,
}
taxes_ids = procurement.product_id.product_tmpl_id.supplier_taxes_id
taxes = acc_pos_obj.map_tax(cr, uid, partner.property_account_position, taxes_ids)
line.update({
- 'taxes_id':[(6,0,taxes)]
+ 'taxes_id': [(6,0,taxes)]
})
purchase_id = po_obj.create(cr, uid, {
'origin': procurement.origin,
@@ -1425,7 +1429,7 @@ class mrp_procurement(osv.osv):
'fiscal_position': partner.property_account_position and partner.property_account_position.id or False
})
res[procurement.id] = purchase_id
- self.write(cr, uid, [procurement.id], {'state':'running', 'purchase_id':purchase_id})
+ self.write(cr, uid, [procurement.id], {'state': 'running', 'purchase_id': purchase_id})
return res
def action_cancel(self, cr, uid, ids):
@@ -1437,16 +1441,16 @@ class mrp_procurement(osv.osv):
move_obj = self.pool.get('stock.move')
for proc in self.browse(cr, uid, ids):
if proc.close_move:
- if proc.move_id.state not in ('done','cancel'):
+ if proc.move_id.state not in ('done', 'cancel'):
todo2.append(proc.move_id.id)
else:
- if proc.move_id and proc.move_id.state=='waiting':
+ if proc.move_id and proc.move_id.state == 'waiting':
todo.append(proc.move_id.id)
if len(todo2):
move_obj.action_cancel(cr, uid, todo2)
if len(todo):
- move_obj.write(cr, uid, todo, {'state':'assigned'})
- self.write(cr, uid, ids, {'state':'cancel'})
+ move_obj.write(cr, uid, todo, {'state': 'assigned'})
+ self.write(cr, uid, ids, {'state': 'cancel'})
wf_service = netsvc.LocalService("workflow")
for id in ids:
wf_service.trg_trigger(uid, 'mrp.procurement', id, cr)
@@ -1461,7 +1465,7 @@ class mrp_procurement(osv.osv):
"""
ok = False
for procurement in self.browse(cr, uid, ids):
- if procurement.move_id.state=='assigned' or procurement.move_id.state=='done':
+ if procurement.move_id.state == 'assigned' or procurement.move_id.state == 'done':
self.action_done(cr, uid, [procurement.id])
ok = True
return ok
@@ -1470,7 +1474,7 @@ class mrp_procurement(osv.osv):
""" Changes procurement state to Ready.
@return: True
"""
- res = self.write(cr, uid, ids, {'state':'ready'})
+ res = self.write(cr, uid, ids, {'state': 'ready'})
return res
def action_done(self, cr, uid, ids):
@@ -1482,7 +1486,7 @@ class mrp_procurement(osv.osv):
if procurement.move_id:
if procurement.close_move and (procurement.move_id.state <> 'done'):
move_obj.action_done(cr, uid, [procurement.move_id.id])
- res = self.write(cr, uid, ids, {'state':'done', 'date_close':time.strftime('%Y-%m-%d')})
+ res = self.write(cr, uid, ids, {'state': 'done', 'date_close': time.strftime('%Y-%m-%d')})
wf_service = netsvc.LocalService("workflow")
for id in ids:
wf_service.trg_trigger(uid, 'mrp.procurement', id, cr)
diff --git a/addons/mrp/mrp_view.xml b/addons/mrp/mrp_view.xml
index 3432635cbe8..6e7a1afb6dc 100644
--- a/addons/mrp/mrp_view.xml
+++ b/addons/mrp/mrp_view.xml
@@ -864,6 +864,7 @@
+
diff --git a/addons/mrp/product.py b/addons/mrp/product.py
index 30e5a911dba..6a73063e591 100644
--- a/addons/mrp/product.py
+++ b/addons/mrp/product.py
@@ -27,13 +27,9 @@ class product_product(osv.osv):
_inherit = "product.product"
def get_product_accounts(self, cr, uid, product_id, context={}):
-
- """
- To get the stock input account, stock output account and stock journal related to product.
-
- @param product_id : product id
- @return: dictionary which contains information regarding stock input account, stock output account and stock journal
-
+ """ To get the stock input account, stock output account and stock journal related to product.
+ @param product_id: product id
+ @return: dictionary which contains information regarding stock input account, stock output account and stock journal
"""
product_obj = self.pool.get('product.product').browse(cr, uid, product_id, False)
@@ -55,14 +51,10 @@ class product_product(osv.osv):
return res
def do_change_standard_price(self, cr, uid, ids, datas, context={}):
- """
- Changes the Standard Price of Product and parent products and creates an account move accordingly.
-
- @param datas : dict. contain default datas like new_price, stock_output_account, stock_input_account, stock_journal
- @param context: A standard dictionary
-
- @return:
-
+ """ Changes the Standard Price of Product and parent products and creates an account move accordingly.
+ @param datas: dict. contain default datas like new_price, stock_output_account, stock_input_account, stock_journal
+ @param context: A standard dictionary
+ @return:
"""
#TODO : TO Check
res = super(product_product, self).do_change_standard_price(cr, uid, ids, datas, context=context)
@@ -73,15 +65,15 @@ class product_product(osv.osv):
if bom.bom_id.bom_lines :
for bom_line in bom.bom_id.bom_lines :
prod_price = self.read(cr, uid, bom_line.product_id.id, ['standard_price'])['standard_price']
- price += bom_line.product_qty * prod_price
+ price += bom_line.product_qty * prod_price
- accounts = self.get_product_accounts(cr, uid, bom.bom_id.product_id.id , context)
+ accounts = self.get_product_accounts(cr, uid, bom.bom_id.product_id.id, context)
datas = {
- 'new_price' : price,
- 'stock_output_account' : accounts['stock_account_output'],
- 'stock_input_account' : accounts['stock_account_input'],
- 'stock_journal' : accounts['stock_journal']
+ 'new_price': price,
+ 'stock_output_account': accounts['stock_account_output'],
+ 'stock_input_account': accounts['stock_account_input'],
+ 'stock_journal': accounts['stock_journal']
}
super(product_product, self).do_change_standard_price(cr, uid, [bom.bom_id.product_id.id], datas, context)
_compute_price(bom.bom_id)
diff --git a/addons/mrp/schedulers.py b/addons/mrp/schedulers.py
index f857f01dba7..cc482d95c52 100644
--- a/addons/mrp/schedulers.py
+++ b/addons/mrp/schedulers.py
@@ -60,7 +60,7 @@ class mrp_procurement(osv.osv):
cr.execute('select id from mrp_procurement where state=%s and procure_method=%s order by priority,date_planned limit 500 offset %s', ('confirmed', 'make_to_order', offset))
ids = map(lambda x: x[0], cr.fetchall())
for proc in procurement_obj.browse(cr, uid, ids):
- if (maxdate.strftime('%Y-%m-%d')>=proc.date_planned):
+ if (maxdate.strftime('%Y-%m-%d') >= proc.date_planned):
wf_service.trg_validate(uid, 'mrp.procurement', proc.id, 'button_check', cr)
else:
offset += 1
@@ -81,7 +81,7 @@ class mrp_procurement(osv.osv):
ids = []
while True:
report_ids = []
- ids = self.pool.get('mrp.procurement').search(cr, uid, [('state', '=', 'confirmed'), ('procure_method', '=', 'make_to_stock')], offset=offset)
+ ids = procurement_obj.search(cr, uid, [('state', '=', 'confirmed'), ('procure_method', '=', 'make_to_stock')], offset=offset)
for proc in procurement_obj.browse(cr, uid, ids):
if ((maxdate).strftime('%Y-%m-%d') >= proc.date_planned) :
wf_service.trg_validate(uid, 'mrp.procurement', proc.id, 'button_check', cr)
@@ -140,7 +140,7 @@ class mrp_procurement(osv.osv):
for warehouse in warehouse_obj.browse(cr, uid, warehouse_ids, context=context):
context['warehouse'] = warehouse
- for product in self.pool.get('product.product').browse(cr, uid, products_id, context=context):
+ for product in product_obj.browse(cr, uid, products_id, context=context):
if product.virtual_available >= 0.0:
continue
diff --git a/addons/mrp/stock.py b/addons/mrp/stock.py
index 0fc6a0ddc89..21cfac88242 100644
--- a/addons/mrp/stock.py
+++ b/addons/mrp/stock.py
@@ -34,6 +34,7 @@ class stock_warehouse_orderpoint(osv.osv):
"""
_name = "stock.warehouse.orderpoint"
_description = "Orderpoint minimum 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."),
@@ -59,28 +60,31 @@ class stock_warehouse_orderpoint(osv.osv):
'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)
+ 'company_id': lambda self, cr, uid, c: self.pool.get('res.company')._company_default_get(cr, uid, 'stock.warehouse.orderpoint', context=c)
}
+
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}
+ 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}
+ 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 = {}
@@ -88,14 +92,17 @@ class stock_warehouse_orderpoint(osv.osv):
'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'
+
_columns = {
'production_id': fields.many2one('mrp.production', 'Production', select=True),
'procurements': fields.one2many('mrp.procurement', 'move_id', 'Procurements'),
}
+
def copy(self, cr, uid, id, default=None, context=None):
default = default or {}
default['procurements'] = []
@@ -106,19 +113,24 @@ class StockMove(osv.osv):
@param move: Stock moves
@return: True
"""
- if move.product_id.supply_method=='produce' and move.product_id.procure_method=='make_to_order':
- bis = self.pool.get('mrp.bom').search(cr, uid, [
+ bom_obj = self.pool.get('mrp.bom')
+ move_obj = self.pool.get('stock.move')
+ procurement_obj = self.pool.get('mrp.procurement')
+ product_obj = self.pool.get('product.product')
+ wf_service = netsvc.LocalService("workflow")
+ if move.product_id.supply_method == 'produce' and move.product_id.procure_method == 'make_to_order':
+ bis = bom_obj.search(cr, uid, [
('product_id','=',move.product_id.id),
('bom_id','=',False),
('type','=','phantom')])
if bis:
factor = move.product_qty
- bom_point = self.pool.get('mrp.bom').browse(cr, uid, bis[0])
- res = self.pool.get('mrp.bom')._bom_explode(cr, uid, bom_point, factor, [])
+ bom_point = bom_obj.browse(cr, uid, bis[0])
+ res = bom_obj._bom_explode(cr, uid, bom_point, factor, [])
dest = move.product_id.product_tmpl_id.property_stock_production.id
state = 'confirmed'
- if move.state=='assigned':
- state='assigned'
+ if move.state == 'assigned':
+ state = 'assigned'
for line in res[0]:
valdef = {
'picking_id': move.picking_id.id,
@@ -135,9 +147,9 @@ class StockMove(osv.osv):
'move_history_ids2': [(6,0,[])],
'procurements': [],
}
- mid = self.pool.get('stock.move').copy(cr, uid, move.id, default=valdef)
- prodobj = self.pool.get('product.product').browse(cr, uid, line['product_id'], context=context)
- proc_id = self.pool.get('mrp.procurement').create(cr, uid, {
+ mid = move_obj.copy(cr, uid, move.id, default=valdef)
+ prodobj = product_obj.browse(cr, uid, line['product_id'], context=context)
+ proc_id = procurement_obj.create(cr, uid, {
'name': (move.picking_id.origin or ''),
'origin': (move.picking_id.origin or ''),
'date_planned': move.date_planned,
@@ -151,21 +163,18 @@ class StockMove(osv.osv):
'move_id': mid,
'company_id': line['company_id'],
})
- wf_service = netsvc.LocalService("workflow")
wf_service.trg_validate(uid, 'mrp.procurement', proc_id, 'button_confirm', cr)
- self.pool.get('stock.move').write(cr, uid, [move.id], {
+ move_obj.write(cr, uid, [move.id], {
'location_id': move.location_dest_id.id,
'auto_validate': True,
'picking_id': False,
'location_id': dest,
'state': 'waiting'
})
- for m in self.pool.get('mrp.procurement').search(cr, uid, [('move_id','=',move.id)], context):
- wf_service = netsvc.LocalService("workflow")
+ for m in procurement_obj.search(cr, uid, [('move_id','=',move.id)], context):
wf_service.trg_validate(uid, 'mrp.procurement', m, 'button_wait_done', cr)
return True
-
def action_consume(self, cr, uid, ids, product_qty, location_id=False, context=None):
""" Consumed product with specific quatity from specific source location.
@param product_qty: Consumed product quantity
@@ -232,8 +241,9 @@ class StockPicking(osv.osv):
@param *args: Arguments
@return: Picking ids.
"""
- for move in self.pool.get('stock.move').browse(cr, uid, picks):
- self.pool.get('stock.move')._action_explode(cr, uid, move)
+ move_obj = self.pool.get('stock.move')
+ for move in move_obj.browse(cr, uid, picks):
+ move_obj._action_explode(cr, uid, move)
return picks
StockPicking()
@@ -241,6 +251,7 @@ StockPicking()
class spilt_in_production_lot(osv.osv_memory):
_inherit = "stock.move.split"
+
def split(self, cr, uid, ids, move_ids, context=None):
""" Splits move lines into given quantities.
@param move_ids: Stock moves.
@@ -255,5 +266,6 @@ class spilt_in_production_lot(osv.osv_memory):
for new_move in new_moves:
production_obj.write(cr, uid, production_ids, {'move_lines': [(4, new_move)]})
return res
+
spilt_in_production_lot()
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
diff --git a/addons/mrp_operations/mrp_operations.py b/addons/mrp_operations/mrp_operations.py
index 8a6efa625bb..46e1dec1e12 100644
--- a/addons/mrp_operations/mrp_operations.py
+++ b/addons/mrp_operations/mrp_operations.py
@@ -187,7 +187,17 @@ class mrp_production(osv.osv):
for workcenter_line in obj.workcenter_lines:
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):
+ """ Changes state to In Production and writes starting date.
+ @return: True
+ """
+ obj = self.browse(cr, uid, ids)[0]
+ workcenter_line_obj = self.pool.get('mrp.production.workcenter.line')
+ for workcenter_line in obj.workcenter_lines:
+ workcenter_line_obj.action_start_working(cr, uid, [workcenter_line.id])
+ return super(mrp_production,self).action_in_production(cr, uid, ids)
+
def action_cancel(self, cr, uid, ids):
obj=self.browse(cr,uid,ids)[0]
for workcenter_line in obj.workcenter_lines:
diff --git a/addons/mrp_repair/mrp_repair.py b/addons/mrp_repair/mrp_repair.py
index e456c3770d2..f59da6a751c 100644
--- a/addons/mrp_repair/mrp_repair.py
+++ b/addons/mrp_repair/mrp_repair.py
@@ -33,8 +33,18 @@ class mrp_repair(osv.osv):
_description = 'Repairs Order'
def _amount_untaxed(self, cr, uid, ids, field_name, arg, context):
+ """ Calculates untaxed amount.
+ @param self: The object pointer
+ @param cr: The current row, from the database cursor,
+ @param uid: The current user ID for security checks
+ @param ids: List of selected IDs
+ @param field_name: Name of field.
+ @param arg: Argument
+ @param context: A standard dictionary for contextual values
+ @return: Dictionary of values.
+ """
res = {}
- cur_obj=self.pool.get('res.currency')
+ cur_obj = self.pool.get('res.currency')
for repair in self.browse(cr, uid, ids):
res[repair.id] = 0.0
for line in repair.operations:
@@ -46,35 +56,46 @@ class mrp_repair(osv.osv):
return res
def _amount_tax(self, cr, uid, ids, field_name, arg, context):
+ """ Calculates taxed amount.
+ @param field_name: Name of field.
+ @param arg: Argument
+ @return: Dictionary of values.
+ """
res = {}
- cur_obj=self.pool.get('res.currency')
+ cur_obj = self.pool.get('res.currency')
+ tax_obj = self.pool.get('account.tax')
for repair in self.browse(cr, uid, ids):
val = 0.0
- cur=repair.pricelist_id.currency_id
+ cur = repair.pricelist_id.currency_id
for line in repair.operations:
if line.to_invoice:
- for c in self.pool.get('account.tax').compute(cr, uid, line.tax_id, line.price_unit, line.product_uom_qty, repair.partner_invoice_id.id, line.product_id, repair.partner_id):
- val+= c['amount']
+ for c in tax_obj.compute(cr, uid, line.tax_id, line.price_unit, line.product_uom_qty, repair.partner_invoice_id.id, line.product_id, repair.partner_id):
+ val += c['amount']
for line in repair.fees_lines:
if line.to_invoice:
- for c in self.pool.get('account.tax').compute(cr, uid, line.tax_id, line.price_unit, line.product_uom_qty, repair.partner_invoice_id.id, line.product_id, repair.partner_id):
- val+= c['amount']
- res[repair.id]=cur_obj.round(cr, uid, cur, val)
+ for c in tax_obj.compute(cr, uid, line.tax_id, line.price_unit, line.product_uom_qty, repair.partner_invoice_id.id, line.product_id, repair.partner_id):
+ val += c['amount']
+ res[repair.id] = cur_obj.round(cr, uid, cur, val)
return res
def _amount_total(self, cr, uid, ids, field_name, arg, context):
+ """ Calculates total amount.
+ @param field_name: Name of field.
+ @param arg: Argument
+ @return: Dictionary of values.
+ """
res = {}
untax = self._amount_untaxed(cr, uid, ids, field_name, arg, context)
tax = self._amount_tax(cr, uid, ids, field_name, arg, context)
- cur_obj=self.pool.get('res.currency')
+ cur_obj = self.pool.get('res.currency')
for id in ids:
- repair=self.browse(cr, uid, [id])[0]
- cur=repair.pricelist_id.currency_id
+ repair = self.browse(cr, uid, [id])[0]
+ cur = repair.pricelist_id.currency_id
res[id] = cur_obj.round(cr, uid, cur, untax.get(id, 0.0) + tax.get(id, 0.0))
return res
_columns = {
- 'name' : fields.char('Repair Reference',size=24, required=True),
+ 'name': fields.char('Repair Reference',size=24, required=True),
'product_id': fields.many2one('product.product', string='Product to Repair', required=True, readonly=True, states={'draft':[('readonly',False)]}),
'partner_id' : fields.many2one('res.partner', 'Partner', select=True, help='This field allow you to choose the parner that will be invoiced and delivered'),
'address_id': fields.many2one('res.partner.address', 'Delivery Address', domain="[('partner_id','=',partner_id)]"),
@@ -110,12 +131,12 @@ class mrp_repair(osv.osv):
select=True, required=True, states={'draft':[('readonly',False)]}, readonly=True, help='This field allow you to change the workflow of the repair order. If value selected is different from \'No Invoice\', it also allow you to select the pricelist and invoicing address.'),
'invoice_id': fields.many2one('account.invoice', 'Invoice', readonly=True),
'picking_id': fields.many2one('stock.picking', 'Picking',readonly=True),
- 'fees_lines' : fields.one2many('mrp.repair.fee', 'repair_id', 'Fees Lines', readonly=True, states={'draft':[('readonly',False)]}),
- 'internal_notes' : fields.text('Internal Notes'),
- 'quotation_notes' : fields.text('Quotation Notes'),
+ 'fees_lines': fields.one2many('mrp.repair.fee', 'repair_id', 'Fees Lines', readonly=True, states={'draft':[('readonly',False)]}),
+ 'internal_notes': fields.text('Internal Notes'),
+ 'quotation_notes': fields.text('Quotation Notes'),
'deliver_bool': fields.boolean('Deliver', help="Check this box if you want to manage the delivery once the product is repaired. If cheked, it will create a picking with selected product. Note that you can select the locations in the Info tab, if you have the extended view."),
'invoiced': fields.boolean('Invoiced', readonly=True),
- 'repaired' : fields.boolean('Repaired', readonly=True),
+ 'repaired': fields.boolean('Repaired', readonly=True),
'amount_untaxed': fields.function(_amount_untaxed, method=True, string='Untaxed Amount'),
'amount_tax': fields.function(_amount_tax, method=True, string='Taxes'),
'amount_total': fields.function(_amount_total, method=True, string='Total'),
@@ -144,6 +165,10 @@ class mrp_repair(osv.osv):
def onchange_product_id(self, cr, uid, ids, product_id=None):
+ """ On change of product sets some values.
+ @param product_id: Changed product
+ @return: Dictionary of values.
+ """
return {'value': {
'prodlot_id': False,
'move_id': False,
@@ -154,6 +179,12 @@ class mrp_repair(osv.osv):
}
def onchange_move_id(self, cr, uid, ids, prod_id=False, move_id=False):
+ """ On change of move id sets values of guarantee limit, source location,
+ destination location, partner and partner address.
+ @param prod_id: Id of product in current record.
+ @param move_id: Changed move.
+ @return: Dictionary of values.
+ """
data = {}
data['value'] = {}
if not prod_id:
@@ -179,15 +210,23 @@ class mrp_repair(osv.osv):
return True
def onchange_partner_id(self, cr, uid, ids, part, address_id):
+ """ On change of partner sets the values of partner address,
+ partner invoice address and pricelist.
+ @param part: Changed id of partner.
+ @param address_id: Address id from current record.
+ @return: Dictionary of values.
+ """
+ part_obj = self.pool.get('res.partner')
+ pricelist_obj = self.pool.get('product.pricelist')
if not part:
return {'value': {
'address_id': False,
'partner_invoice_id': False,
- 'pricelist_id': self.pool.get('product.pricelist').search(cr,uid,[('type','=','sale')])[0]
+ 'pricelist_id': pricelist_obj.search(cr, uid, [('type','=','sale')])[0]
}
}
- addr = self.pool.get('res.partner').address_get(cr, uid, [part], ['delivery', 'invoice', 'default'])
- partner = self.pool.get('res.partner').browse(cr, uid, part)
+ addr = part_obj.address_get(cr, uid, [part], ['delivery', 'invoice', 'default'])
+ partner = part_obj.browse(cr, uid, part)
pricelist = partner.property_product_pricelist and partner.property_product_pricelist.id or False
return {'value': {
'address_id': address_id or addr['delivery'],
@@ -197,6 +236,14 @@ class mrp_repair(osv.osv):
}
def onchange_lot_id(self, cr, uid, ids, lot, product_id):
+ """ On change of production lot sets the values of source location,
+ destination location, move and guarantee limit.
+ @param lot: Changed id of production lot.
+ @param product_id: Product id from current record.
+ @return: Dictionary of values.
+ """
+ prodlot_obj = self.pool.get('stock.production.lot')
+ move_obj = self.pool.get('stock.move')
data = {}
data['value'] = {
'location_id': False,
@@ -207,8 +254,8 @@ class mrp_repair(osv.osv):
if not lot:
return data
- lot_info = self.pool.get('stock.production.lot').browse(cr, uid, lot)
- move_ids = self.pool.get('stock.move').search(cr, uid, [('prodlot_id', '=', lot)])
+ lot_info = prodlot_obj.browse(cr, uid, lot)
+ move_ids = move_obj.search(cr, uid, [('prodlot_id', '=', lot)])
if not len(move_ids):
return data
@@ -219,13 +266,17 @@ class mrp_repair(osv.osv):
return lst_move
move_id = move_ids[0]
- move = get_last_move(self.pool.get('stock.move').browse(cr, uid, move_id))
+ move = get_last_move(move_obj.browse(cr, uid, move_id))
data['value']['move_id'] = move.id
d = self.onchange_move_id(cr, uid, ids, product_id, move.id)
data['value'].update(d['value'])
return data
def action_cancel_draft(self, cr, uid, ids, *args):
+ """ Cancels repair order when it is in 'Draft' state.
+ @param *arg: Arguments
+ @return: True
+ """
if not len(ids):
return False
mrp_line_obj = self.pool.get('mrp.repair.line')
@@ -238,6 +289,11 @@ class mrp_repair(osv.osv):
return True
def action_confirm(self, cr, uid, ids, *args):
+ """ Repair order state is set to 'To be invoiced' when invoice method
+ is 'Before repair' else state becomes 'Confirmed'.
+ @param *arg: Arguments
+ @return: True
+ """
mrp_line_obj = self.pool.get('mrp.repair.line')
for o in self.browse(cr, uid, ids):
if (o.invoice_method == 'b4repair'):
@@ -248,6 +304,9 @@ class mrp_repair(osv.osv):
return True
def action_cancel(self, cr, uid, ids, context=None):
+ """ Cancels repair order.
+ @return: True
+ """
ok=True
mrp_line_obj = self.pool.get('mrp.repair.line')
for repair in self.browse(cr, uid, ids):
@@ -259,25 +318,33 @@ class mrp_repair(osv.osv):
return self.action_invoice_create(cr, uid, ids)
def action_invoice_create(self, cr, uid, ids, group=False, context=None):
- res={}
+ """ Creates invoice(s) for repair order.
+ @param group: It is set to true when group invoice is to be generated.
+ @return: Invoice Ids.
+ """
+ res = {}
invoices_group = {}
+ inv_line_obj = self.pool.get('account.invoice.line')
+ inv_obj = self.pool.get('account.invoice')
+ repair_line_obj = self.pool.get('mrp.repair.line')
+ repair_fee_obj = self.pool.get('mrp.repair.fee')
for repair in self.browse(cr, uid, ids, context=context):
- res[repair.id]=False
+ res[repair.id] = False
if repair.state in ('draft','cancel') or repair.invoice_id:
continue
if not (repair.partner_id.id and repair.partner_invoice_id.id):
raise osv.except_osv(_('No partner !'),_('You have to select a Partner Invoice Address in the repair form !'))
- comment=repair.quotation_notes
+ comment = repair.quotation_notes
if (repair.invoice_method != 'none'):
if group and repair.partner_invoice_id.id in invoices_group:
- inv_id= invoices_group[repair.partner_invoice_id.id]
- invoice=invoice_obj.browse(cr, uid,inv_id)
+ inv_id = invoices_group[repair.partner_invoice_id.id]
+ invoice = inv_obj.browse(cr, uid, inv_id)
invoice_vals = {
'name': invoice.name +', '+repair.name,
'origin': invoice.origin+', '+repair.name,
'comment':(comment and (invoice.comment and invoice.comment+"\n"+comment or comment)) or (invoice.comment and invoice.comment or ''),
}
- invoice_obj.write(cr, uid, [inv_id],invoice_vals,context=context)
+ invoice_obj.write(cr, uid, [inv_id], invoice_vals, context=context)
else:
a = repair.partner_id.property_account_receivable.id
inv = {
@@ -291,10 +358,9 @@ class mrp_repair(osv.osv):
'comment': repair.quotation_notes,
'fiscal_position': repair.partner_id.property_account_position.id
}
- inv_obj = self.pool.get('account.invoice')
inv_id = inv_obj.create(cr, uid, inv)
invoices_group[repair.partner_invoice_id.id] = inv_id
- self.write(cr, uid, repair.id , {'invoiced':True,'invoice_id' : inv_id})
+ self.write(cr, uid, repair.id, {'invoiced': True, 'invoice_id': inv_id})
for operation in repair.operations:
if operation.to_invoice == True:
@@ -302,29 +368,29 @@ class mrp_repair(osv.osv):
name = repair.name + '-' + operation.name
else:
name = operation.name
- invoice_line_id=self.pool.get('account.invoice.line').create(cr, uid, {
+ invoice_line_id = inv_line_obj.create(cr, uid, {
'invoice_id': inv_id,
'name': name,
- 'origin':repair.name,
+ 'origin': repair.name,
'account_id': operation.product_id and operation.product_id.property_account_income and operation.product_id.property_account_income.id,
- 'quantity' : operation.product_uom_qty,
+ '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,
- 'price_unit' : operation.price_unit,
- 'price_subtotal' : operation.product_uom_qty*operation.price_unit,
- 'product_id' : operation.product_id and operation.product_id.id or False
+ 'uos_id': operation.product_uom.id,
+ 'price_unit': operation.price_unit,
+ 'price_subtotal': operation.product_uom_qty*operation.price_unit,
+ 'product_id': operation.product_id and operation.product_id.id or False
})
- self.pool.get('mrp.repair.line').write(cr, uid, [operation.id], {'invoiced':True,'invoice_line_id':invoice_line_id})
+ repair_line_obj.write(cr, uid, [operation.id], {'invoiced': True, 'invoice_line_id': invoice_line_id})
for fee in repair.fees_lines:
if fee.to_invoice == True:
if group:
name = repair.name + '-' + fee.name
else:
name = fee.name
- invoice_fee_id=self.pool.get('account.invoice.line').create(cr, uid, {
+ invoice_fee_id = inv_line_obj.create(cr, uid, {
'invoice_id': inv_id,
'name': name,
- 'origin':repair.name,
+ 'origin': repair.name,
'account_id': a,
'quantity': fee.product_uom_qty,
'invoice_line_tax_id': [(6,0,[x.id for x in fee.tax_id])],
@@ -333,27 +399,39 @@ class mrp_repair(osv.osv):
'price_unit': fee.price_unit,
'price_subtotal': fee.product_uom_qty*fee.price_unit
})
- self.pool.get('mrp.repair.fee').write(cr, uid, [fee.id], {'invoiced':True,'invoice_line_id':invoice_fee_id})
- res[repair.id]=inv_id
+ repair_fee_obj.write(cr, uid, [fee.id], {'invoiced': True, 'invoice_line_id': invoice_fee_id})
+ res[repair.id] = inv_id
#self.action_invoice_end(cr, uid, ids)
return res
def action_repair_ready(self, cr, uid, ids, context=None):
- self.write(cr, uid, ids, {'state':'ready'})
+ """ Writes repair order state to 'Ready'
+ @return: True
+ """
+ self.write(cr, uid, ids, {'state': 'ready'})
return True
def action_invoice_cancel(self, cr, uid, ids, context=None):
- self.write(cr, uid, ids, {'state':'invoice_except'})
+ """ Writes repair order state to 'Exception in invoice'
+ @return: True
+ """
+ self.write(cr, uid, ids, {'state': 'invoice_except'})
return True
def action_repair_start(self, cr, uid, ids, context=None):
- self.write(cr, uid, ids, {'state':'under_repair'})
+ """ Writes repair order state to 'Under Repair'
+ @return: True
+ """
+ self.write(cr, uid, ids, {'state': 'under_repair'})
return True
def action_invoice_end(self, cr, uid, ids, context=None):
+ """ Writes repair order state to 'Ready' if invoice method is Before repair.
+ @return: True
+ """
for order in self.browse(cr, uid, ids):
val = {}
- if (order.invoice_method=='b4repair'):
+ if (order.invoice_method == 'b4repair'):
val['state'] = 'ready'
else:
#val['state'] = 'done'
@@ -362,9 +440,13 @@ class mrp_repair(osv.osv):
return True
def action_repair_end(self, cr, uid, ids, context=None):
+ """ Writes repair order state to 'To be invoiced' if invoice method is
+ After repair else state is set to 'Ready'.
+ @return: True
+ """
for order in self.browse(cr, uid, ids):
val = {}
- val['repaired']=True
+ val['repaired'] = True
if (not order.invoiced and order.invoice_method=='after_repair'):
val['state'] = '2binvoiced'
elif (not order.invoiced and order.invoice_method=='b4repair'):
@@ -376,15 +458,23 @@ class mrp_repair(osv.osv):
return True
def wkf_repair_done(self, cr, uid, ids, *args):
- res=self.action_repair_done(cr,uid,ids)
+ res = self.action_repair_done(cr, uid, ids)
return True
def action_repair_done(self, cr, uid, ids, context=None):
+ """ Creates stock move and picking for repair order.
+ @return: Picking ids.
+ """
res = {}
+ move_obj = self.pool.get('stock.move')
+ wf_service = netsvc.LocalService("workflow")
+ repair_line_obj = self.pool.get('mrp.repair.line')
+ seq_obj = self.pool.get('ir.sequence')
+ pick_obj = self.pool.get('stock.picking')
company = self.pool.get('res.users').browse(cr, uid, uid).company_id
for repair in self.browse(cr, uid, ids, context=context):
for move in repair.operations:
- move_id = self.pool.get('stock.move').create(cr, uid, {
+ move_id = move_obj.create(cr, uid, {
'name': move.name,
'product_id': move.product_id.id,
'product_qty': move.product_uom_qty,
@@ -395,11 +485,11 @@ class mrp_repair(osv.osv):
'tracking_id': False,
'state': 'done',
})
- self.pool.get('mrp.repair.line').write(cr, uid, [move.id], {'move_id': move_id})
+ repair_line_obj.write(cr, uid, [move.id], {'move_id': move_id})
if repair.deliver_bool:
- pick_name = self.pool.get('ir.sequence').get(cr, uid, 'stock.picking.out')
- picking = self.pool.get('stock.picking').create(cr, uid, {
+ pick_name = seq_obj.get(cr, uid, 'stock.picking.out')
+ picking = pick_obj.create(cr, uid, {
'name': pick_name,
'origin': repair.name,
'state': 'draft',
@@ -409,10 +499,9 @@ class mrp_repair(osv.osv):
'invoice_state': 'none',
'type': 'out',
})
- wf_service = netsvc.LocalService("workflow")
wf_service.trg_validate(uid, 'stock.picking', picking, 'button_confirm', cr)
- move_id = self.pool.get('stock.move').create(cr, uid, {
+ move_id = move_obj.create(cr, uid, {
'name': repair.name,
'picking_id': picking,
'product_id': repair.product_id.id,
@@ -427,10 +516,10 @@ class mrp_repair(osv.osv):
'tracking_id': False,
'state': 'assigned', # FIXME done ?
})
- self.write(cr, uid, [repair.id], {'state':'done', 'picking_id':picking})
+ self.write(cr, uid, [repair.id], {'state': 'done', 'picking_id': picking})
res[repair.id] = picking
else:
- self.write(cr, uid, [repair.id], {'state':'done'})
+ self.write(cr, uid, [repair.id], {'state': 'done'})
return res
@@ -438,7 +527,18 @@ mrp_repair()
class ProductChangeMixin(object):
- def product_id_change(self, cr, uid, ids, pricelist, product, uom=False, product_uom_qty=0, partner_id=False, guarantee_limit=False):
+ def product_id_change(self, cr, uid, ids, pricelist, product, uom=False,
+ product_uom_qty=0, partner_id=False, guarantee_limit=False):
+ """ On change of product it sets product quantity, tax account, name,
+ uom of product, unit price and price subtotal.
+ @param pricelist: Pricelist of current record.
+ @param product: Changed id of product.
+ @param uom: UoM of current record.
+ @param product_uom_qty: Quantity of current record.
+ @param partner_id: Partner of current record.
+ @param guarantee_limit: Guarantee limit of current record.
+ @return: Dictionary of values and warning message.
+ """
result = {}
warning = {}
@@ -447,7 +547,7 @@ class ProductChangeMixin(object):
result['product_uom_qty'] = product_uom_qty
if product:
- product_obj = self.pool.get('product.product').browse(cr, uid, product)
+ product_obj = self.pool.get('product.product').browse(cr, uid, product)
if partner_id:
partner = self.pool.get('res.partner').browse(cr, uid, partner_id)
result['tax_id'] = self.pool.get('account.fiscal.position').map_tax(cr, uid, partner.property_account_position, product_obj.taxes_id)
@@ -455,7 +555,7 @@ class ProductChangeMixin(object):
result['name'] = product_obj.partner_ref
result['product_uom'] = product_obj.uom_id and product_obj.uom_id.id or False
if not pricelist:
- warning={
+ warning = {
'title':'No Pricelist !',
'message':
'You have to select a pricelist in the Repair form !\n'
@@ -466,14 +566,14 @@ class ProductChangeMixin(object):
product, product_uom_qty, partner_id, {'uom': uom,})[pricelist]
if price is False:
- warning={
+ warning = {
'title':'No valid pricelist line found !',
'message':
"Couldn't find a pricelist line matching this product and quantity.\n"
"You have to change either the product, the quantity or the pricelist."
}
else:
- result.update({'price_unit': price, 'price_subtotal' :price*product_uom_qty})
+ result.update({'price_unit': price, 'price_subtotal': price*product_uom_qty})
return {'value': result, 'warning': warning}
@@ -484,10 +584,15 @@ class mrp_repair_line(osv.osv, ProductChangeMixin):
def copy_data(self, cr, uid, id, default=None, context=None):
if not default: default = {}
- default.update( {'invoice_line_id':False,'move_id':False,'invoiced':False,'state':'draft'})
+ default.update( {'invoice_line_id': False, 'move_id': False, 'invoiced': False, 'state': 'draft'})
return super(mrp_repair_line, self).copy_data(cr, uid, id, default, context)
def _amount_line(self, cr, uid, ids, field_name, arg, context):
+ """ Calculates amount.
+ @param field_name: Name of field.
+ @param arg: Argument
+ @return: Dictionary of values.
+ """
res = {}
cur_obj=self.pool.get('res.currency')
for line in self.browse(cr, uid, ids):
@@ -524,10 +629,16 @@ class mrp_repair_line(osv.osv, ProductChangeMixin):
}
_defaults = {
'state': lambda *a: 'draft',
- 'product_uom_qty':lambda *a:1,
+ 'product_uom_qty': lambda *a: 1,
}
def onchange_operation_type(self, cr, uid, ids, type, guarantee_limit):
+ """ On change of operation type it sets source location, destination location
+ and to invoice field.
+ @param product: Changed operation type.
+ @param guarantee_limit: Guarantee limit of current record.
+ @return: Dictionary of values.
+ """
if not type:
return {'value': {
'location_id': False,
@@ -537,19 +648,19 @@ class mrp_repair_line(osv.osv, ProductChangeMixin):
produc_id = self.pool.get('stock.location').search(cr, uid, [('name','=','Production')])[0]
if type == 'add':
stock_id = self.pool.get('stock.location').search(cr, uid, [('name','=','Stock')])[0]
- to_invoice=False
+ to_invoice = False
if guarantee_limit and today() > mx.DateTime.strptime(guarantee_limit, '%Y-%m-%d'):
to_invoice=True
return {'value': {
'to_invoice': to_invoice,
'location_id': stock_id,
- 'location_dest_id' : produc_id
+ 'location_dest_id': produc_id
}
}
return {'value': {
'to_invoice': False,
'location_id': produc_id,
- 'location_dest_id':False
+ 'location_dest_id': False
}
}
@@ -558,13 +669,20 @@ mrp_repair_line()
class mrp_repair_fee(osv.osv, ProductChangeMixin):
_name = 'mrp.repair.fee'
_description = 'Repair Fees line'
+
def copy_data(self, cr, uid, id, default=None, context=None):
if not default: default = {}
- default.update( {'invoice_line_id':False,'invoiced':False})
+ default.update({'invoice_line_id': False, 'invoiced': False})
return super(mrp_repair_fee, self).copy_data(cr, uid, id, default, context)
+
def _amount_line(self, cr, uid, ids, field_name, arg, context):
+ """ Calculates amount.
+ @param field_name: Name of field.
+ @param arg: Argument
+ @return: Dictionary of values.
+ """
res = {}
- cur_obj=self.pool.get('res.currency')
+ cur_obj = self.pool.get('res.currency')
for line in self.browse(cr, uid, ids):
res[line.id] = line.to_invoice and line.price_unit * line.product_uom_qty or 0
cur = line.repair_id.pricelist_id.currency_id
diff --git a/addons/mrp_repair/wizard/cancel_repair.py b/addons/mrp_repair/wizard/cancel_repair.py
index 7977a8b2195..371b7ba82e3 100644
--- a/addons/mrp_repair/wizard/cancel_repair.py
+++ b/addons/mrp_repair/wizard/cancel_repair.py
@@ -28,17 +28,13 @@ class repair_cancel(osv.osv_memory):
_description = 'Cancel Repair'
def cancel_repair(self, cr, uid, ids, context):
- """
- Cancels the repair
-
- @param self: The object pointer.
- @param cr: A database cursor
- @param uid: ID of the user currently logged in
- @param ids: List of IDs selected
- @param context: A standard dictionary
-
- @return:
-
+ """ Cancels the repair
+ @param self: The object pointer.
+ @param cr: A database cursor
+ @param uid: ID of the user currently logged in
+ @param ids: List of IDs selected
+ @param context: A standard dictionary
+ @return:
"""
record_id = context and context.get('active_id', False) or False
assert record_id, _('Active ID is not Found')
@@ -54,16 +50,12 @@ class repair_cancel(osv.osv_memory):
return {}
def fields_view_get(self, cr, uid, view_id=None, view_type='form', context=None, toolbar=False, submenu=False):
- """
- Changes the view dynamically
-
- @param self: The object pointer.
- @param cr: A database cursor
- @param uid: ID of the user currently logged in
- @param context: A standard dictionary
-
- @return: New arch of view.
-
+ """ Changes the view dynamically
+ @param self: The object pointer.
+ @param cr: A database cursor
+ @param uid: ID of the user currently logged in
+ @param context: A standard dictionary
+ @return: New arch of view.
"""
record_id = context and context.get('active_id', False) or False
res = super(repair_cancel, self).fields_view_get(cr, uid, view_id=view_id, view_type=view_type, context=context, toolbar=toolbar,submenu=False)
diff --git a/addons/mrp_repair/wizard/make_invoice.py b/addons/mrp_repair/wizard/make_invoice.py
index 063040590e6..5619f80681d 100644
--- a/addons/mrp_repair/wizard/make_invoice.py
+++ b/addons/mrp_repair/wizard/make_invoice.py
@@ -31,21 +31,18 @@ class make_invoice(osv.osv_memory):
}
def make_invoices(self, cr, uid, ids, context):
- """
- Generates invoice(s) of selected records.
-
- @param self: The object pointer.
- @param cr: A database cursor
- @param uid: ID of the user currently logged in
- @param ids: List of IDs selected
- @param context: A standard dictionary
-
- @return: Loads the view of new invoice(s).
-
+ """ Generates invoice(s) of selected records.
+ @param self: The object pointer.
+ @param cr: A database cursor
+ @param uid: ID of the user currently logged in
+ @param ids: List of IDs selected
+ @param context: A standard dictionary
+ @return: Loads the view of new invoice(s).
"""
inv = self.browse(cr, uid, ids[0])
order_obj = self.pool.get('mrp.repair')
- newinv = order_obj.action_invoice_create(cr, uid, context['active_ids'], group=inv.group,context=context)
+ newinv = order_obj.action_invoice_create(cr, uid, context['active_ids'],
+ group=inv.group,context=context)
return {
'domain': [('id','in', newinv.values())],
diff --git a/addons/olap_sale/i18n/de.po b/addons/olap_sale/i18n/de.po
index d4b3b05e56d..d95537215f2 100644
--- a/addons/olap_sale/i18n/de.po
+++ b/addons/olap_sale/i18n/de.po
@@ -14,7 +14,7 @@ msgstr ""
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
-"X-Launchpad-Export-Date: 2010-04-20 03:33+0000\n"
+"X-Launchpad-Export-Date: 2010-04-21 04:06+0000\n"
"X-Generator: Launchpad (build Unknown)\n"
#. module: olap_sale
diff --git a/addons/olap_sale/i18n/ro.po b/addons/olap_sale/i18n/ro.po
index 24eba2905e6..16ad2a4409e 100644
--- a/addons/olap_sale/i18n/ro.po
+++ b/addons/olap_sale/i18n/ro.po
@@ -14,7 +14,7 @@ msgstr ""
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
-"X-Launchpad-Export-Date: 2010-04-20 03:33+0000\n"
+"X-Launchpad-Export-Date: 2010-04-21 04:06+0000\n"
"X-Generator: Launchpad (build Unknown)\n"
#. module: olap_sale
diff --git a/addons/point_of_sale/account_bank_statement.py b/addons/point_of_sale/account_bank_statement.py
index b71e78afcfd..57276219861 100644
--- a/addons/point_of_sale/account_bank_statement.py
+++ b/addons/point_of_sale/account_bank_statement.py
@@ -28,6 +28,7 @@ from tools.translate import _
class account_journal(osv.osv):
+
_inherit = 'account.journal'
_columns = {
'auto_cash': fields.boolean('Automatic Opening', help="This field authorize the automatic creation of the cashbox"),
@@ -44,21 +45,30 @@ account_journal()
class singer_statement(osv.osv):
+
+ """ Singer Statements """
+
_name = 'singer.statement'
_description = 'Statements'
def _sub_total(self, cr, uid, ids, name, arg, context=None):
+
+ """ Calculates Sub total"
+ @param name: Names of fields.
+ @param arg: User defined arguments
+ @return: Dictionary of values.
+ """
res = {}
for obj in self.browse(cr, uid, ids):
res[obj.id] = obj.pieces * obj.number
return res
- def on_change_sub2(self, cr, uid, ids, pieces, number, *a):
- sub=pieces*number
- return {'value':{'subtotal': sub or 0.0}}
-
-
def on_change_sub(self, cr, uid, ids, pieces, number,*a):
+
+ """ Calculates Sub total on change of number
+ @param pieces: Names of fields.
+ @param number:
+ """
sub=pieces*number
return {'value':{'subtotal': sub or 0.0}}
@@ -73,8 +83,16 @@ class singer_statement(osv.osv):
singer_statement()
class account_bank_statement(osv.osv):
+
_inherit = 'account.bank.statement'
+
def _get_starting_balance(self, cr, uid, ids, name, arg, context=None):
+
+ """ Find starting balance "
+ @param name: Names of fields.
+ @param arg: User defined arguments
+ @return: Dictionary of values.
+ """
res ={}
for statement in self.browse(cr, uid, ids):
amount_total=0.0
@@ -84,6 +102,12 @@ class account_bank_statement(osv.osv):
return res
def _get_sum_entry_encoding(self, cr, uid, ids, name, arg, context=None):
+
+ """ Find encoding total of statements "
+ @param name: Names of fields.
+ @param arg: User defined arguments
+ @return: Dictionary of values.
+ """
res2={}
for statement in self.browse(cr, uid, ids):
encoding_total=0.0
@@ -93,8 +117,12 @@ class account_bank_statement(osv.osv):
return res2
def _default_journal_id(self, cr, uid, context={}):
+
+ """ To get default journal for the object"
+ @param name: Names of fields.
+ @return: journal
+ """
company_id = self.pool.get('res.users').browse(cr, uid, uid).company_id.id
- print [('type','=','cash'),('auto_cash','=',False), ('company_id', '=', company_id)]
journal = self.pool.get('account.journal').search(cr, uid, [('type', '=', 'cash'), ('auto_cash','=',False), ('company_id', '=', company_id)])
if journal:
return journal[0]
@@ -140,6 +168,12 @@ class account_bank_statement(osv.osv):
return res
def onchange_journal_id(self, cursor, user, statement_id, journal_id, context=None):
+
+ """ Changes balance start and starting details if journal_id changes"
+ @param statement_id: Changed statement_id
+ @param journal_id: Changed journal_id
+ @return: Dictionary of changed values
+ """
id_s=[]
if not journal_id:
return {'value': {'balance_start': 0.0}}
@@ -171,6 +205,10 @@ class account_bank_statement(osv.osv):
return {'value': {'balance_start': balance_start, 'starting_details_ids':new}}
def button_open(self, cr, uid, ids, context=None):
+
+ """ Changes statement state to Running.
+ @return: True
+ """
obj_inv = self.browse(cr, uid, ids)[0]
s_id=obj_inv.journal_id
if s_id.statement_sequence_id:
@@ -184,6 +222,10 @@ class account_bank_statement(osv.osv):
return True
def button_confirm(self, cr, uid, ids, context=None):
+
+ """ Check the starting and ending detail of statement
+ @return: True
+ """
val = 0.0
val2 = 0.0
val_statement_line = 0.0
diff --git a/addons/point_of_sale/pos.py b/addons/point_of_sale/pos.py
index 03784511f14..c87efa486b3 100644
--- a/addons/point_of_sale/pos.py
+++ b/addons/point_of_sale/pos.py
@@ -31,8 +31,11 @@ import re
class pos_config_journal(osv.osv):
+
+ """ Point of Sale journal configuration"""
+
_name = 'pos.config.journal'
- _description = "Point of Sale journal configuration."
+ _description = "Point of Sale journal configuration"
_columns = {
'name': fields.char('Description', size=64),
'code': fields.char('Code', size=64),
@@ -42,8 +45,12 @@ class pos_config_journal(osv.osv):
pos_config_journal()
class res_mode_contact(osv.osv):
+
+ """ Contact mode for Partner """
+
_name = "res.mode.contact"
_description = "Contact mode"
+
_columns={
'name': fields.char('Mode', size=64, select=1),
'active': fields.boolean('Active', select=2),
@@ -51,6 +58,8 @@ class res_mode_contact(osv.osv):
res_mode_contact()
class contact_mode_partner(osv.osv):
+
+
_inherit = 'res.partner'
_columns = {
'contact_mode_id': fields.many2one('res.mode.contact','Contact Mode'),
@@ -59,6 +68,9 @@ contact_mode_partner()
class pos_company_discount(osv.osv):
+
+ """ Company Discount and Cashboxes """
+
_inherit = 'res.company'
_columns = {
'company_discount': fields.float('Max Discount(%)', digits=(16,2)),
@@ -71,12 +83,18 @@ pos_company_discount()
class pos_order(osv.osv):
+
+ """ Point of sale gives business owners a convenient way of checking out customers
+ and of recording sales """
+
_name = "pos.order"
_description = "Point of Sale"
_order = "date_order, create_date desc"
_order = "date_order desc"
+
def unlink(self, cr, uid, ids, context={}):
+
for rec in self.browse(cr, uid, ids, context=context):
for rec_statement in rec.statement_ids:
if (rec_statement.statement_id and rec_statement.statement_id.state=='confirm') or rec.state=='done':
@@ -84,12 +102,20 @@ class pos_order(osv.osv):
return super(pos_order, self).unlink(cr, uid, ids, context=context)
def onchange_partner_pricelist(self, cr, uid, ids, part, context={}):
+
+ """ Changed price list on_change of partner_id"""
+
if not part:
return {}
pricelist = self.pool.get('res.partner').browse(cr, uid, part).property_product_pricelist.id
return {'value':{'pricelist_id': pricelist}}
def _amount_total(self, cr, uid, ids, field_name, arg, context):
+
+ """ Calculates amount_tax of order line
+ @param field_names: Names of fields.
+ @return: Dictionary of values """
+
cr.execute("""
SELECT
p.id,
@@ -110,6 +136,13 @@ class pos_order(osv.osv):
return res
def _get_date_payment2(self, cr, uid, ids, context, *a):
+
+ # Todo need to check this function
+ """ Find payment Date
+
+ @param field_names: Names of fields.
+ @return: Dictionary of values """
+
res = {}
pay_obj = self.pool.get('account.bank.statement')
stat_obj_line = self.pool.get('account.bank.statement.line')
@@ -132,7 +165,12 @@ class pos_order(osv.osv):
if val:
res[order.id]=val
return res
+
def _get_date_payment(self, cr, uid, ids, context, *a):
+
+ """ Find Validation Date
+ @return: Dictionary of values """
+
res = {}
pay_obj = self.pool.get('pos.payment')
tot =0.0
@@ -162,6 +200,10 @@ class pos_order(osv.osv):
return res
def _amount_tax(self, cr, uid, ids, field_name, arg, context):
+
+ """ Calculates Taxes of order
+ @return: Dictionary of values """
+
res = {}
tax_obj = self.pool.get('account.tax')
for order in self.browse(cr, uid, ids):
@@ -184,6 +226,10 @@ class pos_order(osv.osv):
return res
def _total_payment(self, cr, uid, ids, field_name, arg, context):
+
+ """ Calculates Total payment of order
+ @return: Dictionary of values """
+
res = {}
i=0
for order in self.browse(cr, uid, ids):
@@ -195,6 +241,10 @@ class pos_order(osv.osv):
return {order.id:val}
def _total_return(self, cr, uid, ids, field_name, arg, context):
+
+ """ Calculates Total Returned from the order
+ @return: Dictionary of values """
+
res = {}
for order in self.browse(cr, uid, ids):
val = 0.0
@@ -203,11 +253,17 @@ class pos_order(osv.osv):
res[order.id] = val
return res
- def payment_get(self, cr, uid, ids, context=None):
- cr.execute("select id from pos_payment where order_id =ANY(%s)",(ids,))
- return [i[0] for i in cr.fetchall()]
+# def payment_get(self, cr, uid, ids, context=None):
+# """ Calculates Total Returned from the order
+# @return: Dictionary of values """
+# cr.execute("select id from pos_payment where order_id =ANY(%s)",(ids,))
+# return [i[0] for i in cr.fetchall()]
def _sale_journal_get(self, cr, uid, context):
+
+ """ To get sale journal for this order"
+ @return: journal """
+
journal_obj = self.pool.get('account.journal')
res = journal_obj.search(cr, uid,
[('type', '=', 'sale')], limit=1)
@@ -217,6 +273,10 @@ class pos_order(osv.osv):
return False
def _shop_get(self, cr, uid, context):
+
+ """ To get Shop for this order"
+ @return: Shop id """
+
company = self.pool.get('res.users').browse(cr, uid, uid, context).company_id
res = self.pool.get('sale.shop').search(cr, uid, [])
# res = self.pool.get('sale.shop').search(cr, uid, [('company_id', '=', company.id)])
@@ -225,12 +285,9 @@ class pos_order(osv.osv):
else:
return False
- def _receivable_get(self, cr, uid, context=None):
- prop_obj = self.pool.get('ir.property')
- res = prop_obj.get(cr, uid, 'property_account_receivable', 'res.partner', context=context)
- return res
def copy(self, cr, uid, id, default=None, context={}):
+
if not default:
default = {}
default.update({
@@ -246,6 +303,10 @@ class pos_order(osv.osv):
return super(pos_order, self).copy(cr, uid, id, default, context)
def _get_v( self, cr, uid, ids,*a):
+
+ """ Changed the Validation state of order
+ @return: State """
+
flag=False
res_company = self.pool.get('res.company')
res_obj = self.pool.get('res.users')
@@ -333,6 +394,11 @@ class pos_order(osv.osv):
def _select_pricelist(self, cr, uid, context):
+
+ """ To get default pricelist for the order"
+ @param name: Names of fields.
+ @return: pricelist ID
+ """
pricelist = self.pool.get('product.pricelist').search(cr, uid, [('name', '=', 'Public Pricelist')])
if pricelist:
return pricelist[0]
@@ -340,6 +406,11 @@ class pos_order(osv.osv):
return False
def _journal_default(self, cr, uid, context={}):
+
+ """ To get default pricelist for the order"
+ @param name: Names of fields.
+ @return: journal ID
+ """
journal_list = self.pool.get('account.journal').search(cr, uid, [('type', '=', 'cash')])
if journal_list:
return journal_list[0]
@@ -365,6 +436,11 @@ class pos_order(osv.osv):
def test_order_lines(self, cr, uid, order, context={}):
+
+ """ Test order line is created or not for the order "
+ @param name: Names of fields.
+ @return: True
+ """
if not order.lines:
raise osv.except_osv(_('Error'), _('No order lines defined for this sale.'))
@@ -376,6 +452,10 @@ class pos_order(osv.osv):
return True
def test_paid(self, cr, uid, ids, context=None):
+
+ """ Test all amount is paid for this order
+ @return: True
+ """
for order in self.browse(cr, uid, ids, context):
if order.lines and not order.amount_total:
return True
@@ -385,7 +465,9 @@ class pos_order(osv.osv):
return True
def _get_qty_differences(self, orders, old_picking):
- """check if the customer changed the product quantity"""
+
+ """check if the customer changed the product quantity """
+
order_dict = {}
for order in orders:
for line in order.lines:
@@ -407,7 +489,9 @@ class pos_order(osv.osv):
return diff_dict
def _split_picking(self, cr, uid, ids, context, old_picking, diff_dict):
+
"""if the customer changes the product quantity, split the picking in two"""
+
# create a copy of the original picking and adjust the product qty:
picking_model = self.pool.get('stock.picking')
defaults = {
@@ -445,7 +529,9 @@ class pos_order(osv.osv):
line.unlink(context=context)
def create_picking(self, cr, uid, ids, context={}):
+
"""Create a picking for each order and validate it."""
+
picking_obj = self.pool.get('stock.picking')
orders = self.browse(cr, uid, ids, context)
@@ -510,6 +596,10 @@ class pos_order(osv.osv):
return True
def set_to_draft(self, cr, uid, ids, *args):
+
+ """ Changes order state to draft
+ @return: True
+ """
if not len(ids):
return False
@@ -521,6 +611,10 @@ class pos_order(osv.osv):
return True
def button_invalidate(self, cr, uid, ids, *args):
+
+ """ Check the access for the sale order
+ @return: True
+ """
res_obj = self.pool.get('res.company')
try:
part_company=res_obj.browse(cr,uid,uid) and res_obj.browse(cr,uid,uid).parent_id and res_obj.browse(cr,uid,uid).parent_id.id or None
@@ -531,6 +625,10 @@ class pos_order(osv.osv):
return True
def button_validate(self, cr, uid, ids, *args):
+
+ """ Check the access for the sale order and update the date_payment
+ @return: True
+ """
res_obj = self.pool.get('res.company')
try:
part_company=res_obj.browse(cr,uid,uid) and res_obj.browse(cr,uid,uid).parent_id and res_obj.browse(cr,uid,uid).parent_id.id or None
@@ -549,12 +647,18 @@ class pos_order(osv.osv):
def cancel_order(self, cr, uid, ids, context=None):
+
+ """ Changes order state to cancel
+ @return: True
+ """
self.write(cr, uid, ids, {'state': 'cancel'})
self.cancel_picking(cr, uid, ids, context={})
return True
def add_payment(self, cr, uid, order_id, data, context=None):
+
"""Create a new payment for the order"""
+
res_obj = self.pool.get('res.company')
statementl_obj = self.pool.get('account.bank.statement.line')
prod_obj = self.pool.get('product.product')
@@ -597,7 +701,7 @@ class pos_order(osv.osv):
args['statement_id']= statement_id
args['pos_statement_id']= order_id
args['journal_id']= data['journal']
- statement_line_id = self.pool.get('account.bank.statement.line').create(cr, uid, args)
+ statement_line_id = statementl_obj.create(cr, uid, args)
ids_new.append(statement_id)
wf_service = netsvc.LocalService("workflow")
@@ -607,7 +711,9 @@ class pos_order(osv.osv):
return statement_id
def add_product(self, cr, uid, order_id, product_id, qty, context=None):
+
"""Create a new order line the order"""
+
line_obj = self.pool.get('pos.order.line')
values = self.read(cr, uid, order_id, ['partner_id', 'pricelist_id'])
@@ -629,6 +735,9 @@ class pos_order(osv.osv):
return order_line_id
def refund(self, cr, uid, ids, context={}):
+
+ """Create a copy of order for refund order"""
+
clone_list = []
line_obj = self.pool.get('pos.order.line')
@@ -653,9 +762,13 @@ class pos_order(osv.osv):
return clone_list
def action_invoice(self, cr, uid, ids, context={}):
+
+ """Create a invoice of order """
+
res_obj = self.pool.get('res.company')
inv_ref = self.pool.get('account.invoice')
inv_line_ref = self.pool.get('account.invoice.line')
+ product_obj= self.pool.get('product.product')
inv_ids = []
for order in self.browse(cr, uid, ids, context):
@@ -693,7 +806,7 @@ class pos_order(osv.osv):
'product_id': line.product_id.id,
'quantity': line.qty,
}
- inv_name = self.pool.get('product.product').name_get(cr, uid, [line.product_id.id], context=context)[0][1]
+ inv_name = product_obj.name_get(cr, uid, [line.product_id.id], context=context)[0][1]
inv_line.update(inv_line_ref.product_id_change(cr, uid, [],
line.product_id.id,
@@ -714,6 +827,9 @@ class pos_order(osv.osv):
return inv_ids
def create_account_move(self, cr, uid, ids, context=None):
+
+ """Create a account move line of order """
+
account_move_obj = self.pool.get('account.move')
account_move_line_obj = self.pool.get('account.move.line')
account_period_obj = self.pool.get('account.period')
diff --git a/addons/point_of_sale/pos_account_bank_statement.py b/addons/point_of_sale/pos_account_bank_statement.py
index 887a7b8060c..ccce315fe36 100644
--- a/addons/point_of_sale/pos_account_bank_statement.py
+++ b/addons/point_of_sale/pos_account_bank_statement.py
@@ -26,6 +26,7 @@ import netsvc
class account_bank_statement(osv.osv):
+
_inherit = 'account.bank.statement'
_columns = {
'company_id':fields.many2one('res.company', 'Company', required=True),
@@ -36,11 +37,24 @@ class account_bank_statement(osv.osv):
account_bank_statement()
class account_bank_statement_line(osv.osv):
+
def _default_company(self, cr, uid, context={}):
+
+ """ To get default company for the object"
+
+ @param self: The object pointer
+ @param cr: the current row, from the database cursor,
+ @param uid: the current user’s ID for security checks,
+ @param ids: List of bank statement ids
+ @param context: A standard dictionary for contextual values
+ @return: company
+ """
+
user = self.pool.get('res.users').browse(cr, uid, uid, context=context)
if user.company_id:
return user.company_id.id
return self.pool.get('res.company').search(cr, uid, [('parent_id', '=', False)])[0]
+
_inherit = 'account.bank.statement.line'
_columns = {
'company_id':fields.many2one('res.company', 'Company', required=True),
diff --git a/addons/point_of_sale/report/pos_invoice.py b/addons/point_of_sale/report/pos_invoice.py
index d9f345ca185..ee905ed74bf 100644
--- a/addons/point_of_sale/report/pos_invoice.py
+++ b/addons/point_of_sale/report/pos_invoice.py
@@ -33,7 +33,7 @@ class pos_invoice(report_sxw.rml_parse):
self.localcontext.update({
'time': time,
})
- print
+
def set_context(self, objects, data, ids, report_type=None):
super(pos_invoice, self).set_context(objects, data, ids, report_type)
diff --git a/addons/point_of_sale/report/pos_payment_report.py b/addons/point_of_sale/report/pos_payment_report.py
index f27add1e208..ceb824cf014 100644
--- a/addons/point_of_sale/report/pos_payment_report.py
+++ b/addons/point_of_sale/report/pos_payment_report.py
@@ -52,7 +52,7 @@ class pos_payment_report(report_sxw.rml_parse):
"where pt.id=pp.product_tmpl_id and pp.id=pol.product_id and po.id = pol.order_id " \
"and po.state in ('paid','invoiced') and to_char(date_trunc('day',po.date_order),'YYYY-MM-DD')::date = current_date")
data=self.cr.dictfetchall()
- print data
+
for d in data:
self.total += d['price_unit'] * d['qty']
return data
diff --git a/addons/point_of_sale/statement_view.xml b/addons/point_of_sale/statement_view.xml
index 0dcba67b8b3..80b2b1ec756 100644
--- a/addons/point_of_sale/statement_view.xml
+++ b/addons/point_of_sale/statement_view.xml
@@ -58,12 +58,12 @@
-
+
@@ -72,12 +72,12 @@
-
+
@@ -135,12 +135,12 @@
-
+
diff --git a/addons/point_of_sale/wizard/pos_payment.py b/addons/point_of_sale/wizard/pos_payment.py
index c34e7fad9e1..8e25f3f0797 100644
--- a/addons/point_of_sale/wizard/pos_payment.py
+++ b/addons/point_of_sale/wizard/pos_payment.py
@@ -137,17 +137,21 @@ class pos_make_payment(osv.osv_memory):
jrnl_used=jrnl_obj.browse(cr,uid,data['journal'])
order_obj.write(cr, uid, [record_id], {'invoice_wanted': invoice_wanted})
order_obj.add_payment(cr, uid, record_id, data, context=context)
-
- if amount<=0.0:
- context.update({'flag':True})
- order_obj.action_paid(cr,uid,[record_id],context)
+ # Todo need to check
+# if amount<=0.0:
+# context.update({'flag':True})
+# order_obj.action_paid(cr,uid,[record_id],context)
if order_obj.test_paid(cr, uid, [record_id]):
if order.partner_id and order.invoice_wanted:
return self.create_invoice(cr,uid,ids,context)
else:
+ order_obj.action_paid(cr,uid,[record_id],context)
order_obj.write(cr, uid, [record_id],{'state':'paid'})
return self.print_report(cr, uid, ids, context)
if order.amount_paid > 0.0:
+ context.update({'flag': True})
+ # Todo need to check
+ order_obj.action_paid(cr, uid, [record_id], context)
self.pool.get('pos.order').write(cr, uid, [record_id],{'state':'advance'})
return self.print_report(cr, uid, ids, context)
return {}
diff --git a/addons/point_of_sale/wizard/wizard_return.py b/addons/point_of_sale/wizard/wizard_return.py
index 591fd00b18a..673610e8c2c 100644
--- a/addons/point_of_sale/wizard/wizard_return.py
+++ b/addons/point_of_sale/wizard/wizard_return.py
@@ -266,6 +266,7 @@ def _create_returns(self, cr, uid, data, context):
return res
def _create_returns2(self, cr, uid, data, context):
+ act={}
pool = pooler.get_pool(cr.dbname)
order_obj = pool.get('pos.order')
line_obj = pool.get('pos.order.line')
@@ -283,46 +284,49 @@ def _create_returns2(self, cr, uid, data, context):
res=cr.fetchone()
location_id=res and res[0] or None
stock_dest_id = int(val.split(',')[1])
+ if order_id.last_out_picking.id:
+ new_picking=picking_obj.copy(cr, uid, order_id.last_out_picking.id, {'name':'%s (return)' % order_id.name,
+ 'move_lines':[], 'state':'draft', 'type':'in',
+ 'type':'in',
+ 'date':date_cur, })
+ new_order=order_obj.copy(cr,uid,order_id.id, {'name': 'Refund %s'%order_id.name,
+ 'lines':[],
+ 'statement_ids':[],
+ 'last_out_picking':[]})
+ for line in order_id.lines:
+ for r in data['form'].get('returns',[]):
+ if line.id==r and (data['form']['return%s' %r]!=0.0):
+ new_move=stock_move_obj.create(cr, uid,{
+ 'product_qty': data['form']['return%s' %r],
+ 'product_uos_qty': uom_obj._compute_qty(cr, uid,data['form']['return%s' %r] ,line.product_id.uom_id.id),
+ 'picking_id':new_picking,
+ 'product_uom':line.product_id.uom_id.id,
+ 'location_id':location_id,
+ 'product_id':line.product_id.id,
+ 'location_dest_id':stock_dest_id,
+ 'name':'%s (return)' %order_id.name,
+ 'date':date_cur,
+ 'date_planned':date_cur,})
+ line_obj.copy(cr,uid,line.id,{'qty':-data['form']['return%s' %r],
+ 'order_id': new_order,
+ })
+ order_obj.write(cr,uid, new_order, {'state':'done'})
+ wf_service.trg_validate(uid, 'stock.picking',new_picking,'button_confirm', cr)
+ picking_obj.force_assign(cr, uid, [new_picking], context)
+ act = {
+ 'domain': "[('id', 'in', ["+str(new_order)+"])]",
+ 'name': 'Refunded Orders',
+ 'view_type': 'form',
+ 'view_mode': 'form,tree',
+ 'res_model': 'pos.order',
+ 'auto_refresh':0,
+ 'res_id':new_order,
+ 'view_id': False,
+ 'type': 'ir.actions.act_window'
+ }
+ else:
+ raise wizard.except_wizard(_('Error'), _('Last out picking No find!'))
- new_picking=picking_obj.copy(cr, uid, order_id.last_out_picking.id, {'name':'%s (return)' % order_id.name,
- 'move_lines':[], 'state':'draft', 'type':'in',
- 'type':'in',
- 'date':date_cur, })
- new_order=order_obj.copy(cr,uid,order_id.id, {'name': 'Refund %s'%order_id.name,
- 'lines':[],
- 'statement_ids':[],
- 'last_out_picking':[]})
- for line in order_id.lines:
- for r in data['form'].get('returns',[]):
- if line.id==r and (data['form']['return%s' %r]!=0.0):
- new_move=stock_move_obj.create(cr, uid,{
- 'product_qty': data['form']['return%s' %r],
- 'product_uos_qty': uom_obj._compute_qty(cr, uid,data['form']['return%s' %r] ,line.product_id.uom_id.id),
- 'picking_id':new_picking,
- 'product_uom':line.product_id.uom_id.id,
- 'location_id':location_id,
- 'product_id':line.product_id.id,
- 'location_dest_id':stock_dest_id,
- 'name':'%s (return)' %order_id.name,
- 'date':date_cur,
- 'date_planned':date_cur,})
- line_obj.copy(cr,uid,line.id,{'qty':-data['form']['return%s' %r],
- 'order_id': new_order,
- })
- order_obj.write(cr,uid, new_order, {'state':'done'})
- wf_service.trg_validate(uid, 'stock.picking',new_picking,'button_confirm', cr)
- picking_obj.force_assign(cr, uid, [new_picking], context)
- act = {
- 'domain': "[('id', 'in', ["+str(new_order)+"])]",
- 'name': 'Refunded Orders',
- 'view_type': 'form',
- 'view_mode': 'form,tree',
- 'res_model': 'pos.order',
- 'auto_refresh':0,
- 'res_id':new_order,
- 'view_id': False,
- 'type': 'ir.actions.act_window'
- }
return act
def test(self,cr,uid,data,context={}):
# import pdb; pdb.set_trace()
diff --git a/addons/product/i18n/it.po b/addons/product/i18n/it.po
index aa6e54693f5..1d298587478 100644
--- a/addons/product/i18n/it.po
+++ b/addons/product/i18n/it.po
@@ -7,13 +7,13 @@ msgstr ""
"Project-Id-Version: OpenERP Server 5.0.0_rc3\n"
"Report-Msgid-Bugs-To: support@openerp.com\n"
"POT-Creation-Date: 2009-08-28 16:01+0000\n"
-"PO-Revision-Date: 2010-03-10 13:51+0000\n"
+"PO-Revision-Date: 2010-04-20 09:57+0000\n"
"Last-Translator: Carlo Vettore \n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
-"X-Launchpad-Export-Date: 2010-04-17 04:10+0000\n"
+"X-Launchpad-Export-Date: 2010-04-21 04:06+0000\n"
"X-Generator: Launchpad (build Unknown)\n"
#. module: product
@@ -458,7 +458,7 @@ msgstr "Margine Minimo"
#. module: product
#: view:product.pricelist.item:0
msgid "* ( 1 + "
-msgstr "* ( 1 + "
+msgstr "( 1 - "
#. module: product
#: model:product.template,name:product.product_product_cpu1_product_template
diff --git a/addons/product/product_view.xml b/addons/product/product_view.xml
index 131b88f24a1..b9858e19eaf 100644
--- a/addons/product/product_view.xml
+++ b/addons/product/product_view.xml
@@ -106,8 +106,8 @@
-
-
+
+
diff --git a/addons/profile_manufacturing/i18n/nl.po b/addons/profile_manufacturing/i18n/nl.po
index b37c873a521..3b07c5da62a 100644
--- a/addons/profile_manufacturing/i18n/nl.po
+++ b/addons/profile_manufacturing/i18n/nl.po
@@ -13,7 +13,7 @@ msgstr ""
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
-"X-Launchpad-Export-Date: 2010-04-20 03:33+0000\n"
+"X-Launchpad-Export-Date: 2010-04-21 04:06+0000\n"
"X-Generator: Launchpad (build Unknown)\n"
#. module: profile_manufacturing
diff --git a/addons/project/i18n/pl.po b/addons/project/i18n/pl.po
index ede02cd2b22..8bec8258428 100644
--- a/addons/project/i18n/pl.po
+++ b/addons/project/i18n/pl.po
@@ -7,13 +7,13 @@ msgstr ""
"Project-Id-Version: OpenERP Server 5.0.0\n"
"Report-Msgid-Bugs-To: support@openerp.com\n"
"POT-Creation-Date: 2009-08-28 16:01+0000\n"
-"PO-Revision-Date: 2010-04-16 16:06+0000\n"
-"Last-Translator: Grzegorz Grzelak (Cirrus.pl) \n"
+"PO-Revision-Date: 2010-04-20 08:36+0000\n"
+"Last-Translator: PROSID \n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
-"X-Launchpad-Export-Date: 2010-04-20 03:32+0000\n"
+"X-Launchpad-Export-Date: 2010-04-21 04:05+0000\n"
"X-Generator: Launchpad (build Unknown)\n"
#. module: project
diff --git a/addons/purchase/__openerp__.py b/addons/purchase/__openerp__.py
index dfa362a97c6..6687b330b2c 100644
--- a/addons/purchase/__openerp__.py
+++ b/addons/purchase/__openerp__.py
@@ -34,12 +34,15 @@
'depends': ['base', 'account', 'stock', 'process'],
'init_xml': [],
'update_xml': [
+
'security/purchase_security.xml',
'security/ir.model.access.csv',
'purchase_workflow.xml',
'purchase_sequence.xml',
'purchase_data.xml',
'wizard/purchase_order_group_view.xml',
+ 'wizard/purchase_installer.xml',
+ 'wizard/purchase_line_invoice_view.xml',
'purchase_view.xml',
'purchase_report.xml',
'stock_view.xml',
diff --git a/addons/purchase/purchase.py b/addons/purchase/purchase.py
index 0dc7926f428..2bcc62c06ac 100644
--- a/addons/purchase/purchase.py
+++ b/addons/purchase/purchase.py
@@ -246,6 +246,7 @@ class purchase_order(osv.osv):
return {'value':{'location_id': res, 'dest_address_id': False}}
def onchange_partner_id(self, cr, uid, ids, part):
+
if not part:
return {'value':{'partner_address_id': False, 'fiscal_position': False}}
addr = self.pool.get('res.partner').address_get(cr, uid, [part], ['default'])
@@ -259,12 +260,18 @@ class purchase_order(osv.osv):
return True
def wkf_confirm_order(self, cr, uid, ids, context={}):
+ todo = []
for po in self.browse(cr, uid, ids):
+
if self.pool.get('res.partner.event.type').check(cr, uid, 'purchase_open'):
self.pool.get('res.partner.event').create(cr, uid, {'name':'Purchase Order: '+po.name, 'partner_id':po.partner_id.id, 'date':time.strftime('%Y-%m-%d %H:%M:%S'), 'user_id':uid, 'partner_type':'retailer', 'probability': 1.0, 'planned_cost':po.amount_untaxed})
if not po.order_line:
raise osv.except_osv(_('Error !'),_('You can not confirm purchase order without Purchase Order Lines.'))
+ for line in po.order_line:
+ if line.state=='draft':
+ todo.append(line.id)
current_name = self.name_get(cr, uid, ids)[0][1]
+ self.pool.get('purchase.order.line').action_confirm(cr, uid, todo, context)
for id in ids:
self.write(cr, uid, [id], {'state' : 'confirmed', 'validator' : uid})
return True
@@ -312,11 +319,13 @@ class purchase_order(osv.osv):
def action_invoice_create(self, cr, uid, ids, *args):
res = False
+
journal_obj = self.pool.get('account.journal')
for o in self.browse(cr, uid, ids):
il = []
+ todo = []
for ol in o.order_line:
-
+ todo.append(ol.id)
if ol.product_id:
a = ol.product_id.product_tmpl_id.property_account_expense.id
if not a:
@@ -352,7 +361,7 @@ class purchase_order(osv.osv):
}
inv_id = self.pool.get('account.invoice').create(cr, uid, inv, {'type':'in_invoice'})
self.pool.get('account.invoice').button_compute(cr, uid, [inv_id], {'type':'in_invoice'}, set_total=True)
-
+ self.pool.get('purchase.order.line').write(cr, uid, todo, {'invoiced':True})
self.write(cr, uid, [o.id], {'invoice_id': inv_id})
res = inv_id
return res
@@ -579,10 +588,22 @@ class purchase_order_line(osv.osv):
'notes': fields.text('Notes', translate=True),
'order_id': fields.many2one('purchase.order', 'Order Reference', select=True, required=True, ondelete='cascade'),
'account_analytic_id':fields.many2one('account.analytic.account', 'Analytic Account',),
- 'company_id': fields.related('order_id','company_id',type='many2one',relation='res.company',string='Company')
+ 'company_id': fields.related('order_id','company_id',type='many2one',relation='res.company',string='Company'),
+ 'state': fields.selection([('draft', 'Draft'), ('confirmed', 'Confirmed'), ('done', 'Done'), ('cancel', 'Cancelled')], 'State', required=True, readonly=True,
+ help=' * The \'Draft\' state is set automatically when purchase order in draft state. \
+ \n* The \'Confirmed\' state is set automatically as confirm when purchase order in confirm state. \
+ \n* The \'Done\' state is set automatically when purchase order is set as done. \
+ \n* The \'Cancelled\' state is set automatically when user cancel purchase order.'),
+ 'invoice_lines': fields.many2many('account.invoice.line', 'purchase_order_line_invoice_rel', 'order_line_id', 'invoice_id', 'Invoice Lines', readonly=True),
+ 'invoiced': fields.boolean('Invoiced', readonly=True),
+ 'partner_id': fields.related('order_id','partner_id',string='Partner',readonly=True,type="many2one", relation="res.partner"),
+ 'date_order': fields.related('order_id','date_order',string='Order Date',readonly=True,type="date")
+
}
_defaults = {
- 'product_qty': lambda *a: 1.0
+ 'product_qty': lambda *a: 1.0,
+ 'state': lambda *args: 'draft',
+ 'invoiced': lambda *a: 0,
}
_table = 'purchase_order_line'
_name = 'purchase.order.line'
@@ -590,7 +611,7 @@ class purchase_order_line(osv.osv):
def copy_data(self, cr, uid, id, default=None,context={}):
if not default:
default = {}
- default.update({'state':'draft', 'move_ids':[]})
+ default.update({'state':'draft', 'move_ids':[],'invoiced':0,'invoice_lines':[]})
return super(purchase_order_line, self).copy_data(cr, uid, id, default, context)
def product_id_change(self, cr, uid, ids, pricelist, product, qty, uom,
@@ -658,14 +679,17 @@ class purchase_order_line(osv.osv):
return res
def product_uom_change(self, cr, uid, ids, pricelist, product, qty, uom,
- partner_id, date_order=False):
+ partner_id, date_order=False,fiscal_position=False):
res = self.product_id_change(cr, uid, ids, pricelist, product, qty, uom,
- partner_id, date_order=date_order)
+ partner_id, date_order=date_order,fiscal_position=fiscal_position)
if 'product_uom' in res['value']:
del res['value']['product_uom']
if not uom:
res['value']['price_unit'] = 0.0
return res
+ def action_confirm(self, cr, uid, ids, context={}):
+ self.write(cr, uid, ids, {'state': 'confirmed'}, context)
+ return True
purchase_order_line()
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
diff --git a/addons/purchase/purchase_view.xml b/addons/purchase/purchase_view.xml
index edd482b3df4..40926ec2aa3 100644
--- a/addons/purchase/purchase_view.xml
+++ b/addons/purchase/purchase_view.xml
@@ -17,12 +17,12 @@
-
-
+ name="Incoming Products" parent="menu_procurement_management_inventory" sequence="10"/>
-
+
+
+
@@ -224,7 +226,7 @@
-
+
@@ -242,8 +244,15 @@
+
+
+
+
+
+
+
@@ -262,6 +271,7 @@
+
@@ -280,5 +290,39 @@
name="Product purchases"
res_model="purchase.order.line"
src_model="product.product"/>
+
+
+
+ Lines To Invoices
+ ir.actions.act_window
+ purchase.order.line
+ [('state','in',('confirmed','done')), ('invoiced','=',False)]
+ form
+ tree,form
+
+
+
+ tree
+
+
+
+
+
+ form
+
+
+
+
+
+
diff --git a/addons/purchase/wizard/__init__.py b/addons/purchase/wizard/__init__.py
index 73bb88500a8..dbc3fc5e31b 100644
--- a/addons/purchase/wizard/__init__.py
+++ b/addons/purchase/wizard/__init__.py
@@ -20,6 +20,7 @@
##############################################################################
import purchase_order_group
-
+import purchase_installer
+import purchase_line_invoice
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
diff --git a/addons/purchase_manual/wizard/__init__.py b/addons/purchase/wizard/purchase_installer.py
similarity index 73%
rename from addons/purchase_manual/wizard/__init__.py
rename to addons/purchase/wizard/purchase_installer.py
index e93c28bfe14..da2c3f41cca 100644
--- a/addons/purchase_manual/wizard/__init__.py
+++ b/addons/purchase/wizard/purchase_installer.py
@@ -1,8 +1,8 @@
# -*- coding: utf-8 -*-
##############################################################################
-#
+#
# OpenERP, Open Source Management Solution
-# Copyright (C) 2004-2010 Tiny SPRL ().
+# Copyright (C) 2004-2009 Tiny SPRL ().
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
@@ -15,8 +15,17 @@
# 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 .
#
##############################################################################
+from osv import fields, osv
+
+class purchase_installer(osv.osv_memory):
+ _name = 'purchase.installer'
+ _inherit = 'res.config.installer'
+
+ _columns = {
+ 'purchase_requisition':fields.boolean('Purchase Requisition'),
+ }
+purchase_installer()
-import wizard_purchase_line_invoice
diff --git a/addons/purchase/wizard/purchase_installer.xml b/addons/purchase/wizard/purchase_installer.xml
new file mode 100644
index 00000000000..77bbef10453
--- /dev/null
+++ b/addons/purchase/wizard/purchase_installer.xml
@@ -0,0 +1,48 @@
+
+
+
+
+ Purchase Requisition
+ purchase.installer
+ form
+
+
+
+
+
+
+ Configure Your Purchase System
+
+
+ After having installed the core purchase application, you can extend it with more modules on needs of your organization
+
+
+
+
+
+
+
+
+
+
+
+ Purchase Profile : Install Extra Modules
+ ir.actions.act_window
+ purchase.installer
+
+ form
+ form
+ new
+
+
+
+
+ 3
+
+
+
+
diff --git a/addons/purchase/wizard/purchase_line_invoice.py b/addons/purchase/wizard/purchase_line_invoice.py
new file mode 100644
index 00000000000..12024df71ad
--- /dev/null
+++ b/addons/purchase/wizard/purchase_line_invoice.py
@@ -0,0 +1,132 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+# OpenERP, Open Source Management Solution
+# Copyright (C) 2004-2010 Tiny SPRL ().
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as
+# published by the Free Software Foundation, either version 3 of the
+# License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# 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 .
+#
+##############################################################################
+
+import netsvc
+import ir
+from osv import osv
+from tools.translate import _
+
+class purchase_line_invoice(osv.osv_memory):
+
+ """ To create invoice for purchase order line"""
+
+ _name = 'purchase.order.line_invoice'
+ _description = 'Purchase Order Line Make Invoice'
+
+ def makeInvoices(self, cr, uid, ids, context):
+ """
+ To get Purchase Order line and create Invoice
+ @param self: The object pointer.
+ @param cr: A database cursor
+ @param uid: ID of the user currently logged in
+ @param context: A standard dictionary
+ @return : retrun view of Invoice
+ """
+ record_ids = context.get('active_ids',[])
+ if record_ids:
+ res = False
+ invoices = {}
+ invoice_obj=self.pool.get('account.invoice')
+ purchase_line_obj=self.pool.get('purchase.order.line')
+ property_obj=self.pool.get('ir.property')
+ account_fiscal_obj=self.pool.get('account.fiscal.position')
+ invoice_line_obj=self.pool.get('account.invoice.line')
+
+ def make_invoice(order, lines):
+ a = order.partner_id.property_account_payable.id
+ if order.partner_id and order.partner_id.property_payment_term.id:
+ pay_term = order.partner_id.property_payment_term.id
+ else:
+ pay_term = False
+ inv = {
+ 'name': order.name,
+ 'origin': order.name,
+ 'type': 'in_invoice',
+ 'reference': "P%dPO%d" % (order.partner_id.id, order.id),
+ 'account_id': a,
+ 'partner_id': order.partner_id.id,
+ 'address_invoice_id': order.partner_address_id.id,
+ 'address_contact_id': order.partner_address_id.id,
+ 'invoice_line': [(6,0,lines)],
+ 'currency_id' : order.pricelist_id.currency_id.id,
+ 'comment': order.notes,
+ 'payment_term': pay_term,
+ 'fiscal_position': order.partner_id.property_account_position.id
+ }
+ inv_id = invoice_obj.create(cr, uid, inv)
+ return inv_id
+
+ for line in purchase_line_obj.browse(cr,uid,record_ids):
+ if (not line.invoiced) and (line.state not in ('draft','cancel')):
+ if not line.order_id.id in invoices:
+ invoices[line.order_id.id] = []
+ if line.product_id:
+ a = line.product_id.product_tmpl_id.property_account_expense.id
+ if not a:
+ a = line.product_id.categ_id.property_account_expense_categ.id
+ if not a:
+ raise osv.except_osv(_('Error !'),
+ _('There is no expense account defined ' \
+ 'for this product: "%s" (id:%d)') % \
+ (line.product_id.name, line.product_id.id,))
+ else:
+ a = property_obj.get(cr, uid,
+ 'property_account_expense_categ', 'product.category',
+ context=context)
+ fpos = line.order_id.fiscal_position or False
+ a = account_fiscal_obj.map_account(cr, uid, fpos, a)
+ inv_id = invoice_line_obj.create(cr, uid, {
+ 'name': line.name,
+ 'origin': line.order_id.name,
+ 'account_id': a,
+ 'price_unit': line.price_unit,
+ 'quantity': line.product_qty,
+ 'uos_id': line.product_uom.id,
+ 'product_id': line.product_id.id or False,
+ 'invoice_line_tax_id': [(6, 0, [x.id for x in line.taxes_id])],
+ 'note': line.notes,
+ 'account_analytic_id': line.account_analytic_id and line.account_analytic_id.id or False,
+ })
+ cr.execute('insert into purchase_order_line_invoice_rel (order_line_id,invoice_id) values (%s,%s)', (line.id, inv_id))
+ purchase_line_obj.write(cr, uid, [line.id], {'invoiced': True})
+ invoices[line.order_id.id].append((line,inv_id))
+
+ res = []
+ for result in invoices.values():
+ order = result[0][0].order_id
+ il = map(lambda x: x[1], result)
+ res.append(make_invoice(order, il))
+
+ return {
+ 'domain': "[('id','in', ["+','.join(map(str,res))+"])]",
+ 'name': _('Supplier Invoices'),
+ 'view_type': 'form',
+ 'view_mode': 'tree,form',
+ 'res_model': 'account.invoice',
+ 'view_id': False,
+ 'context': "{'type':'in_invoice'}",
+ 'type': 'ir.actions.act_window'
+ }
+purchase_line_invoice()
+
+
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
+
diff --git a/addons/purchase/wizard/purchase_line_invoice_view.xml b/addons/purchase/wizard/purchase_line_invoice_view.xml
new file mode 100644
index 00000000000..c5855e5d448
--- /dev/null
+++ b/addons/purchase/wizard/purchase_line_invoice_view.xml
@@ -0,0 +1,33 @@
+
+
+
+
+
+
+
+ Control invoices
+ purchase.order.line_invoice
+ form
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/addons/purchase_manual/__openerp__.py b/addons/purchase_manual/__openerp__.py
deleted file mode 100644
index 7634af9ca7a..00000000000
--- a/addons/purchase_manual/__openerp__.py
+++ /dev/null
@@ -1,41 +0,0 @@
-# -*- coding: utf-8 -*-
-##############################################################################
-#
-# OpenERP, Open Source Management Solution
-# Copyright (C) 2004-2010 Tiny SPRL ().
-#
-# This program is free software: you can redistribute it and/or modify
-# it under the terms of the GNU Affero General Public License as
-# published by the Free Software Foundation, either version 3 of the
-# License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# 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 .
-#
-##############################################################################
-
-
-{
- 'name': 'Purchase Management - Manual Control of Invoice',
- 'version': '1.1',
- 'category': 'Generic Modules/Sales & Purchases',
- 'description': """Module for purchase management, manual control of invoice""",
- 'author': 'Tiny',
- 'website': 'http://www.openerp.com',
- 'depends': ['purchase'],
- 'init_xml': [],
- 'update_xml': [
- 'purchase_manual_view.xml',
- 'purchase_manual_wizard.xml',
- ],
- 'demo_xml': [],
- 'installable': True,
- 'active': False,
-# 'certificate': False,
-}
-# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
diff --git a/addons/purchase_manual/purchase_manual.py b/addons/purchase_manual/purchase_manual.py
deleted file mode 100644
index f31b96f4c8a..00000000000
--- a/addons/purchase_manual/purchase_manual.py
+++ /dev/null
@@ -1,81 +0,0 @@
-# -*- coding: utf-8 -*-
-##############################################################################
-#
-# OpenERP, Open Source Management Solution
-# Copyright (C) 2004-2010 Tiny SPRL ().
-#
-# This program is free software: you can redistribute it and/or modify
-# it under the terms of the GNU Affero General Public License as
-# published by the Free Software Foundation, either version 3 of the
-# License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# 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 .
-#
-##############################################################################
-
-from osv import fields
-from osv import osv
-import netsvc
-
-class purchase_order_line(osv.osv):
- _inherit='purchase.order.line'
- _columns = {
- 'state': fields.selection([('draft', 'Draft'), ('confirmed', 'Confirmed'), ('done', 'Done'), ('cancel', 'Cancelled')], 'State', required=True, readonly=True,
- help=' * The \'Draft\' state is set automatically when purchase order in draft state. \
- \n* The \'Confirmed\' state is set automatically as confirm when purchase order in confirm state. \
- \n* The \'Done\' state is set automatically when purchase order is set as done. \
- \n* The \'Cancelled\' state is set automatically when user cancel purchase order.'),
- 'invoice_lines': fields.many2many('account.invoice.line', 'purchase_order_line_invoice_rel', 'order_line_id', 'invoice_id', 'Invoice Lines', readonly=True),
- 'invoiced': fields.boolean('Invoiced', readonly=True),
- 'partner_id': fields.related('order_id','partner_id',string='Partner',readonly=True,type="many2one", relation="res.partner"),
- 'date_order': fields.related('order_id','date_order',string='Order Date',readonly=True,type="date")
- }
- _defaults = {
- 'state': lambda *args: 'draft',
- 'invoiced': lambda *a: 0,
-
- }
- def copy_data(self, cr, uid, id, default=None, context={}):
- print 'copy called'
- if not default:
- default = {}
- default.update({
- 'state':'draft',
- 'invoiced':0,
- 'invoice_lines':[],
- })
- return super(purchase_order_line, self).copy_data(cr, uid, id, default, context)
-
- def action_confirm(self, cr, uid, ids, context={}):
- self.write(cr, uid, ids, {'state': 'confirmed'}, context)
- return True
-purchase_order_line()
-
-class purchase_order(osv.osv):
- _inherit='purchase.order'
- def action_invoice_create(self, cr, uid, ids, context={}):
- print 'Invoice Create'
- res = super(purchase_order, self).action_invoice_create(cr, uid, ids, context)
- for po in self.browse(cr, uid, ids, context):
- todo = []
- for line in po.order_line:
- todo.append(line.id)
- self.pool.get('purchase.order.line').write(cr, uid, todo, {'invoiced':True}, context)
- return res
-
- def wkf_confirm_order(self, cr, uid, ids, context={}):
- res = super(purchase_order, self).wkf_confirm_order(cr, uid, ids, context)
- todo = []
- for po in self.browse(cr, uid, ids, context):
- for line in po.order_line:
- if line.state=='draft':
- todo.append(line.id)
- self.pool.get('purchase.order.line').action_confirm(cr, uid, todo, context)
- return res
-purchase_order()
diff --git a/addons/purchase_manual/purchase_manual_view.xml b/addons/purchase_manual/purchase_manual_view.xml
deleted file mode 100644
index 114ae173e1b..00000000000
--- a/addons/purchase_manual/purchase_manual_view.xml
+++ /dev/null
@@ -1,103 +0,0 @@
-
-
-
-
- #
- # Define PO Line Views
- #
-
-
- purchase.order.form
- purchase.order
- form
-
-
-
-
-
-
-
-
-
-
- purchase.order.line.form
- purchase.order.line
- form
-
- 17
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- purchase.order.line.tree
- purchase.order.line
- tree
-
-
-
-
-
-
-
-
-
- #
- # Inherit PO view to get buttons
- #
-
-
- Purchase Order Lines
- ir.actions.act_window
- purchase.order.line
- tree,form
-
-
-
- tree
-
-
-
-
-
- form
-
-
-
-
-
- Uninvoiced Purchase Order Lines
- ir.actions.act_window
- purchase.order.line
- [('state','in',('confirmed','done')), ('invoiced','=',False)]
- form
- tree,form
-
-
-
- tree
-
-
-
-
-
- form
-
-
-
-
-
-
diff --git a/addons/purchase_manual/purchase_manual_wizard.xml b/addons/purchase_manual/purchase_manual_wizard.xml
deleted file mode 100644
index 62771cf9fbb..00000000000
--- a/addons/purchase_manual/purchase_manual_wizard.xml
+++ /dev/null
@@ -1,14 +0,0 @@
-
-
-
-
-
-
-
-
diff --git a/addons/purchase_manual/wizard/wizard_purchase_line_invoice.py b/addons/purchase_manual/wizard/wizard_purchase_line_invoice.py
deleted file mode 100644
index 0e30368d41b..00000000000
--- a/addons/purchase_manual/wizard/wizard_purchase_line_invoice.py
+++ /dev/null
@@ -1,162 +0,0 @@
-# -*- coding: utf-8 -*-
-##############################################################################
-#
-# OpenERP, Open Source Management Solution
-# Copyright (C) 2004-2010 Tiny SPRL ().
-#
-# This program is free software: you can redistribute it and/or modify
-# it under the terms of the GNU Affero General Public License as
-# published by the Free Software Foundation, either version 3 of the
-# License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# 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 .
-#
-##############################################################################
-
-import wizard
-import netsvc
-import ir
-import pooler
-from osv import osv
-from tools.translate import _
-
-invoice_form = """
-
-"""
-
-invoice_fields = {
-}
-
-def _makeInvoices(self, cr, uid, data, context):
- pool = pooler.get_pool(cr.dbname)
- res = False
- invoices = {}
-
- def make_invoice(order, lines):
- a = order.partner_id.property_account_payable.id
- if order.partner_id and order.partner_id.property_payment_term.id:
- pay_term = order.partner_id.property_payment_term.id
- else:
- pay_term = False
- inv = {
- 'name': order.name,
- 'origin': order.name,
- 'type': 'in_invoice',
- 'reference': "P%dPO%d" % (order.partner_id.id, order.id),
- 'account_id': a,
- 'partner_id': order.partner_id.id,
- 'address_invoice_id': order.partner_address_id.id,
- 'address_contact_id': order.partner_address_id.id,
- 'invoice_line': [(6,0,lines)],
- 'currency_id' : order.pricelist_id.currency_id.id,
- 'comment': order.notes,
- 'payment_term': pay_term,
- 'fiscal_position': order.partner_id.property_account_position.id
- }
- inv_id = pool.get('account.invoice').create(cr, uid, inv)
- return inv_id
-
- for line in pool.get('purchase.order.line').browse(cr,uid,data['ids']):
- if (not line.invoiced) and (line.state not in ('draft','cancel')):
- if not line.order_id.id in invoices:
- invoices[line.order_id.id] = []
- if line.product_id:
- a = line.product_id.product_tmpl_id.property_account_expense.id
- if not a:
- a = line.product_id.categ_id.property_account_expense_categ.id
- if not a:
- raise osv.except_osv(_('Error !'),
- _('There is no expense account defined ' \
- 'for this product: "%s" (id:%d)') % \
- (line.product_id.name, line.product_id.id,))
- else:
- a = pool.get('ir.property').get(cr, uid,
- 'property_account_expense_categ', 'product.category',
- context=context)
- fpos = line.order_id.fiscal_position or False
- a = pool.get('account.fiscal.position').map_account(cr, uid, fpos, a)
- inv_id = pool.get('account.invoice.line').create(cr, uid, {
- 'name': line.name,
- 'origin': line.order_id.name,
- 'account_id': a,
- 'price_unit': line.price_unit,
- 'quantity': line.product_qty,
- 'uos_id': line.product_uom.id,
- 'product_id': line.product_id.id or False,
- 'invoice_line_tax_id': [(6, 0, [x.id for x in line.taxes_id])],
- 'note': line.notes,
- 'account_analytic_id': line.account_analytic_id and line.account_analytic_id.id or False,
- })
- cr.execute('insert into purchase_order_line_invoice_rel (order_line_id,invoice_id) values (%s,%s)', (line.id, inv_id))
- pool.get('purchase.order.line').write(cr, uid, [line.id], {'invoiced': True})
- invoices[line.order_id.id].append((line,inv_id))
-
- res = []
- for result in invoices.values():
- order = result[0][0].order_id
- il = map(lambda x: x[1], result)
- res.append(make_invoice(order, il))
- return {'invoice_ids': res}
-
- return {
- 'domain': "[('id','in', ["+','.join(map(str,res))+"])]",
- 'name': _('Supplier Invoices'),
- 'view_type': 'form',
- 'view_mode': 'tree,form',
- 'res_model': 'account.invoice',
- 'view_id': False,
- 'context': "{'type':'in_invoice'}",
- 'type': 'ir.actions.act_window'
- }
-
-class line_make_invoice(wizard.interface):
- def _open_invoice(self, cr, uid, data, context):
- pool_obj = pooler.get_pool(cr.dbname)
- model_data_ids = pool_obj.get('ir.model.data').search(cr,uid,[('model','=','ir.ui.view'),('name','=','invoice_supplier_form')])
- resource_id = pool_obj.get('ir.model.data').read(cr,uid,model_data_ids,fields=['res_id'])[0]['res_id']
- return {
- 'domain': "[('id','in', ["+','.join(map(str,data['form']['invoice_ids']))+"])]",
- 'name': 'Invoices',
- 'view_type': 'form',
- 'view_mode': 'tree,form',
- 'res_model': 'account.invoice',
- 'views': [(False,'tree'),(resource_id,'form')],
- 'context': "{'type':'in_invoice'}",
- 'type': 'ir.actions.act_window'
- }
-
- states = {
- 'init' : {
- 'actions': [],
- 'result': {
- 'type': 'form',
- 'arch': invoice_form,
- 'fields': invoice_fields,
- 'state': [
- ('end', 'Cancel'),
- ('invoice', 'Create invoices')
- ]
- }
- },
- 'invoice' : {
- 'actions' : [_makeInvoices],
- 'result' : {'type': 'state', 'state': 'open'}
- },
- 'open': {
- 'actions': [],
- 'result': {'type':'action', 'action':_open_invoice, 'state':'end'}
- }
- }
-
-line_make_invoice("purchase.order.line.make_invoice")
-
-# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
-
diff --git a/addons/purchase_requisition/__init__.py b/addons/purchase_requisition/__init__.py
index 866ff813cff..ea44f749bbf 100644
--- a/addons/purchase_requisition/__init__.py
+++ b/addons/purchase_requisition/__init__.py
@@ -19,4 +19,6 @@
##############################################################################
import purchase_requisition
+import wizard
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
diff --git a/addons/purchase_requisition/__openerp__.py b/addons/purchase_requisition/__openerp__.py
index 7dfe7815e46..c5a9435379c 100644
--- a/addons/purchase_requisition/__openerp__.py
+++ b/addons/purchase_requisition/__openerp__.py
@@ -31,7 +31,10 @@
"depends" : ["purchase","mrp"],
"init_xml" : [],
"demo_xml" : [],
- "update_xml" : ["purchase_requisition_view.xml","security/ir.model.access.csv","purchase_requisition_sequence.xml"],
+ "update_xml" : ["wizard/purchase_requisition_partner_view.xml",
+ "purchase_requisition_view.xml",
+ "security/ir.model.access.csv","purchase_requisition_sequence.xml"],
+
"active": False,
"installable": True
}
diff --git a/addons/purchase_requisition/purchase_requisition.py b/addons/purchase_requisition/purchase_requisition.py
index 4a8fc7aadca..fe72c96d7e2 100644
--- a/addons/purchase_requisition/purchase_requisition.py
+++ b/addons/purchase_requisition/purchase_requisition.py
@@ -36,16 +36,41 @@ class purchase_requisition(osv.osv):
'user_id': fields.many2one('res.users', 'Responsible'),
'exclusive': fields.selection([('exclusive','Purchase Tender (exclusive)'),('multiple','Multiple Requisitions')],'Requisition Type', help="If the requisition is exclusive, it will cancel all purchase orders when you confirm one of them", required=True),
'description': fields.text('Description'),
+ 'company_id': fields.many2one('res.company', 'Company', required=True),
'purchase_ids' : fields.one2many('purchase.order','requisition_id','Purchase Orders'),
'line_ids' : fields.one2many('purchase.requisition.line','requisition_id','Products to Purchase'),
- 'state': fields.selection([('draft','Draft'),('open','Open'),('cancel','Cancelled'),('close','Close')], 'State', required=True)
+ 'state': fields.selection([('draft','Draft'),('in_progress','In Progress'),('cancel','Cancelled'),('done','Done')], 'State', required=True)
}
_defaults = {
'date_start': lambda *args: time.strftime('%Y-%m-%d %H:%M:%S'),
- 'state': lambda *args: 'open',
+ 'state': lambda *args: 'draft',
'exclusive': lambda *args: 'multiple',
+ 'company_id': lambda self,cr,uid,c: self.pool.get('res.users').browse(cr, uid, uid, c).company_id.id,
+ 'user_id': lambda self,cr,uid,c: self.pool.get('res.users').browse(cr, uid, uid, c).id ,
'name': lambda obj, cr, uid, context: obj.pool.get('ir.sequence').get(cr, uid, 'purchase.order.requisition'),
}
+
+
+ def tender_cancel(self, cr, uid, ids, context={}):
+ purchase_order_obj = self.pool.get('purchase.order')
+ for purchase in self.browse(cr, uid, ids):
+ for purchase_id in purchase.purchase_ids:
+ if str(purchase_id.state) in('draft','wait'):
+ purchase_order_obj.action_cancel(cr,uid,[purchase_id.id])
+ self.write(cr, uid, ids, {'state': 'cancel'})
+ return True
+ def tender_in_progress(self, cr, uid, ids, context={}):
+ self.write(cr, uid, ids, {'state':'in_progress'} ,context=context)
+ return True
+ def tender_reset(self, cr, uid, ids, context={}):
+ self.write(cr, uid, ids, {'state': 'draft'})
+ return True
+ def tender_done(self, cr, uid, ids, context={}):
+ self.write(cr, uid, ids, {'state':'done', 'date_end':time.strftime('%Y-%m-%d %H:%M:%S')}, context=context)
+ return True
+
+
+
purchase_requisition()
class purchase_requisition_line(osv.osv):
@@ -53,13 +78,36 @@ class purchase_requisition_line(osv.osv):
_description="Purchase Requisition Line"
_rec_name = 'product_id'
_columns = {
- 'product_id': fields.many2one('product.product', 'Product'),
+ 'product_id': fields.many2one('product.product', 'Product' , domain=[('purchase_requisition', '=', True)]),
'product_uom_id': fields.many2one('product.uom', 'Product UoM'),
- 'product_qty': fields.float('Date End', digits=(16,2)),
+ 'product_qty': fields.float('Quantity', digits=(16,2)),
+ 'requisition_id' : fields.many2one('purchase.requisition','Purchase Requisition', ondelete='cascade'),
+ 'company_id': fields.many2one('res.company', 'Company', required=True),
'requisition_id' : fields.many2one('purchase.requisition','Purchase Requisition', ondelete='cascade')
}
+
+ def onchange_product_id(self, cr, uid, ids, product_id, context={}):
+
+ """ Changes UoM and name if product_id changes.
+ @param name: Name of the field
+ @param product_id: Changed product_id
+ @return: Dictionary of changed values
+ """
+ value = {}
+
+ if product_id:
+ prod = self.pool.get('product.product').browse(cr, uid, [product_id])[0]
+
+ value = {'product_uom_id': prod.uom_id.id}
+
+ return {'value': value}
+ _defaults = {
+ 'company_id': lambda self,cr,uid,c: self.pool.get('res.users').browse(cr, uid, uid, c).company_id.id,
+ }
+
purchase_requisition_line()
+
class purchase_order(osv.osv):
_inherit = "purchase.order"
_description = "purchase order"
@@ -74,8 +122,11 @@ class purchase_order(osv.osv):
if order.id<>po.id:
wf_service = netsvc.LocalService("workflow")
wf_service.trg_validate(uid, 'purchase.order', order.id, 'purchase_cancel', cr)
- self.pool.get('purchase.requisition').write(cr, uid, [po.requisition_id.id], {'state':'close'})
+ self.pool.get('purchase.requisition').write(cr, uid, [po.requisition_id.id], {'state':'close','date_end':time.strftime('%Y-%m-%d %H:%M:%S')})
+
return res
+
+
purchase_order()
@@ -93,15 +144,16 @@ product_product()
class mrp_procurement(osv.osv):
_inherit = 'mrp.procurement'
def make_po(self, cr, uid, ids, context={}):
+ sequence_obj=self.pool.get('ir.sequence')
res = super(mrp_procurement, self).make_po(cr, uid, ids, context)
for proc_id,po_id in res.items():
procurement = self.browse(cr, uid, proc_id)
if procurement.product_id.purchase_requisition:
self.pool.get('purchase.requisition').create(cr, uid, {
- 'name': procurement.name,
+ 'name': sequence_obj.get(cr, uid, 'purchase.order.requisition'),
'origin': procurement.name,
'date_end': procurement.date_planned,
- 'lines_ids': [(0,0,{
+ 'line_ids': [(0,0,{
'product_id': procurement.product_id.id,
'product_uom_id': procurement.product_uom.id,
'product_qty': procurement.product_qty
diff --git a/addons/purchase_requisition/purchase_requisition_view.xml b/addons/purchase_requisition/purchase_requisition_view.xml
index 8136defe1e4..eaf433051c0 100644
--- a/addons/purchase_requisition/purchase_requisition_view.xml
+++ b/addons/purchase_requisition/purchase_requisition_view.xml
@@ -39,30 +39,47 @@
+
+
-
-
+
+
+
-
-
+
+
+
+
+
+
-
+
+
+
+
+
+
+
+
+
+
@@ -81,11 +98,42 @@
+
+
+ purchase.requisition.list.select
+ purchase.requisition
+ search
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Purchase Requisitions
ir.actions.act_window
purchase.requisition
form
+ tree,form
+