diff --git a/addons/account/__terp__.py b/addons/account/__terp__.py
index 1c58efb161f..4a19883ac4b 100644
--- a/addons/account/__terp__.py
+++ b/addons/account/__terp__.py
@@ -42,9 +42,18 @@
'security/account_security.xml',
'security/ir.model.access.csv',
'account_menuitem.xml',
+ 'wizard/account_invoice_refund_view.xml',
+ 'wizard/account_period_close_view.xml',
+ 'wizard/account_fiscalyear_close_state.xml',
+ 'wizard/account_chart_view.xml',
+ 'wizard/account_move_bank_reconcile_view.xml',
+ 'wizard/account_move_line_reconcile_select_view.xml',
+ 'wizard/account_move_journal_view.xml',
+
'account_wizard.xml',
'account_view.xml',
'account_end_fy.xml',
+
'account_invoice_view.xml',
'account_report.xml',
'partner_view.xml',
diff --git a/addons/account/account_invoice_view.xml b/addons/account/account_invoice_view.xml
index c82e0a7fd9a..78e7244996e 100644
--- a/addons/account/account_invoice_view.xml
+++ b/addons/account/account_invoice_view.xml
@@ -191,14 +191,18 @@
-
+
+
+
+
+
@@ -281,13 +285,16 @@
-
+
-
+
+
+
+
diff --git a/addons/account/account_view.xml b/addons/account/account_view.xml
index 3ef24386c2d..4723f2b890f 100644
--- a/addons/account/account_view.xml
+++ b/addons/account/account_view.xml
@@ -81,6 +81,10 @@
+
+
@@ -667,9 +671,8 @@
-
-
-
+
+
@@ -1079,8 +1082,11 @@
groups="group_account_user"/>
-
-
+
+
+
-
+
-
+
+ sequence="1"/>-->
-
+
-
-
+
-
+
-
-
+
diff --git a/addons/account/wizard/__init__.py b/addons/account/wizard/__init__.py
index 7d6e7b1226d..96ac24e02cd 100644
--- a/addons/account/wizard/__init__.py
+++ b/addons/account/wizard/__init__.py
@@ -19,17 +19,14 @@
#
##############################################################################
+# OLD Wizards
import wizard_automatic_reconcile
-import wizard_reconcile_select
import wizard_unreconcile_select
import wizard_reconcile
import wizard_unreconcile
-import wizard_refund
import wizard_pay_invoice
-import wizard_journal
import wizard_journal_select
-import wizard_bank_reconcile
import wizard_subscription_generate
import wizard_aged_trial_balance
@@ -38,9 +35,8 @@ import wizard_third_party_ledger
import wizard_account_balance_report
import wizard_partner_balance_report
-import wizard_period_close
import wizard_fiscalyear_close
-import wizard_fiscalyear_close_state
+#import wizard_fiscalyear_close_state
import wizard_open_closed_fiscalyear
import wizard_vat
@@ -48,7 +44,6 @@ import wizard_compare_account_balance_report
import wizard_invoice_state
import wizard_account_duplicate
-import wizard_account_chart
import wizard_move_line_select
import wizard_validate_account_move
@@ -62,7 +57,12 @@ import wizard_central_journal
import wizard_general_journal
import wizard_change_currency
-# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
+import account_invoice_refund
+import account_period_close
+import account_fiscalyear_close_state
+import account_chart
+import account_move_bank_reconcile
+import account_move_line_reconcile_select
+import account_move_journal
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
-
diff --git a/addons/account/wizard/account_chart.py b/addons/account/wizard/account_chart.py
new file mode 100644
index 00000000000..fddb6bc0474
--- /dev/null
+++ b/addons/account/wizard/account_chart.py
@@ -0,0 +1,87 @@
+# -*- 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
+from tools.translate import _
+import netsvc
+import pooler
+import time
+import tools
+import wizard
+
+class account_chart(osv.osv_memory):
+ """
+ For Chart of Accounrs
+ """
+
+ def _get_defaults(self, cr, uid, context):
+
+ """Return default Fiscalyear value"""
+
+ fiscalyear_obj = self.pool.get('account.fiscalyear')
+ fiscalyear = fiscalyear_obj.find(cr, uid)
+ return fiscalyear
+
+ def _account_chart_open_window(self, cr, uid, ids, context):
+ """
+ Opens chart of Accounts
+ @param cr: the current row, from the database cursor,
+ @param uid: the current user’s ID for security checks,
+ @param ids: List of account chart’s IDs
+ @return: dictionary of Open account chart window on given fiscalyear and all Entries or posted entries
+ """
+
+ for data in self.read(cr, uid, ids):
+ mod_obj = self.pool.get('ir.model.data')
+ act_obj = self.pool.get('ir.actions.act_window')
+
+ result = mod_obj._get_id(cr, uid, 'account', 'action_account_tree')
+ id = mod_obj.read(cr, uid, [result], ['res_id'])[0]['res_id']
+ result = act_obj.read(cr, uid, [id], context=context)[0]
+ result['context'] = str({'fiscalyear': data['fiscalyear'], \
+ 'state': data['target_move']})
+ if data['fiscalyear']:
+ result['name'] += ':' + self.pool.get('account.fiscalyear').read(cr, uid, [data['fiscalyear']])[0]['code']
+
+ return result
+
+
+ _name = "account.chart"
+ _description = "chart"
+ _columns = {
+ 'fiscalyear': fields.many2one('account.fiscalyear', \
+ 'Fiscal year', required=True, \
+ help = 'Keep empty for all open fiscal years'),
+ 'target_move': fields.selection([
+ ('all', 'All Entries'),
+ ('posted', 'All Posted Entries'),
+ ], 'Target Moves', required = True),
+
+ }
+ _defaults = {
+ 'fiscalyear': _get_defaults,
+ 'target_move': lambda * a: 'all'
+ }
+
+account_chart()
+
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
+
diff --git a/addons/account/wizard/account_chart_view.xml b/addons/account/wizard/account_chart_view.xml
new file mode 100644
index 00000000000..ae89dfb9945
--- /dev/null
+++ b/addons/account/wizard/account_chart_view.xml
@@ -0,0 +1,40 @@
+
+
+
+
+
+ account.chart.form
+ account.chart
+ form
+
+
+
+
+
+
+ Chart of Accounts
+ account.chart
+ form
+ tree,form
+
+ new
+
+
+
+
+
diff --git a/addons/account/wizard/account_fiscalyear_close_state.py b/addons/account/wizard/account_fiscalyear_close_state.py
new file mode 100644
index 00000000000..8468bcf2635
--- /dev/null
+++ b/addons/account/wizard/account_fiscalyear_close_state.py
@@ -0,0 +1,70 @@
+# -*- 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
+from tools.translate import _
+import netsvc
+import pooler
+import time
+import tools
+import wizard
+
+class account_fiscalyear_close_state(osv.osv_memory):
+ """
+ Closes Account Fiscalyear
+ """
+ _name = "account.fiscalyear.close.state"
+ _description = "Fiscalyear Close state"
+ _columns = {
+ 'fy_id': fields.many2one('account.fiscalyear', \
+ 'Fiscal Year to close', required=True),
+ 'sure': fields.boolean('Check this box', required=False)
+ }
+
+ def _data_save(self, cr, uid, ids, context):
+ """
+ This function close account fiscalyear
+ @param cr: the current row, from the database cursor,
+ @param uid: the current user’s ID for security checks,
+ @param ids: List of Account fiscalyear close state’s IDs
+
+ """
+ for data in self.read(cr, uid, ids):
+ if not data['sure']:
+ raise osv.except_osv(_('UserError'), _('Closing of states \
+cancelled, please check the box !'))
+ fy_id = data['fy_id']
+
+ cr.execute('UPDATE account_journal_period ' \
+ 'SET state = %s ' \
+ 'WHERE period_id IN (SELECT id FROM account_period \
+ WHERE fiscalyear_id = %s)',
+ ('done', fy_id))
+ cr.execute('UPDATE account_period SET state = %s ' \
+ 'WHERE fiscalyear_id = %s', ('done', fy_id))
+ cr.execute('UPDATE account_fiscalyear ' \
+ 'SET state = %s WHERE id = %s', ('done', fy_id))
+ return {}
+
+account_fiscalyear_close_state()
+
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
+
diff --git a/addons/account/wizard/account_fiscalyear_close_state.xml b/addons/account/wizard/account_fiscalyear_close_state.xml
new file mode 100644
index 00000000000..d6fe49c9b2c
--- /dev/null
+++ b/addons/account/wizard/account_fiscalyear_close_state.xml
@@ -0,0 +1,39 @@
+
+
+
+
+ account.fiscalyear.close.state.form
+ account.fiscalyear.close.state
+ form
+
+
+
+
+
+
+ Close a Fiscal Year
+ account.fiscalyear.close.state
+ form
+ tree,form
+
+ new
+
+
+
+
+
+
diff --git a/addons/account/wizard/account_invoice_refund.py b/addons/account/wizard/account_invoice_refund.py
new file mode 100644
index 00000000000..162d21a9654
--- /dev/null
+++ b/addons/account/wizard/account_invoice_refund.py
@@ -0,0 +1,214 @@
+# -*- 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
+from tools.translate import _
+import netsvc
+import pooler
+import time
+import tools
+import wizard
+
+class account_invoice_refund(osv.osv_memory):
+
+ """Refunds invoice."""
+
+ _name = "account.invoice.refund"
+ _description = "Invoice Refund"
+ _columns = {
+ 'date': fields.date('Operation date', required=False),
+ 'period': fields.many2one('account.period', 'Force period', required=False),
+ 'description': fields.char('Description', size=150, required=True),
+ }
+
+ def _compute_refund(self, cr, uid, ids, mode, context):
+ """
+ @param cr: the current row, from the database cursor,
+ @param uid: the current user’s ID for security checks,
+ @param ids: the account invoice refund’s ID or list of IDs
+
+ """
+
+ inv_obj = self.pool.get('account.invoice')
+ for form in self.read(cr, uid, ids):
+ reconcile_obj = self.pool.get('account.move.reconcile')
+ account_m_line_obj = self.pool.get('account.move.line')
+ created_inv = []
+ date = False
+ period = False
+ description = False
+ for inv in inv_obj.browse(cr, uid, context['active_ids']):
+ if inv.state in ['draft', 'proforma2', 'cancel']:
+ raise osv.except_osv(_('Error !'), _('Can not %s draft/proforma/cancel invoice.') % (mode))
+ if form['period'] :
+ period = form['period']
+ else:
+ period = inv.period_id and inv.period_id.id or False
+
+ if form['date'] :
+ date = form['date']
+ if not form['period'] :
+ cr.execute("select name from ir_model_fields \
+ where model = 'account.period' \
+ and name = 'company_id'")
+ result_query = cr.fetchone()
+ if result_query:
+ #in multi company mode
+ cr.execute("""SELECT id
+ from account_period where date('%s')
+ between date_start AND date_stop \
+ and company_id = %s limit 1 """,
+ (form['date'], self.pool.get('res.users').browse(cr, uid, uid).company_id.id,))
+ else:
+ #in mono company mode
+ cr.execute("""SELECT id
+ from account_period where date('%s')
+ between date_start AND date_stop \
+ limit 1 """, (form['date'],))
+ res = cr.fetchone()
+ if res:
+ period = res[0]
+ else:
+ date = inv.date_invoice
+
+ if form['description'] :
+ description = form['description']
+ else:
+ description = inv.name
+
+ if not period:
+ raise osv.except_osv(_('Data Insufficient !'), \
+ _('No Period found on Invoice!'))
+
+ refund_id = inv_obj.refund(cr, uid, [inv.id], date, period, description)
+ refund = inv_obj.browse(cr, uid, refund_id[0])
+ # we compute due date
+ #!!!due date = date inv date on formdate
+ inv_obj.write(cr, uid, [refund.id], {'date_due': date,
+ 'check_total': inv.check_total})
+ # to make the taxes calculated
+ inv_obj.button_compute(cr, uid, refund_id)
+
+ created_inv.append(refund_id[0])
+ #if inv is paid we unreconcile
+ if mode in ('cancel', 'modify'):
+ movelines = inv.move_id.line_id
+ #we unreconcile the lines
+ to_reconcile_ids = {}
+ for line in movelines :
+ #if the account of the line is the as the one in the invoice
+ #we reconcile
+ if line.account_id.id == inv.account_id.id :
+ to_reconcile_ids[line.account_id.id] = [line.id]
+ if type(line.reconcile_id) != osv.orm.browse_null :
+ reconcile_obj.unlink(cr, uid, line.reconcile_id.id)
+ #we advance the workflow of the refund to open
+ wf_service = netsvc.LocalService('workflow')
+ wf_service.trg_validate(uid, 'account.invoice', \
+ refund.id, 'invoice_open', cr)
+ #we reload the browse record
+ refund = inv_obj.browse(cr, uid, refund_id[0])
+ #we match the line to reconcile
+ for tmpline in refund.move_id.line_id :
+ if tmpline.account_id.id == inv.account_id.id :
+ to_reconcile_ids[tmpline.account_id.id].append(tmpline.id)
+ for account in to_reconcile_ids :
+ account_m_line_obj.reconcile(cr, uid, to_reconcile_ids[account],
+ writeoff_period_id=period,
+ writeoff_journal_id=inv.journal_id.id,
+ writeoff_acc_id=inv.account_id.id
+ )
+ #we create a new invoice that is the copy of the original
+ if mode == 'modify' :
+ invoice = inv_obj.read(cr, uid, [inv.id],
+ ['name', 'type', 'number', 'reference',
+ 'comment', 'date_due', 'partner_id',
+ 'address_contact_id', 'address_invoice_id',
+ 'partner_insite', 'partner_contact',
+ 'partner_ref', 'payment_term', 'account_id',
+ 'currency_id', 'invoice_line', 'tax_line',
+ 'journal_id', 'period_id'])
+ invoice = invoice[0]
+ del invoice['id']
+ invoice_lines = self.pool.get('account.invoice.line').read(cr, uid, invoice['invoice_line'])
+ invoice_lines = inv_obj._refund_cleanup_lines(cr, uid, invoice_lines)
+ tax_lines = self.pool.get('account.invoice.tax').read(
+ cr, uid, invoice['tax_line'])
+ tax_lines = inv_obj._refund_cleanup_lines(cr, uid, tax_lines)
+
+ invoice.update({
+ 'type': inv.type,
+ 'date_invoice': date,
+ 'state': 'draft',
+ 'number': False,
+ 'invoice_line': invoice_lines,
+ 'tax_line': tax_lines,
+ 'period_id': period,
+ 'name': description
+ })
+
+ #take the id part of the tuple returned for many2one fields
+ for field in ('address_contact_id', 'address_invoice_id', 'partner_id',
+ 'account_id', 'currency_id', 'payment_term', 'journal_id'):
+ invoice[field] = invoice[field] and invoice[field][0]
+
+ # create the new invoice
+ inv_id = inv_obj.create(cr, uid, invoice, {})
+ # we compute due date
+ if inv.payment_term.id:
+ data = inv_obj.onchange_payment_term_date_invoice(cr, uid, [inv_id], inv.payment_term.id, date)
+ if 'value' in data and data['value']:
+ inv_obj.write(cr, uid, [inv_id], data['value'])
+ created_inv.append(inv_id)
+
+ #we get the view id
+ mod_obj = self.pool.get('ir.model.data')
+ act_obj = self.pool.get('ir.actions.act_window')
+ if inv.type == 'out_invoice':
+ xml_id = 'action_invoice_tree1'
+ elif inv.type == 'in_invoice':
+ xml_id = 'action_invoice_tree2'
+ elif type == 'out_refund':
+ xml_id = 'action_invoice_tree3'
+ else:
+ xml_id = 'action_invoice_tree4'
+ #we get the model
+ result = mod_obj._get_id(cr, uid, 'account', xml_id)
+ id = mod_obj.read(cr, uid, result, ['res_id'])['res_id']
+ # we read the act window
+ result = act_obj.read(cr, uid, id)
+ result['res_id'] = created_inv
+
+ return result
+
+ def _invoice_refund(self, cr, uid, ids, context):
+ return self._compute_refund(cr, uid, ids, 'refund', context)
+
+ def _invoice_cancel(self, cr, uid, ids, context):
+ return self._compute_refund(cr, uid, ids, 'cancel', context)
+
+ def _invoice_modify(self, cr, uid, ids, context):
+ return self._compute_refund(cr, uid, ids, 'modify', context)
+
+account_invoice_refund()
+
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
+
diff --git a/addons/account/wizard/account_invoice_refund_view.xml b/addons/account/wizard/account_invoice_refund_view.xml
new file mode 100644
index 00000000000..0d2bb036c06
--- /dev/null
+++ b/addons/account/wizard/account_invoice_refund_view.xml
@@ -0,0 +1,40 @@
+
+
+
+
+
+ account.invoice.refund.form
+ account.invoice.refund
+ form
+
+
+
+
+
+
+ Credit Note
+ account.invoice.refund
+ form
+ tree,form
+
+ new
+
+
+
+
\ No newline at end of file
diff --git a/addons/account/wizard/account_move_bank_reconcile.py b/addons/account/wizard/account_move_bank_reconcile.py
new file mode 100644
index 00000000000..a39f500eac8
--- /dev/null
+++ b/addons/account/wizard/account_move_bank_reconcile.py
@@ -0,0 +1,67 @@
+# -*- 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
+from tools.translate import _
+import netsvc
+import pooler
+import time
+import tools
+import wizard
+
+class account_move_bank_reconcile(osv.osv_memory):
+ """
+ Bank Reconciliation
+ """
+ _name = "account.move.bank.reconcile"
+ _description = "Move bank reconcile"
+ _columns = {
+ 'journal_id': fields.many2one('account.journal', 'Journal', required=True),
+ }
+
+ def _action_open_window(self, cr, uid, ids, context):
+ """
+ @param cr: the current row, from the database cursor,
+ @param uid: the current user’s ID for security checks,
+ @param ids: account move bank reconcile’s ID or list of IDs
+ @return: dictionary of Open account move line on given journal_id.
+ """
+ for data in self.read(cr, uid, ids):
+ cr.execute('select default_credit_account_id \
+ from account_journal where id=%s', (data['journal_id'],))
+ account_id = cr.fetchone()[0]
+ if not account_id:
+ raise osv.except_osv(_('Error'), _('You have to define \
+the bank account\nin the journal definition for reconciliation.'))
+ return {
+ 'domain': "[('journal_id','=',%d), ('account_id','=',%d), ('state','<>','draft')]" % (data['journal_id'], account_id),
+ 'name': _('Standard Encoding'),
+ 'view_type': 'form',
+ 'view_mode': 'tree,form',
+ 'res_model': 'account.move.line',
+ 'view_id': False,
+ 'context': "{'journal_id': %d}" % (data['journal_id'],),
+ 'type': 'ir.actions.act_window'
+ }
+
+account_move_bank_reconcile()
+
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
diff --git a/addons/account/wizard/account_move_bank_reconcile_view.xml b/addons/account/wizard/account_move_bank_reconcile_view.xml
new file mode 100644
index 00000000000..5a542a7e270
--- /dev/null
+++ b/addons/account/wizard/account_move_bank_reconcile_view.xml
@@ -0,0 +1,33 @@
+
+
+
+
+ account.move.bank.reconcile.form
+ account.move.bank.reconcile
+ form
+
+
+
+
+
+
+ Bank reconciliation
+ account.move.bank.reconcile
+ form
+ tree,form
+
+ new
+
+
+
+
diff --git a/addons/account/wizard/account_move_journal.py b/addons/account/wizard/account_move_journal.py
new file mode 100644
index 00000000000..08aef8ca544
--- /dev/null
+++ b/addons/account/wizard/account_move_journal.py
@@ -0,0 +1,102 @@
+# -*- 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
+from tools.translate import _
+import netsvc
+import pooler
+import time
+import tools
+import wizard
+
+
+class account_move_journal(osv.osv_memory):
+
+ def _get_period(self, cr, uid, context={}):
+ """Return default account period value"""
+
+ ids = self.pool.get('account.period').find(cr, uid, context=context)
+ period_id = False
+ if len(ids):
+ period_id = ids[0]
+ return period_id
+
+ def _action_open_window(self, cr, uid, ids, context={}):
+ """
+ This function Open action move line window on given period and Journal/Payment Mode
+ @param cr: the current row, from the database cursor,
+ @param uid: the current user’s ID for security checks,
+ @param ids: account move journal’s ID or list of IDs
+ @return: dictionary of Open action move line window on given period and Journal/Payment Mode
+
+ """
+ for data in self.read(cr, uid, ids, ['journal_id', 'period_id']):
+ cr.execute('select id,name from ir_ui_view where model=%s and type=%s', ('account.move.line', 'form'))
+ view_res = cr.fetchone()
+ journal_id = data['journal_id']
+ period_id = data['period_id']
+ jp = self.pool.get('account.journal.period')
+ ids = jp.search(cr, uid, [('journal_id', '=', journal_id), \
+ ('period_id', '=', period_id)])
+
+ if not len(ids):
+ name = self.pool.get('account.journal').read(cr, uid, [journal_id])[0]['name']
+ state = self.pool.get('account.period').read(cr, uid, [period_id])[0]['state']
+ if state == 'done':
+ raise osv.except_osv(_('UserError'), _('This period is already closed !'))
+ company = self.pool.get('account.period').read(cr, uid, [period_id])[0]['company_id'][0]
+ jp.create(cr, uid, {'name': name, 'period_id': period_id, 'journal_id': journal_id, 'company_id': company})
+
+ ids = jp.search(cr, uid, [('journal_id', '=', journal_id), ('period_id', '=', period_id)])
+ jp = jp.browse(cr, uid, ids, context=context)[0]
+ name = (jp.journal_id.code or '') + ':' + (jp.period_id.code or '')
+ mod_obj = self.pool.get('ir.model.data')
+ result = mod_obj._get_id(cr, uid, 'account', 'view_account_move_line_filter')
+ res = mod_obj.read(cr, uid, result, ['res_id'])
+
+ return {
+ 'domain': "[('journal_id','=',%d), ('period_id','=',%d)]" % (journal_id, period_id),
+ 'name': name,
+ 'view_type': 'form',
+ 'view_mode': 'tree,form',
+ 'res_model': 'account.move.line',
+ 'view_id': view_res,
+ 'context': "{'journal_id': %d, 'period_id': %d}" % (journal_id, period_id),
+ 'type': 'ir.actions.act_window',
+ 'search_view_id': res['res_id']
+ }
+
+ _name = "account.move.journal"
+ _description = "Move journal"
+
+ _columns = {
+ 'journal_id': fields.many2one('account.journal', 'Journal/Payment Mode', required=True),
+ 'period_id': fields.many2one('account.period', 'Period', required=True),
+ }
+
+ _defaults = {
+ 'period_id': _get_period
+ }
+
+account_move_journal()
+
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
+
diff --git a/addons/account/wizard/account_move_journal_view.xml b/addons/account/wizard/account_move_journal_view.xml
new file mode 100644
index 00000000000..e32148c9c69
--- /dev/null
+++ b/addons/account/wizard/account_move_journal_view.xml
@@ -0,0 +1,41 @@
+
+
+
+
+
+ account.move.journal.form
+ account.move.journal
+ form
+
+
+
+
+
+
+ Making Entries by Line
+ account.move.journal
+ form
+ tree,form
+
+ new
+
+
+
+
+
+
diff --git a/addons/account/wizard/account_move_line_reconcile_select.py b/addons/account/wizard/account_move_line_reconcile_select.py
new file mode 100644
index 00000000000..f1a72e44b91
--- /dev/null
+++ b/addons/account/wizard/account_move_line_reconcile_select.py
@@ -0,0 +1,61 @@
+# -*- 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
+from tools.translate import _
+import netsvc
+import pooler
+import time
+import tools
+import wizard
+
+class account_move_line_reconcile_select(osv.osv_memory):
+ _name = "account.move.line.reconcile.select"
+ _description = "Move line reconcile select"
+ _columns = {
+ 'account_id': fields.many2one('account.account', 'Account', \
+ domain = [('reconcile', '=', 1)], required=True),
+ }
+
+ def _action_open_window(self, cr, uid, ids, context):
+ """
+ This function Open account move line window for reconcile on given account id
+ @param cr: the current row, from the database cursor,
+ @param uid: the current user’s ID for security checks,
+ @param ids: account move line reconcile select’s ID or list of IDs
+ @return: dictionary of Open account move line window for reconcile on given account id
+
+ """
+ for data in self.read(cr, uid, ids):
+
+ return {
+ 'domain': "[('account_id','=',%d),('reconcile_id','=',False),('state','<>','draft')]" % data['account_id'],
+ 'name': _('Reconciliation'),
+ 'view_type': 'form',
+ 'view_mode': 'tree,form',
+ 'view_id': False,
+ 'res_model': 'account.move.line',
+ 'type': 'ir.actions.act_window'
+ }
+
+account_move_line_reconcile_select()
+
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
diff --git a/addons/account/wizard/account_move_line_reconcile_select_view.xml b/addons/account/wizard/account_move_line_reconcile_select_view.xml
new file mode 100644
index 00000000000..2bb05b2e9ab
--- /dev/null
+++ b/addons/account/wizard/account_move_line_reconcile_select_view.xml
@@ -0,0 +1,40 @@
+
+
+
+
+ account.move.line.reconcile.select.form
+ account.move.line.reconcile.select
+ form
+
+
+
+
+
+ Reconcile entries
+ account.move.line.reconcile.select
+ form
+ tree,form
+
+ new
+
+
+
+
+
+
+
+
diff --git a/addons/account/wizard/account_period_close.py b/addons/account/wizard/account_period_close.py
new file mode 100644
index 00000000000..8ef38faf3cc
--- /dev/null
+++ b/addons/account/wizard/account_period_close.py
@@ -0,0 +1,61 @@
+# -*- 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
+from tools.translate import _
+import netsvc
+import pooler
+import time
+import tools
+import wizard
+
+class account_period_close(osv.osv_memory):
+ """
+ close period
+ """
+ _name = "account.period.close"
+ _description = "period close"
+ _columns = {
+ 'sure': fields.boolean('Check this box', required=False),
+ }
+
+ def _data_save(self, cr, uid, ids, context):
+ """
+ This function close period
+ @param cr: the current row, from the database cursor,
+ @param uid: the current user’s ID for security checks,
+ @param ids: account period close’s ID or list of IDs
+ """
+
+ mode = 'done'
+ for form in self.read(cr, uid, ids):
+ if form['sure']:
+ for id in context['active_ids']:
+ cr.execute('update account_journal_period set state=%s \
+ where period_id=%s', (mode, id))
+ cr.execute('update account_period set state=%s \
+ where id=%s', (mode, id))
+ return {}
+
+account_period_close()
+
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
+
diff --git a/addons/account/wizard/account_period_close_view.xml b/addons/account/wizard/account_period_close_view.xml
new file mode 100644
index 00000000000..fc8c5273a79
--- /dev/null
+++ b/addons/account/wizard/account_period_close_view.xml
@@ -0,0 +1,35 @@
+
+
+
+
+
+ account.period.close.form
+ account.period.close
+ form
+
+
+
+
+
+
+ Close a Period
+ account.period.close
+ form
+ tree,form
+
+ new
+
+
+
+
\ No newline at end of file
diff --git a/addons/account/wizard/wizard_account_chart.py b/addons/account/wizard/wizard_account_chart.py
deleted file mode 100644
index ca8153f3ce7..00000000000
--- a/addons/account/wizard/wizard_account_chart.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 wizard
-import pooler
-
-class wizard_account_chart(wizard.interface):
- _account_chart_arch = '''
- '''
-
- _account_chart_fields = {
- 'fiscalyear': {
- 'string': 'Fiscal year',
- 'type': 'many2one',
- 'relation': 'account.fiscalyear',
- 'help': 'Keep empty for all open fiscal years',
- },
- 'target_move': {
- 'string': 'Target Moves',
- 'type': 'selection',
- 'selection': [('all','All Entries'),('posted','All Posted Entries')],
- 'required': True,
- 'default': lambda *a:"all",
- },
- }
-
- def _get_defaults(self, cr, uid, data, context):
- fiscalyear_obj = pooler.get_pool(cr.dbname).get('account.fiscalyear')
- data['form']['fiscalyear'] = fiscalyear_obj.find(cr, uid)
- return data['form']
-
-
- def _account_chart_open_window(self, cr, uid, data, context):
- mod_obj = pooler.get_pool(cr.dbname).get('ir.model.data')
- act_obj = pooler.get_pool(cr.dbname).get('ir.actions.act_window')
-
- result = mod_obj._get_id(cr, uid, 'account', 'action_account_tree')
- id = mod_obj.read(cr, uid, [result], ['res_id'])[0]['res_id']
- result = act_obj.read(cr, uid, [id], context=context)[0]
- result['context'] = str({'fiscalyear': data['form']['fiscalyear'],'state':data['form']['target_move']})
- if data['form']['fiscalyear']:
- result['name']+=':'+pooler.get_pool(cr.dbname).get('account.fiscalyear').read(cr,uid,[data['form']['fiscalyear']])[0]['code']
- return result
-
- states = {
- 'init': {
- 'actions': [_get_defaults],
- 'result': {'type': 'form', 'arch':_account_chart_arch, 'fields':_account_chart_fields, 'state': [('end', 'Cancel'), ('open', 'Open Charts')]}
- },
- 'open': {
- 'actions': [],
- 'result': {'type': 'action', 'action':_account_chart_open_window, 'state':'end'}
- }
- }
-wizard_account_chart('account.chart')
-
-# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
-
diff --git a/addons/account/wizard/wizard_bank_reconcile.py b/addons/account/wizard/wizard_bank_reconcile.py
deleted file mode 100644
index c081657304a..00000000000
--- a/addons/account/wizard/wizard_bank_reconcile.py
+++ /dev/null
@@ -1,67 +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
-from tools.translate import _
-
-_journal_form = '''
-''' % ('Bank reconciliation',)
-
-_journal_fields = {
- 'journal_id': {'string':'Journal', 'type':'many2one', 'relation':'account.journal', 'required':True},
-}
-
-def _action_open_window(self, cr, uid, data, context):
- form = data['form']
- cr.execute('select default_credit_account_id from account_journal where id=%s', (form['journal_id'],))
- account_id = cr.fetchone()[0]
- if not account_id:
- raise wizard.except_wizard(_('Error'), _('You have to define the bank account\nin the journal definition for reconciliation.'))
- return {
- 'domain': "[('journal_id','=',%d), ('account_id','=',%d), ('state','<>','draft')]" % (form['journal_id'],account_id),
- 'name': _('Standard Encoding'),
-
- 'view_type': 'form',
- 'view_mode': 'tree,form',
- 'res_model': 'account.move.line',
- 'view_id': False,
- 'context': "{'journal_id':%d}" % (form['journal_id'],),
- 'type': 'ir.actions.act_window'
- }
-
-class wiz_journal(wizard.interface):
- states = {
- 'init': {
- 'actions': [],
- 'result': {'type': 'form', 'arch':_journal_form, 'fields':_journal_fields, 'state':[('end','Cancel'),('open','Open for bank reconciliation')]}
- },
- 'open': {
- 'actions': [],
- 'result': {'type': 'action', 'action': _action_open_window, 'state':'end'}
- }
- }
-wiz_journal('account.move.bank.reconcile')
-
-
-# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
-
diff --git a/addons/account/wizard/wizard_fiscalyear_close_state.py b/addons/account/wizard/wizard_fiscalyear_close_state.py
deleted file mode 100644
index 2f8331f2d3e..00000000000
--- a/addons/account/wizard/wizard_fiscalyear_close_state.py
+++ /dev/null
@@ -1,71 +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 osv
-import pooler
-from tools.translate import _
-
-_transaction_form = '''
-'''
-
-_transaction_fields = {
- 'fy_id': {'string':'Fiscal Year to close', 'type':'many2one', 'relation': 'account.fiscalyear','required':True, 'domain':[('state','=','draft')]},
- 'sure': {'string':'Check this box', 'type':'boolean'},
-}
-
-def _data_save(self, cr, uid, data, context):
- if not data['form']['sure']:
- raise wizard.except_wizard(_('UserError'), _('Closing of states cancelled, please check the box !'))
- pool = pooler.get_pool(cr.dbname)
-
- fy_id = data['form']['fy_id']
-
- cr.execute('UPDATE account_journal_period ' \
- 'SET state = %s ' \
- 'WHERE period_id IN (SELECT id FROM account_period WHERE fiscalyear_id = %s)',
- ('done',fy_id))
- cr.execute('UPDATE account_period SET state = %s ' \
- 'WHERE fiscalyear_id = %s', ('done',fy_id))
- cr.execute('UPDATE account_fiscalyear ' \
- 'SET state = %s WHERE id = %s', ('done', fy_id))
- return {}
-
-class wiz_journal_close_state(wizard.interface):
- states = {
- 'init': {
- 'actions': [],
- 'result': {'type': 'form', 'arch':_transaction_form, 'fields':_transaction_fields, 'state':[('end','Cancel'),('close','Close states')]}
- },
- 'close': {
- 'actions': [_data_save],
- 'result': {'type': 'state', 'state':'end'}
- }
- }
-wiz_journal_close_state('account.fiscalyear.close.state')
-
-
-# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
-
diff --git a/addons/account/wizard/wizard_journal.py b/addons/account/wizard/wizard_journal.py
deleted file mode 100644
index fd2b012863e..00000000000
--- a/addons/account/wizard/wizard_journal.py
+++ /dev/null
@@ -1,99 +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
-from osv import osv
-import pooler
-from tools.translate import _
-
-_journal_form = '''
-'''
-
-def _period_get(self, cr, uid, datas, ctx={}):
- try:
- pool = pooler.get_pool(cr.dbname)
- ids = pool.get('account.period').find(cr, uid, context=ctx)
- return {'period_id': ids[0]}
- except:
- return {}
-
-_journal_fields = {
- 'journal_id': {'string':'Journal', 'type':'many2one', 'relation':'account.journal', 'required':True},
- 'period_id': {
- 'string':'Period',
- 'type':'many2one',
- 'relation':'account.period',
- 'required':True,
- }
-}
-
-def _action_open_window(self, cr, uid, data, context):
- form = data['form']
- cr.execute('select id,name from ir_ui_view where model=%s and type=%s', ('account.move.line', 'form'))
- view_res = cr.fetchone()
- jp = pooler.get_pool(cr.dbname).get('account.journal.period')
- ids = jp.search(cr, uid, [('journal_id','=',form['journal_id']), ('period_id','=',form['period_id'])])
- if not len(ids):
- name = pooler.get_pool(cr.dbname).get('account.journal').read(cr, uid, [form['journal_id']])[0]['name']
- state = pooler.get_pool(cr.dbname).get('account.period').read(cr, uid, [form['period_id']])[0]['state']
- if state == 'done':
- raise wizard.except_wizard(_('UserError'), _('This period is already closed !'))
- company = pooler.get_pool(cr.dbname).get('account.period').read(cr, uid, [form['period_id']])[0]['company_id'][0]
- jp.create(cr, uid, {'name':name, 'period_id': form['period_id'], 'journal_id':form['journal_id'], 'company_id':company})
- ids = jp.search(cr, uid, [('journal_id','=',form['journal_id']), ('period_id','=',form['period_id'])])
- jp = jp.browse(cr, uid, ids, context=context)[0]
- name = (jp.journal_id.code or '') + ':' + (jp.period_id.code or '')
-
- mod_obj = pooler.get_pool(cr.dbname).get('ir.model.data')
- result = mod_obj._get_id(cr, uid, 'account', 'view_account_move_line_filter')
- id = mod_obj.read(cr, uid, result, ['res_id'])
- return {
- 'domain': "[('journal_id','=',%d), ('period_id','=',%d)]" % (form['journal_id'],form['period_id']),
- 'name': name,
- 'view_type': 'form',
- 'view_mode': 'tree,form',
- 'res_model': 'account.move.line',
- 'view_id': view_res,
- 'context': "{'journal_id':%d, 'period_id':%d}" % (form['journal_id'],form['period_id']),
- 'type': 'ir.actions.act_window',
- 'search_view_id': id['res_id']
- }
-
-class wiz_journal(wizard.interface):
- states = {
- 'init': {
- 'actions': [_period_get],
- 'result': {'type': 'form', 'arch':_journal_form, 'fields':_journal_fields, 'state':[('end','Cancel'),('open','Open Journal')]}
- },
- 'open': {
- 'actions': [],
- 'result': {'type': 'action', 'action': _action_open_window, 'state':'end'}
- }
- }
-wiz_journal('account.move.journal')
-
-
-# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
-
diff --git a/addons/account/wizard/wizard_period_close.py b/addons/account/wizard/wizard_period_close.py
deleted file mode 100644
index d6ba73683f2..00000000000
--- a/addons/account/wizard/wizard_period_close.py
+++ /dev/null
@@ -1,57 +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
-
-_transaction_form = '''
-'''
-
-_transaction_fields = {
- 'sure': {'string':'Check this box', 'type':'boolean'},
-}
-
-def _data_save(self, cr, uid, data, context):
- mode = 'done'
- if data['form']['sure']:
- for id in data['ids']:
- cr.execute('update account_journal_period set state=%s where period_id=%s', (mode, id))
- cr.execute('update account_period set state=%s where id=%s', (mode, id))
- return {}
-
-class wiz_journal_close(wizard.interface):
- states = {
- 'init': {
- 'actions': [],
- 'result': {'type': 'form', 'arch':_transaction_form, 'fields':_transaction_fields, 'state':[('end','Cancel'),('close','Close Period')]}
- },
- 'close': {
- 'actions': [_data_save],
- 'result': {'type': 'state', 'state':'end'}
- }
- }
-wiz_journal_close('account.period.close')
-
-
-# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
-
diff --git a/addons/account/wizard/wizard_reconcile.py b/addons/account/wizard/wizard_reconcile.py
index 9debe7afbef..6d7de403f79 100644
--- a/addons/account/wizard/wizard_reconcile.py
+++ b/addons/account/wizard/wizard_reconcile.py
@@ -19,13 +19,13 @@
#
##############################################################################
-import wizard
-import netsvc
-import time
-import osv
-import pooler
from datetime import datetime
from tools.translate import _
+import netsvc
+import osv
+import pooler
+import time
+import wizard
_transaction_form = '''
'''
_transaction_fields = {
- 'trans_nbr': {'string':'# of Transaction', 'type':'integer', 'readonly':True},
- 'credit': {'string':'Credit amount', 'type':'float', 'readonly':True},
- 'debit': {'string':'Debit amount', 'type':'float', 'readonly':True},
- 'writeoff': {'string':'Write-Off amount', 'type':'float', 'readonly':True},
+ 'trans_nbr': {'string':'# of Transaction', 'type':'integer', 'readonly':True},
+ 'credit': {'string':'Credit amount', 'type':'float', 'readonly':True},
+ 'debit': {'string':'Debit amount', 'type':'float', 'readonly':True},
+ 'writeoff': {'string':'Write-Off amount', 'type':'float', 'readonly':True},
}
def _trans_rec_get(self, cr, uid, data, context=None):
@@ -83,12 +83,12 @@ def _trans_rec_reconcile(self, cr, uid, data, context=None):
journal_id = form.get('journal_id', False)
context['comment'] = form.get('comment', False)
context['analytic_id'] = form.get('analytic_id', False)
- account_move_line_obj.reconcile(cr, uid, data['ids'], 'manual', account_id,
+ account_move_line_obj.reconcile(cr, uid, data['ids'], 'manual', account_id,
period_id, journal_id, context=context)
return {}
def _partial_check(self, cr, uid, data, context):
- if _trans_rec_get(self,cr,uid, data, context)['writeoff'] == 0:
+ if _trans_rec_get(self, cr, uid, data, context)['writeoff'] == 0:
return 'init_full'
return 'init_partial'
@@ -104,11 +104,11 @@ _transaction_add_form = '''
'''
_transaction_add_fields = {
- 'journal_id': {'string': 'Write-Off Journal', 'type': 'many2one', 'relation':'account.journal', 'required':True},
- 'writeoff_acc_id': {'string':'Write-Off account', 'type':'many2one', 'relation':'account.account', 'required':True},
- 'date_p': {'string':'Date','type':'date'},
- 'comment': {'string':'Comment','type':'char', 'size': 64, 'required':True},
- 'analytic_id': {'string':'Analytic Account', 'type': 'many2one', 'relation':'account.analytic.account'},
+ 'journal_id': {'string': 'Write-Off Journal', 'type': 'many2one', 'relation':'account.journal', 'required':True},
+ 'writeoff_acc_id': {'string':'Write-Off account', 'type':'many2one', 'relation':'account.account', 'required':True},
+ 'date_p': {'string':'Date', 'type':'date'},
+ 'comment': {'string':'Comment', 'type':'char', 'size': 64, 'required':True},
+ 'analytic_id': {'string':'Analytic Account', 'type': 'many2one', 'relation':'account.analytic.account'},
}
def _trans_rec_addendum(self, cr, uid, data, context={}):
@@ -119,27 +119,27 @@ def _trans_rec_addendum(self, cr, uid, data, context={}):
class wiz_reconcile(wizard.interface):
states = {
'init': {
- 'actions': [],
+ 'actions': [],
'result': {'type': 'choice', 'next_state': _partial_check}
- },
+ },
'init_full': {
- 'actions': [_trans_rec_get],
- 'result': {'type': 'form', 'arch':_transaction_form, 'fields':_transaction_fields, 'state':[('end','Cancel'),('reconcile','Reconcile')]}
- },
+ 'actions': [_trans_rec_get],
+ 'result': {'type': 'form', 'arch':_transaction_form, 'fields':_transaction_fields, 'state':[('end', 'Cancel'), ('reconcile', 'Reconcile')]}
+ },
'init_partial': {
- 'actions': [_trans_rec_get],
- 'result': {'type': 'form', 'arch':_transaction_form, 'fields':_transaction_fields, 'state':[('end','Cancel'),('addendum','Reconcile With Write-Off'),('partial','Partial Reconcile')]}
- },
+ 'actions': [_trans_rec_get],
+ 'result': {'type': 'form', 'arch':_transaction_form, 'fields':_transaction_fields, 'state':[('end', 'Cancel'), ('addendum', 'Reconcile With Write-Off'), ('partial', 'Partial Reconcile')]}
+ },
'addendum': {
- 'actions': [_trans_rec_addendum],
- 'result': {'type': 'form', 'arch':_transaction_add_form, 'fields':_transaction_add_fields, 'state':[('end','Cancel'),('reconcile','Reconcile')]}
- },
+ 'actions': [_trans_rec_addendum],
+ 'result': {'type': 'form', 'arch':_transaction_add_form, 'fields':_transaction_add_fields, 'state':[('end', 'Cancel'), ('reconcile', 'Reconcile')]}
+ },
'reconcile': {
- 'actions': [_trans_rec_reconcile],
+ 'actions': [_trans_rec_reconcile],
'result': {'type': 'state', 'state':'end'}
- },
+ },
'partial': {
- 'actions': [_trans_rec_reconcile_partial],
+ 'actions': [_trans_rec_reconcile_partial],
'result': {'type': 'state', 'state':'end'}
}
}
diff --git a/addons/account/wizard/wizard_reconcile_select.py b/addons/account/wizard/wizard_reconcile_select.py
deleted file mode 100644
index 594020debd4..00000000000
--- a/addons/account/wizard/wizard_reconcile_select.py
+++ /dev/null
@@ -1,61 +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
-from tools.translate import _
-
-
-_journal_form = '''
-''' % ('Reconciliation',)
-
-_journal_fields = {
- 'account_id': {'string':'Account', 'type':'many2one', 'relation':'account.account','domain': [('reconcile','=',1)], 'required':True},
-}
-
-def _action_open_window(self, cr, uid, data, context):
- return {
- 'domain': "[('account_id','=',%d),('reconcile_id','=',False),('state','<>','draft')]" % data['form']['account_id'],
- 'name': _('Reconciliation'),
- 'view_type': 'form',
- 'view_mode': 'tree,form',
- 'view_id': False,
- 'res_model': 'account.move.line',
- 'type': 'ir.actions.act_window'
- }
-
-class wiz_rec_select(wizard.interface):
- states = {
- 'init': {
- 'actions': [],
- 'result': {'type': 'form', 'arch':_journal_form, 'fields':_journal_fields, 'state':[('end','Cancel'),('open','Open for reconciliation')]}
- },
- 'open': {
- 'actions': [],
- 'result': {'type': 'action', 'action': _action_open_window, 'state':'end'}
- }
- }
-wiz_rec_select('account.move.line.reconcile.select')
-
-
-# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
-
diff --git a/addons/account/wizard/wizard_refund.py b/addons/account/wizard/wizard_refund.py
deleted file mode 100644
index 42526f3cc0a..00000000000
--- a/addons/account/wizard/wizard_refund.py
+++ /dev/null
@@ -1,226 +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
-import osv
-import netsvc
-import time
-from tools.translate import _
-
-sur_form = '''
-'''
-
-sur_fields = {
- 'date': {'string':'Operation date','type':'date', 'required':'False'},
- 'period':{'string': 'Force period', 'type': 'many2one',
- 'relation': 'account.period', 'required': False},
- 'description':{'string':'Description', 'type':'char', 'required':'True'},
- }
-
-
-class wiz_refund(wizard.interface):
-
- def _invoice_refund(self, cr, uid, data, context):
- return self._compute_refund(cr, uid, data, 'refund', context)
-
- def _invoice_cancel(self, cr, uid, data, context):
- return self._compute_refund(cr, uid, data, 'cancel', context)
-
- def _invoice_modify(self, cr, uid, data, context):
- return self._compute_refund(cr, uid, data, 'modify', context)
-
- def _compute_refund(self, cr, uid, data, mode, context):
- form = data['form']
- pool = pooler.get_pool(cr.dbname)
- reconcile_obj = pool.get('account.move.reconcile')
- account_m_line_obj = pool.get('account.move.line')
- created_inv = []
- date = False
- period = False
- description = False
- for inv in pool.get('account.invoice').browse(cr, uid, data['ids']):
- if inv.state in ['draft', 'proforma2', 'cancel']:
- raise wizard.except_wizard(_('Error !'), _('Can not %s draft/proforma/cancel invoice.') % (mode))
- if form['period'] :
- period = form['period']
- else:
- period = inv.period_id and inv.period_id.id or False
-
- if form['date'] :
- date = form['date']
- if not form['period'] :
- cr.execute("select name from ir_model_fields where model='account.period' and name='company_id'")
- result_query = cr.fetchone()
- if result_query:
- #in multi company mode
- cr.execute("""SELECT id
- from account_period where date('%s')
- between date_start AND date_stop and company_id = %s limit 1 """,
- (form['date'],pool.get('res.users').browse(cr,uid,uid).company_id.id,))
- else:
- #in mono company mode
- cr.execute("""SELECT id
- from account_period where date('%s')
- between date_start AND date_stop limit 1 """,
- (form['date'],))
- res = cr.fetchone()
- if res:
- period = res[0]
- else:
- date = inv.date_invoice
-
- if form['description'] :
- description = form['description']
- else:
- description = inv.name
-
- if not period:
- raise wizard.except_wizard(_('Data Insufficient !'), _('No Period found on Invoice!'))
-
- refund_id = pool.get('account.invoice').refund(cr, uid, [inv.id],date, period, description)
- refund = pool.get('account.invoice').browse(cr, uid, refund_id[0])
- # we compute due date
- #!!!due date = date inv date on formdate
- pool.get('account.invoice').write(cr, uid, [refund.id],{'date_due':date,'check_total':inv.check_total})
- # to make the taxes calculated
- pool.get('account.invoice').button_compute(cr, uid, refund_id)
-
- created_inv.append(refund_id[0])
- #if inv is paid we unreconcile
- if mode in ('cancel','modify'):
- movelines = inv.move_id.line_id
- #we unreconcile the lines
- to_reconcile_ids = {}
- for line in movelines :
- #if the account of the line is the as the one in the invoice
- #we reconcile
- if line.account_id.id == inv.account_id.id :
- to_reconcile_ids[line.account_id.id] =[line.id]
- if type(line.reconcile_id) != osv.orm.browse_null :
- reconcile_obj.unlink(cr,uid, line.reconcile_id.id)
- #we advance the workflow of the refund to open
- wf_service = netsvc.LocalService('workflow')
- wf_service.trg_validate(uid, 'account.invoice', refund.id, 'invoice_open', cr)
- #we reload the browse record
- refund = pool.get('account.invoice').browse(cr, uid, refund_id[0])
- #we match the line to reconcile
- for tmpline in refund.move_id.line_id :
- if tmpline.account_id.id == inv.account_id.id :
- to_reconcile_ids[tmpline.account_id.id].append(tmpline.id)
- for account in to_reconcile_ids :
- account_m_line_obj.reconcile(cr, uid, to_reconcile_ids[account],
- writeoff_period_id=period,
- writeoff_journal_id=inv.journal_id.id,
- writeoff_acc_id=inv.account_id.id
- )
- #we create a new invoice that is the copy of the original
- if mode == 'modify' :
- invoice = pool.get('account.invoice').read(cr, uid, [inv.id],
- ['name', 'type', 'number', 'reference',
- 'comment', 'date_due', 'partner_id', 'address_contact_id',
- 'address_invoice_id', 'partner_insite','partner_contact',
- 'partner_ref', 'payment_term', 'account_id', 'currency_id',
- 'invoice_line', 'tax_line', 'journal_id','period_id'
- ]
- )
- invoice = invoice[0]
- del invoice['id']
- invoice_lines = pool.get('account.invoice.line').read(cr, uid, invoice['invoice_line'])
- invoice_lines = pool.get('account.invoice')._refund_cleanup_lines(cr, uid, invoice_lines)
- tax_lines = pool.get('account.invoice.tax').read(
- cr, uid, invoice['tax_line'])
- tax_lines = pool.get('account.invoice')._refund_cleanup_lines(cr, uid, tax_lines)
-
- invoice.update({
- 'type': inv.type,
- 'date_invoice': date,
- 'state': 'draft',
- 'number': False,
- 'invoice_line': invoice_lines,
- 'tax_line': tax_lines,
- 'period_id': period,
- 'name':description
- })
-
- #take the id part of the tuple returned for many2one fields
- for field in ('address_contact_id', 'address_invoice_id', 'partner_id',
- 'account_id', 'currency_id', 'payment_term', 'journal_id'):
- invoice[field] = invoice[field] and invoice[field][0]
-
- # create the new invoice
- inv_id = pool.get('account.invoice').create(cr, uid, invoice,{})
- # we compute due date
- if inv.payment_term.id:
- data = pool.get('account.invoice').onchange_payment_term_date_invoice(cr, uid, [inv_id],inv.payment_term.id,date)
- if 'value' in data and data['value']:
- pool.get('account.invoice').write(cr, uid, [inv_id],data['value'])
- created_inv.append(inv_id)
-
- #we get the view id
- mod_obj = pool.get('ir.model.data')
- act_obj = pool.get('ir.actions.act_window')
- if inv.type == 'out_invoice':
- xml_id = 'action_invoice_tree5'
- elif inv.type == 'in_invoice':
- xml_id = 'action_invoice_tree8'
- elif type == 'out_refund':
- xml_id = 'action_invoice_tree10'
- else:
- xml_id = 'action_invoice_tree12'
- #we get the model
- result = mod_obj._get_id(cr, uid, 'account', xml_id)
- id = mod_obj.read(cr, uid, result, ['res_id'])['res_id']
- # we read the act window
- result = act_obj.read(cr, uid, id)
- result['res_id'] = created_inv
-
- return result
-
- states = {
- 'init': {
- 'actions': [],
- 'result': {'type':'form', 'arch':sur_form, 'fields':sur_fields, 'state':[('end','Cancel'),('refund','Refund Invoice'),('cancel_invoice','Cancel Invoice'),('modify_invoice','Modify Invoice')]}
- },
- 'refund': {
- 'actions': [],
- 'result': {'type':'action', 'action':_invoice_refund, 'state':'end'},
- },
- 'cancel_invoice': {
- 'actions': [],
- 'result': {'type':'action', 'action':_invoice_cancel, 'state':'end'},
- },
- 'modify_invoice': {
- 'actions': [],
- 'result': {'type':'action', 'action':_invoice_modify, 'state':'end'},
- },
-
- }
-wiz_refund('account.invoice.refund')
-
-# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
-
diff --git a/addons/account/wizard/wizard_state_open.py b/addons/account/wizard/wizard_state_open.py
index 9720f48e25e..f33c90231f4 100644
--- a/addons/account/wizard/wizard_state_open.py
+++ b/addons/account/wizard/wizard_state_open.py
@@ -47,7 +47,7 @@ class wiz_state_open(wizard.interface):
states = {
'init': {
'actions': [],
- 'result': {'type':'form', 'arch':form, 'fields':fields, 'state':[('end','No','gtk-no'),('yes','Yes','gtk-yes')]}
+ 'result': {'type':'form', 'arch':form, 'fields': fields, 'state':[('end','No','gtk-no'),('yes','Yes','gtk-yes')]}
},
'yes': {
'actions': [_change_inv_state],
diff --git a/addons/account_voucher/__terp__.py b/addons/account_voucher/__terp__.py
index b6843372f4c..01874eeed77 100755
--- a/addons/account_voucher/__terp__.py
+++ b/addons/account_voucher/__terp__.py
@@ -43,7 +43,8 @@
"voucher_sequence.xml",
"account_report.xml",
"voucher_view.xml",
- "voucher_wizard.xml",
+ "wizard/account_voucher_open_view.xml",
+ #"voucher_wizard.xml",
"account_view.xml",
],
'certificate': '0037580727101',
diff --git a/addons/account_voucher/wizard/__init__.py b/addons/account_voucher/wizard/__init__.py
index 136fd1d8ee9..237055f710d 100644
--- a/addons/account_voucher/wizard/__init__.py
+++ b/addons/account_voucher/wizard/__init__.py
@@ -19,4 +19,5 @@
#
##############################################################################
-import open_voucher
+
+import account_voucher_open
diff --git a/addons/account_voucher/wizard/account_voucher_open.py b/addons/account_voucher/wizard/account_voucher_open.py
new file mode 100644
index 00000000000..508a2d1c275
--- /dev/null
+++ b/addons/account_voucher/wizard/account_voucher_open.py
@@ -0,0 +1,76 @@
+# -*- 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 mx.DateTime import RelativeDateTime
+from osv import fields, osv
+from tools import config
+import ir
+import mx.DateTime
+import netsvc
+import pooler
+import time
+
+class account_voucher_open(osv.osv_memory):
+ """
+ Open Account Voucher
+ """
+ _name ="account.voucher.open"
+ _description ="Open Voucher"
+ _columns ={
+ 'type':fields.selection([('pay_voucher','Cash Payment Voucher'),('bank_pay_voucher','Bank Payment Voucher'),('rec_voucher','Cash Receipt Voucher'),('bank_rec_voucher','Bank Receipt Voucher'),('cont_voucher','Contra Voucher'),( 'journal_sale_vou','Journal Sale Voucher'),('journal_pur_voucher','Journal Purchase Voucher')], 'Voucher Type', required=True),
+ 'state':fields.selection([('draft','Draft'),
+ ('proforma','Pro-forma'),
+ ('posted','Posted'),
+ ('cancel','Cancel')], 'State', required=True),
+ 'period_ids':fields.many2many('account.period', 'account_period_rel', 'voucher_id', 'period_id', 'Periods')
+ }
+ def _action_open_window(self, cr, uid, ids, context):
+ """
+ Open account voucher form.
+ @param cr: the current row, from the database cursor.
+ @param uid: the current user’s ID for security checks.
+ @param id: List of account voucher open’s IDs.
+ @param return:dictionary of account voucher on given state ,type and account period id.
+ """
+
+ for form in self.read(cr, uid, ids):
+ periods = []
+ if not form['period_ids']:
+ period = self.pool.get('account.period')
+ year = self.pool.get('account.fiscalyear')
+ year = year.find(cr, uid)
+ periods = period.search(cr, uid, [('fiscalyear_id','=',year)])
+ else:
+ periods = form['period_ids']
+
+ return {
+ 'domain': "[('type','=','%s'), ('state','=','%s'), ('period_id','in',%s)]" % (form['type'], form['state'], periods),
+ 'name': "%s - %s" % (form['type'],form['state']),
+ 'view_type': 'form',
+ 'view_mode': 'tree,form',
+ 'res_model': 'account.voucher',
+ 'view_id': False,
+ 'context': "{'type':'%s', 'state':'%s', 'period_id':%s}" % (form['type'], form['state'], periods),
+ 'type': 'ir.actions.act_window'
+ }
+account_voucher_open()
+
+
diff --git a/addons/account_voucher/wizard/account_voucher_open_view.xml b/addons/account_voucher/wizard/account_voucher_open_view.xml
new file mode 100644
index 00000000000..5e71b20c6f4
--- /dev/null
+++ b/addons/account_voucher/wizard/account_voucher_open_view.xml
@@ -0,0 +1,41 @@
+
+
+
+
+ account.voucher.open.form
+ account.voucher.open
+ form
+
+
+
+
+
+
+ Open a Voucher Entry
+ account.voucher.open
+ form
+ tree,form
+
+ new
+
+
+
+
+
\ No newline at end of file
diff --git a/addons/account_voucher/wizard/open_voucher.py b/addons/account_voucher/wizard/open_voucher.py
deleted file mode 100644
index 5a3892e1a14..00000000000
--- a/addons/account_voucher/wizard/open_voucher.py
+++ /dev/null
@@ -1,104 +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
-from tools.translate import _
-import pooler
-
-_voucher_form = '''
-'''
-
-_types = {
- 'pay_voucher':'Cash Payment Voucher',
- 'bank_pay_voucher':'Bank Payment Voucher',
- 'rec_voucher':'Cash Receipt Voucher',
- 'bank_rec_voucher':'Bank Receipt Voucher',
- 'cont_voucher':'Contra Voucher',
- 'journal_sale_vou':'Journal Sale Voucher',
- 'journal_pur_voucher':'Journal Purchase Voucher'
-}
-_states = {
- 'draft':'Draft',
- 'proforma':'Pro-forma',
- 'posted':'Posted',
- 'cancel':'Cancel'
-}
-
-_voucher_fields = {
- 'type': {'string':'Voucher Type', 'type':'selection', 'selection':[
- ('pay_voucher','Cash Payment Voucher'),
- ('bank_pay_voucher','Bank Payment Voucher'),
- ('rec_voucher','Cash Receipt Voucher'),
- ('bank_rec_voucher','Bank Receipt Voucher'),
- ('cont_voucher','Contra Voucher'),
- ('journal_sale_vou','Journal Sale Voucher'),
- ('journal_pur_voucher','Journal Purchase Voucher')], 'required':True},
- 'state': {'string':'State', 'type':'selection', 'selection':[
- ('draft','Draft'),
- ('proforma','Pro-forma'),
- ('posted','Posted'),
- ('cancel','Cancel')], 'required':True},
- 'period_ids': {'string':'Periods', 'type':'many2many', 'relation':'account.period'},
-}
-
-def _action_open_window(self, cr, uid, data, context):
- form = data['form']
- periods = []
-
- if not form['period_ids'][0][2]:
- pool = pooler.get_pool(cr.dbname)
- period = pool.get('account.period')
- year = pool.get('account.fiscalyear')
-
- year = year.find(cr, uid)
- periods = period.search(cr, uid, [('fiscalyear_id','=',year)])
- else:
- periods = form['period_ids'][0][2]
-
- return {
- 'domain': "[('type','=','%s'), ('state','=','%s'), ('period_id','in',%s)]" % (form['type'], form['state'], periods),
- 'name': "%s - %s" % (_types[form['type']], _states[form['state']]),
- 'view_type': 'form',
- 'view_mode': 'tree,form',
- 'res_model': 'account.voucher',
- 'view_id': False,
- 'context': "{'type':'%s', 'state':'%s', 'period_id':%s}" % (form['type'], form['state'], periods),
- 'type': 'ir.actions.act_window'
- }
-
-class OpenVoucherEntries(wizard.interface):
- states = {
- 'init': {
- 'actions': [],
- 'result': {'type': 'form', 'arch':_voucher_form, 'fields':_voucher_fields, 'state':[('end','Cancel'),('open','Open Voucher Entries')]}
- },
- 'open': {
- 'actions': [],
- 'result': {'type': 'action', 'action': _action_open_window, 'state':'end'}
- }
- }
-OpenVoucherEntries('account.voucher.open')
-
-# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
diff --git a/addons/auction/__terp__.py b/addons/auction/__terp__.py
index 83064640266..c3f9058f070 100644
--- a/addons/auction/__terp__.py
+++ b/addons/auction/__terp__.py
@@ -34,6 +34,16 @@
'init_xml': ['auction_sequence.xml'],
'update_xml': [
'security/ir.model.access.csv',
+ 'wizard/auction_lots_able_view.xml',
+ 'wizard/auction_lots_enable_view.xml',
+ 'wizard/auction_lots_make_invoice_buyer_view.xml',
+ 'wizard/auction_lots_make_invoice_view.xml',
+ 'wizard/auction_taken_view.xml',
+ 'wizard/auction_lots_auction_move_view.xml',
+ 'wizard/auction_pay_buy_view.xml',
+ 'wizard/auction_payer_sel_view.xml',
+ 'wizard/auction_lots_sms_send_view.xml',
+
'auction_view.xml',
'auction_report.xml',
'auction_wizard.xml'
diff --git a/addons/auction/auction.py b/addons/auction/auction.py
index 0ece4690d9f..979f2c6cf42 100644
--- a/addons/auction/auction.py
+++ b/addons/auction/auction.py
@@ -478,13 +478,15 @@ class auction_lots(osv.osv):
result = [ (r['id'], str(r['obj_num'])+' - '+r['name']) for r in self.read(cr, user, ids, ['name','obj_num'])]
return result
- def name_search(self, cr, user, name, args=[], operator='ilike', context={}):
+ def name_search(self, cr, user, name, args=None, operator='ilike', context={}):
+ if not args:
+ args = []
try:
- ids = self.search(cr, user, [('obj_num','=',int(name))]+ args)
+ ids = self.search(cr, user, [('obj_num','=',int(name))] + args)
except:
ids = []
if not ids:
- ids = self.search(cr, user, [('name',operator,name)]+ args)
+ ids = self.search(cr, user, [('name',operator,name)] + args)
return self.name_get(cr, user, ids)
def _sum_taxes_by_type_and_id(self, taxes):
diff --git a/addons/auction/auction_view.xml b/addons/auction/auction_view.xml
index 2189253f3ce..ee1004ab0f3 100644
--- a/addons/auction/auction_view.xml
+++ b/addons/auction/auction_view.xml
@@ -3,7 +3,8 @@
-
+
+
=======================================================
Auction Management/Configuration/artist
=======================================================
@@ -203,6 +204,7 @@
+
@@ -277,7 +279,7 @@
-
+
@@ -330,7 +332,6 @@
-
@@ -340,9 +341,7 @@
-
-
diff --git a/addons/auction/auction_wizard.xml b/addons/auction/auction_wizard.xml
index 0a93799cc20..ab1b051add5 100644
--- a/addons/auction/auction_wizard.xml
+++ b/addons/auction/auction_wizard.xml
@@ -1,8 +1,8 @@
-
-
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+ -->
diff --git a/addons/auction/wizard/__init__.py b/addons/auction/wizard/__init__.py
index ec07ef6e04f..b82dcda5307 100644
--- a/addons/auction/wizard/__init__.py
+++ b/addons/auction/wizard/__init__.py
@@ -19,24 +19,27 @@
#
##############################################################################
-import wizard_aie_send
-import wizard_aie_send_result
-import wizard_lots_buyer_map
-import wizard_lots_cancel
-import wizard_lots_invoice
-import wizard_lots_numerotate
-import wizard_lots_pay
-import wizard_pay
-import wizard_lots_sms
-import wizard_lot_date_move
-import wizard_auction_journal
-import wizard_auction_invoice_buyer
-import wizard_transfer_unsold_object
-import auction_wizard_enable_taken
-import auction_wizard_able_taken
-import auction_catalog_flagey
-#import wizard_lots_barcode
-import wizard_emporte
-import wizard_payer
+#import wizard_aie_send
+#import wizard_aie_send_result
+#import wizard_lots_buyer_map
+#import wizard_lots_cancel
+#import wizard_lots_invoice
+#import wizard_lots_numerotate
+#import wizard_lots_pay
+#import wizard_pay
+#import wizard_lot_date_move
+#import wizard_transfer_unsold_object
+#import auction_catalog_flagey
+
+import auction_lots_able
+import auction_lots_enable
+import auction_lots_make_invoice_buyer
+import auction_lots_make_invoice
+import auction_taken
+import auction_lots_auction_move
+import auction_pay_buy
+import auction_payer_sel
+import auction_lots_sms_send
+
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
diff --git a/addons/auction/wizard/auction_lots_able.py b/addons/auction/wizard/auction_lots_able.py
new file mode 100644
index 00000000000..686d26c0341
--- /dev/null
+++ b/addons/auction/wizard/auction_lots_able.py
@@ -0,0 +1,44 @@
+# -*- 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
+from tools.translate import _
+import netsvc
+import pooler
+import time
+import tools
+import wizard
+
+class auction_lots_able(osv.osv_memory):
+
+ _name = "auction.lots.able"
+ _description = "Lots able"
+
+ def _confirm_able(self, cr, uid, ids, context={}):
+ """
+ This function Update auction lots object and set taken away field true.
+ @param cr: the current row, from the database cursor,
+ @param uid: the current user’s ID for security checks,
+ @param ids: List of auction lots able’s IDs.
+ """
+ self.pool.get('auction.lots').write(cr, uid, context['active_ids'], {'ach_emp':True})
+ return {}
+
+auction_lots_able()
diff --git a/addons/auction/wizard/auction_lots_able_view.xml b/addons/auction/wizard/auction_lots_able_view.xml
new file mode 100644
index 00000000000..374390a1404
--- /dev/null
+++ b/addons/auction/wizard/auction_lots_able_view.xml
@@ -0,0 +1,43 @@
+
+
+
+
+ auction.lots.able.form
+ auction.lots.able
+ form
+
+
+
+
+
+
+ Mark as taken away
+ auction.lots.able
+ form
+ tree,form
+
+ new
+ {'record_id' : active_id}
+
+
+
+
+
+ Mark as taken away
+ client_action_multi
+
+ action
+ auction.lots
+
+
+
diff --git a/addons/auction/wizard/auction_lots_auction_move.py b/addons/auction/wizard/auction_lots_auction_move.py
new file mode 100644
index 00000000000..71e2b16e8e0
--- /dev/null
+++ b/addons/auction/wizard/auction_lots_auction_move.py
@@ -0,0 +1,84 @@
+# -*- 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
+from tools.translate import _
+import netsvc
+import pooler
+import time
+import tools
+import wizard
+
+class auction_lots_auction_move(osv.osv_memory):
+
+ _name = "auction.lots.auction.move"
+ _description = "Auction move "
+ _columns= {
+ 'auction_id':fields.many2one('auction.dates', 'Auction Date', required=True),
+ }
+
+ def _top(self, cr, uid, ids, context={}):
+ refs = self.pool.get('auction.lots')
+ rec_ids = refs.browse(cr, uid, context['active_ids'])
+ for rec in rec_ids:
+ if not rec.auction_id:
+ raise osv.except_osv('Error !', 'You can not move a lot that has no auction date')
+ return {}
+
+ def _auction_move_set(self, cr, uid, ids, context={}):
+ """
+ This Function update auction date on auction lots to given auction date.
+ erase the auction lots's object adjudication price and its buyer and change state to draft.
+ create new entry in auction lot history.
+ @param cr: the current row, from the database cursor,
+ @param uid: the current user’s ID for security checks,
+ @param ids: List of auction lots auction move’s IDs.
+ """
+ for datas in self.read(cr, uid, ids):
+ if not (datas['auction_id'] and len(context['active_ids'])) :
+ return {}
+ refs = self.pool.get('auction.lots')
+ rec_ids = refs.browse(cr, uid, context['active_ids'])
+ line_ids = self.pool.get('auction.bid_line').search(cr, uid, [('lot_id', 'in', context['active_ids'])])
+ # pooler.get_pool(cr.dbname).get('auction.bid_line').unlink(cr, uid, line_ids)
+ for rec in rec_ids:
+ new_id = self.pool.get('auction.lot.history').create(cr, uid, {
+ 'auction_id': rec.auction_id.id,
+ 'lot_id': rec.id,
+ 'price': rec.obj_ret
+ })
+ up_auction = self.pool.get('auction.lots').write(cr, uid, [rec.id], {
+ 'auction_id':datas['auction_id'],
+ 'obj_ret': None,
+ 'obj_price': None,
+ 'ach_login': None,
+ 'ach_uid': None,
+ 'ach_inv_id': None,
+ 'sel_inv_id': None,
+ 'obj_num': None,
+ 'state': 'draft'})
+ return {}
+
+auction_lots_auction_move()
+
+
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
+
diff --git a/addons/auction/wizard/auction_lots_auction_move_view.xml b/addons/auction/wizard/auction_lots_auction_move_view.xml
new file mode 100644
index 00000000000..394a916c96c
--- /dev/null
+++ b/addons/auction/wizard/auction_lots_auction_move_view.xml
@@ -0,0 +1,45 @@
+
+
+
+
+ auction.lots.auction.move.form
+ auction.lots.auction.move
+ form
+
+
+
+
+
+
+ Change Auction Date
+ auction.lots.auction.move
+ form
+ tree,form
+
+ new
+ {'record_id' : active_id}
+
+
+
+
+
+ Change Auction Date
+ client_action_multi
+
+ action
+ auction.lots
+
+
+
+
diff --git a/addons/auction/wizard/auction_lots_enable.py b/addons/auction/wizard/auction_lots_enable.py
new file mode 100644
index 00000000000..9d75ef1a589
--- /dev/null
+++ b/addons/auction/wizard/auction_lots_enable.py
@@ -0,0 +1,47 @@
+# -*- 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
+from tools.translate import _
+import netsvc
+import pooler
+import time
+import tools
+import wizard
+
+class auction_lots_enable(osv.osv_memory):
+
+ _name = "auction.lots.enable"
+ _description = "Lots Enable"
+ _columns= {
+ 'confirm_en':fields.integer('Catalog Number')
+ }
+
+ def _confirm_enable(self, cr, uid, ids, context={}):
+ """
+ This function Update auction lots object and set taken away field False.
+ @param cr: the current row, from the database cursor,
+ @param uid: the current user’s ID for security checks,
+ @param ids: List of auction lots enable’s IDs.
+ """
+ self.pool.get('auction.lots').write(cr, uid, context['active_id'], {'ach_emp':False})
+ return {}
+
+auction_lots_enable()
diff --git a/addons/auction/wizard/auction_lots_enable_view.xml b/addons/auction/wizard/auction_lots_enable_view.xml
new file mode 100644
index 00000000000..e6a6936c5eb
--- /dev/null
+++ b/addons/auction/wizard/auction_lots_enable_view.xml
@@ -0,0 +1,45 @@
+
+
+
+
+ auction.lots.enable.form
+ auction.lots.enable
+ form
+
+
+
+
+
+
+ Unmark as taken away
+ auction.lots.enable
+ form
+ tree,form
+
+ new
+ {'record_id' : active_id}
+
+
+
+
+
+ Unmark as taken away
+ client_action_multi
+
+ action
+ auction.lots
+
+
+
+
+
diff --git a/addons/auction/wizard/auction_lots_make_invoice.py b/addons/auction/wizard/auction_lots_make_invoice.py
new file mode 100644
index 00000000000..50177f54203
--- /dev/null
+++ b/addons/auction/wizard/auction_lots_make_invoice.py
@@ -0,0 +1,93 @@
+# -*- 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
+from tools.translate import _
+import netsvc
+import pooler
+import time
+import tools
+import wizard
+
+class auction_lots_make_invoice(osv.osv_memory):
+
+ def _value_amount(self, cr, uid, context={}):
+ """
+ For Amount default value
+ @return:default auction lots amount value in amount fields.
+ """
+ lots= self.pool.get('auction.lots').browse(cr, uid, context['active_ids'])
+ amount_total=0.0
+ for lot in lots:
+ amount_total+=lot.seller_price
+ return amount_total
+
+ def _value_object(self, cr, uid, context={}):
+ """
+ For object default value.
+ @return:length of id in Object field.
+ """
+ object = len(context['active_ids'])
+ return object
+
+ def _makeInvoices(self, cr, uid, ids, context):
+ """
+ seller invoice :Create an invoice.
+ @param cr: the current row, from the database cursor.
+ @param uid: the current user’s ID for security checks.
+ @param ids: List of Auction lots make invoice’s IDs
+ @return: dictionary of account invoice form.
+ """
+ for data in self.read(cr, uid, ids):
+ order_obj = self.pool.get('auction.lots')
+ mod_obj = self.pool.get('ir.model.data')
+ result = mod_obj._get_id(cr, uid, 'account', 'view_account_invoice_filter')
+ id = mod_obj.read(cr, uid, result, ['res_id'])
+ newinv = []
+ ids = order_obj.seller_trans_create(cr, uid, context['active_ids'], context)
+ cr.commit()
+ return {
+ 'domain': "[('id','in', ["+','.join(map(str, ids))+"])]",
+ 'name': 'Seller invoices',
+ 'view_type': 'form',
+ 'view_mode': 'tree,form',
+ 'res_model': 'account.invoice',
+ 'view_id': False,
+ 'context': "{'type':'out_refund'}",
+ 'type': 'ir.actions.act_window',
+ 'search_view_id': id['res_id']
+ }
+
+ _name = "auction.lots.make.invoice"
+ _description = "Make invoice"
+ _columns= {
+ 'amount': fields.float('Invoiced Amount', required =True, readonly=True),
+ 'objects':fields.integer('# of objects', required =True, readonly=True),
+ 'number':fields.char('Invoice Number', size=64),
+
+ }
+ _defaults={
+ 'amount':_value_amount,
+ 'objects':_value_object,
+ 'number':lambda *a: False,
+
+ }
+
+auction_lots_make_invoice()
diff --git a/addons/auction/wizard/auction_lots_make_invoice_buyer.py b/addons/auction/wizard/auction_lots_make_invoice_buyer.py
new file mode 100644
index 00000000000..b35dc072776
--- /dev/null
+++ b/addons/auction/wizard/auction_lots_make_invoice_buyer.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 .
+#
+##############################################################################
+from osv import fields, osv
+from tools.translate import _
+import netsvc
+import pooler
+import time
+import tools
+import wizard
+
+class auction_lots_make_invoice_buyer(osv.osv_memory):
+
+ def _value_amount(self, cr, uid, context={}):
+ """
+ For Amount default value
+ @return:default auction lots amount value in amount fields.
+ """
+ lots= self.pool.get('auction.lots').browse(cr, uid, context['active_ids'])
+ amount_total=0.0
+ for lot in lots:
+ amount_total+=lot.buyer_price
+ return amount_total
+
+ def _value_object(self, cr, uid, context={}):
+ """
+ For object default value.
+ @return:length of id in Object field.
+ """
+ object = len(context['active_ids'])
+ return object
+
+ def _value_buyer_id(self, cr, uid, context={}):
+ """
+ For default buyer id value
+ @return:auction lots buyer id in buyer id field.
+ """
+ lots= self.pool.get('auction.lots').browse(cr, uid, context['active_ids'])
+ for lot in lots:
+ buyer=lot and lot.ach_uid.id or False
+ return buyer
+
+ def _makeInvoices(self, cr, uid, ids, context):
+ """
+ Create an invoice for selected lots (IDS) to BUYER_ID .
+ @param cr: the current row, from the database cursor.
+ @param uid: the current user’s ID for security checks.
+ @param ids: List of Auction lots make invoice buyer’s IDs
+ @return: dictionary of account invoice form.
+ """
+ newinv = []
+ for data in self.read(cr, uid, ids):
+
+ order_obj = self.pool.get('auction.lots')
+ mod_obj = self.pool.get('ir.model.data')
+ result = mod_obj._get_id(cr, uid, 'account', 'view_account_invoice_filter')
+ id = mod_obj.read(cr, uid, result, ['res_id'])
+ lots = order_obj.browse(cr, uid, context['active_ids'])
+ invoice_number = data['number']
+ for lot in lots:
+ up_auction = self.pool.get('auction.lots').write(cr, uid, [lot.id], {'ach_uid':data['buyer_id']})
+ ids = order_obj.lots_invoice(cr, uid, context['active_ids'], context, data['number'])
+ cr.commit()
+ return {
+ 'domain': "[('id','in', ["+','.join(map(str, ids))+"])]",
+ 'name': 'Buyer invoices',
+ 'view_type': 'form',
+ 'view_mode': 'tree,form',
+ 'res_model': 'account.invoice',
+ 'view_id': False,
+ 'context': "{'type':'in_refund'}",
+ 'type': 'ir.actions.act_window',
+ 'search_view_id': id['res_id']
+ }
+
+ _name = "auction.lots.make.invoice.buyer"
+ _description = "Make invoice buyer "
+ _columns= {
+ 'amount': fields.float('Invoiced Amount', required =True, readonly=True),
+ 'objects':fields.integer('# of objects', required =True, readonly=True),
+ 'number':fields.char('Invoice Number', size=64),
+ 'buyer_id':fields.many2one('res.partner', 'Buyer', required=True),
+ }
+ _defaults={
+ 'amount':_value_amount,
+ 'objects':_value_object,
+ 'number':lambda *a: False,
+ 'buyer_id':_value_buyer_id
+
+ }
+
+auction_lots_make_invoice_buyer()
diff --git a/addons/auction/wizard/auction_lots_make_invoice_buyer_view.xml b/addons/auction/wizard/auction_lots_make_invoice_buyer_view.xml
new file mode 100644
index 00000000000..b45d5bdbb1c
--- /dev/null
+++ b/addons/auction/wizard/auction_lots_make_invoice_buyer_view.xml
@@ -0,0 +1,49 @@
+
+
+
+
+ auction.lots.make.invoice.buyer.form
+ auction.lots.make.invoice.buyer
+ form
+
+
+
+
+
+
+ Invoice Buyer objects
+ auction.lots.make.invoice.buyer
+ form
+ tree,form
+
+ new
+ {'record_id' : active_id}
+
+
+
+
+
+ Invoice Buyer objects
+ client_action_multi
+
+ action
+ auction.lots
+
+
+
+
+
+
diff --git a/addons/auction/wizard/auction_lots_make_invoice_view.xml b/addons/auction/wizard/auction_lots_make_invoice_view.xml
new file mode 100644
index 00000000000..e629942c5d5
--- /dev/null
+++ b/addons/auction/wizard/auction_lots_make_invoice_view.xml
@@ -0,0 +1,45 @@
+
+
+
+
+ auction.lots.make.invoice.form
+ auction.lots.make.invoice
+ form
+
+
+
+
+
+
+ Invoice Seller objects
+ auction.lots.make.invoice
+ form
+ tree,form
+
+ new
+ {'record_id' : active_id}
+
+
+
+
+
+ Invoice Seller objects
+ client_action_multi
+
+ action
+ auction.lots
+
+
+
+
diff --git a/addons/auction/wizard/auction_lots_sms_send.py b/addons/auction/wizard/auction_lots_sms_send.py
new file mode 100644
index 00000000000..95351c6965a
--- /dev/null
+++ b/addons/auction/wizard/auction_lots_sms_send.py
@@ -0,0 +1,67 @@
+# -*- 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
+from tools.translate import _
+import netsvc
+import pooler
+import time
+import tools
+import wizard
+
+class auction_lots_sms_send(osv.osv_memory):
+
+ _name = "auction.lots.sms.send"
+ _description = "Sms send "
+ _columns= {
+ 'app_id':fields.char('API ID', size=64, required=True),
+ 'user':fields.char('Login', size=64, required=True),
+ 'password':fields.char('Password', size=64, required=True),
+ 'text':fields.text('SMS Message', required=True)
+ }
+
+ def _sms_send(self, cr, uid, ids, context):
+
+ for datas in self.read(cr, uid, ids):
+ lots = self.pool.get('auction.lots').read(cr, uid, context['active_ids'], ['obj_num','obj_price','ach_uid'])
+ print "lots",lots, [l['ach_uid'][0] for l in lots if l['ach_uid']]
+ res = self.pool.get('res.partner').read(cr, uid, [l['ach_uid'][0] for l in lots if l['ach_uid']], ['gsm'], context)
+
+ nbr = 0
+ for r in res:
+ add = self.pool.get('res.partner').address_get(cr, uid, [r['id']])['default']
+ addr = self.pool.get('res.partner.address').browse(cr, uid, add)
+ to = addr.mobile
+ if to:
+ tools.smssend(data['user'], data['password'], data['app_id'], unicode(data['text'], 'utf-8').encode('latin1'), to)
+ nbr += 1
+ return {'sms_sent': nbr}
+
+ if to:
+ tools.smssend(data['user'], data['password'], data['app_id'], unicode(data['text'], 'utf-8').encode('latin1'), to)
+ nbr += 1
+ return {'sms_sent': nbr}
+#
+auction_lots_sms_send()
+
+
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
+
diff --git a/addons/auction/wizard/auction_lots_sms_send_view.xml b/addons/auction/wizard/auction_lots_sms_send_view.xml
new file mode 100644
index 00000000000..7e57833f72d
--- /dev/null
+++ b/addons/auction/wizard/auction_lots_sms_send_view.xml
@@ -0,0 +1,49 @@
+
+
+
+
+ auction.lots.sms.send.form
+ auction.lots.sms.send
+ form
+
+
+
+
+
+
+ SMS Send
+ auction.lots.sms.send
+ form
+ tree,form
+
+ new
+ {'record_id' : active_id}
+
+
+
+
+
+ SMS Send
+ client_action_multi
+
+ action
+ auction.lots
+
+
+
+
diff --git a/addons/auction/wizard/auction_pay_buy.py b/addons/auction/wizard/auction_pay_buy.py
new file mode 100644
index 00000000000..8e7136b0064
--- /dev/null
+++ b/addons/auction/wizard/auction_pay_buy.py
@@ -0,0 +1,105 @@
+# -*- 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
+from tools.translate import _
+import netsvc
+import pooler
+import time
+import tools
+import wizard
+
+class auction_pay_buy(osv.osv_memory):
+
+ def _start(self, cr, uid, context):
+ rec = self.pool.get('auction.lots').browse(cr, uid, context['active_ids'], context)
+ amount1 = 0.0
+ for r in rec:
+ amount1+= r.buyer_price
+ if r.is_ok:
+ raise osv.except_osv('Error !', 'Some lots of the selection are already paid.')
+ return amount1
+
+ def _value_buyer_id(self, cr, uid, context={}):
+ """
+ For default buyer id value
+ @return:auction lots buyer id in buyer id field.
+ """
+ lots= self.pool.get('auction.lots').browse(cr, uid, context['active_ids'])
+ for lot in lots:
+ buyer=lot and lot.ach_uid.id or False
+ return buyer
+
+ def _pay_and_reconcile(self, cr, uid, ids, context):
+ for datas in self.read(cr, uid, ids):
+ if not abs(datas['total'] - (datas['amount'] + datas['amount2'] + datas['amount3'])) <0.01:
+ rest = datas['total']-(datas['amount'] + datas['amount2'] + datas['amount3'])
+ raise osv.except_osv('Payment aborted !', 'You should pay all the total: "%.2f" are missing to accomplish the payment.' %(round(rest, 2)))
+
+ lots = self.pool.get('auction.lots').browse(cr, uid, context['active_ids'], context)
+ ref_bk_s = self.pool.get('account.bank.statement.line')
+
+ for lot in lots:
+ if datas['buyer_id']:
+ self.pool.get('auction.lots').write(cr, uid, [lot.id], {'ach_uid':datas['buyer_id']})
+ if not lot.auction_id:
+ raise osv.except_osv('Error !', 'No auction date for "%s": Please set one.'%(lot.name))
+ self.pool.get('auction.lots').write(cr, uid, [lot.id], {'is_ok':True})
+
+ for st, stamount in [('statement_id1', 'amount'), ('statement_id2', 'amount2'), ('statement_id3', 'amount3')]:
+ if datas[st]:
+ new_id = ref_bk_s.create(cr, uid, {
+ 'name':'Buyer:'+ str(lot.ach_login or '')+', auction:'+ lots[0].auction_id.name,
+ 'date': time.strftime('%Y-%m-%d'),
+ 'partner_id': datas['buyer_id'] or False,
+ 'type':'customer',
+ 'statement_id': datas[st],
+ 'account_id': lot.auction_id.acc_income.id,
+ 'amount': datas[stamount]
+ })
+ for lot in lots:
+ self.pool.get('auction.lots').write(cr, uid, [lot.id], {'statement_id':[(4, new_id)]})
+ return {}
+
+ _name = "auction.pay.buy"
+ _description = "Pay buy"
+ _columns= {
+ 'amount': fields.float('Amount paid', digits= (16, int(tools.config['price_accuracy']))),
+ 'buyer_id':fields.many2one('res.partner', 'Buyer'),
+ 'statement_id1':fields.many2one('account.bank.statement', 'Statement', required=True),
+ 'amount2': fields.float('Amount paid', digits= (16, int(tools.config['price_accuracy']))),
+ 'statement_id2':fields.many2one('account.bank.statement', 'Statement'),
+ 'amount3': fields.float('Amount paid', digits = (16, int(tools.config['price_accuracy']))),
+ 'statement_id3':fields.many2one('account.bank.statement', 'Statement'),
+ 'total': fields.float('Amount paid', digits = (16, int(tools.config['price_accuracy'])), readonly =True),
+ }
+ _defaults={
+ 'amount' : _start,
+ 'total' : _start,
+ 'buyer_id' : _value_buyer_id
+ }
+
+auction_pay_buy()
+
+
+
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
+
diff --git a/addons/auction/wizard/auction_pay_buy_view.xml b/addons/auction/wizard/auction_pay_buy_view.xml
new file mode 100644
index 00000000000..daa0ea2a195
--- /dev/null
+++ b/addons/auction/wizard/auction_pay_buy_view.xml
@@ -0,0 +1,51 @@
+
+
+
+
+ auction.pay.buy.form
+ auction.pay.buy
+ form
+
+
+
+
+
+
+ Pay objects of the buyer
+ auction.pay.buy
+ form
+ tree,form
+
+ new
+ {'record_id' : active_id}
+
+
+
+
+
+ Pay objects of the buyer
+ client_action_multi
+
+ action
+ auction.lots
+
+
+
+
diff --git a/addons/auction/wizard/auction_pay_sel.py b/addons/auction/wizard/auction_pay_sel.py
new file mode 100644
index 00000000000..2643a565e3e
--- /dev/null
+++ b/addons/auction/wizard/auction_pay_sel.py
@@ -0,0 +1,51 @@
+# -*- 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
+from tools.translate import _
+import netsvc
+import pooler
+import time
+import tools
+import wizard
+
+class auction_pay_sel(osv.osv_memory):
+
+ _name = "auction.pay.sel"
+ _description = "Pay Invoice"
+ _columns= {
+ 'amount': fields.float('Amount paid', digits= (16, int(tools.config['price_accuracy'])), required=True),
+ 'dest_account_id':fields.many2one('account.account', 'Payment to Account', required=True, domain= [('type', '=', 'cash')]),
+ 'journal_id':fields.many2one('account.journal', 'Journal', required=True),
+ 'period_id':fields.many2one('account.period', 'Period', required=True),
+ }
+
+ def _pay_and_reconcile(self, cr, uid, ids, context):
+ lot = self.pool.get('auction.lots').browse(cr, uid, context['active_id'], context)
+ for datas in self.read(cr, uid, ids):
+ account_id = datas.get('writeoff_acc_id', False)
+ period_id = datas.get('period_id', False)
+ journal_id = datas.get('journal_id', False)
+ if lot.sel_inv_id:
+ p = self.pool.get('account.invoice').pay_and_reconcile(['lot.sel_inv_id.id'], datas['amount'], datas['dest_account_id'], journal_id, account_id, period_id, journal_id, context)
+ # lots.sel_inv_id.pay_and_reconcile(cr,uid,data[id], form['amount'], form['dest_account_id'], journal_id, account_id, period_id, journal_id, context)
+ return {}
+
+auction_pay_sel()
diff --git a/addons/auction/wizard/auction_pay_sel_view.xml b/addons/auction/wizard/auction_pay_sel_view.xml
new file mode 100644
index 00000000000..b96f25032ac
--- /dev/null
+++ b/addons/auction/wizard/auction_pay_sel_view.xml
@@ -0,0 +1,35 @@
+
+
+
+
+ auction.pay.sel.form
+ auction.pay.sel
+ form
+
+
+
+
+
+
+ Pay objects of the seller
+ auction.pay.sel
+ form
+ tree,form
+
+ new
+
+
+
+
diff --git a/addons/auction/wizard/auction_wizard_enable_taken.py b/addons/auction/wizard/auction_payer_sel.py
similarity index 51%
rename from addons/auction/wizard/auction_wizard_enable_taken.py
rename to addons/auction/wizard/auction_payer_sel.py
index 01f54ca28dc..b59cbf591cc 100644
--- a/addons/auction/wizard/auction_wizard_enable_taken.py
+++ b/addons/auction/wizard/auction_payer_sel.py
@@ -19,43 +19,42 @@
#
##############################################################################
-import wizard
+from osv import fields, osv
+from tools.translate import _
import netsvc
import pooler
-#field name="confirm_en"/>
+import time
+import tools
+import wizard
-take_form = """
-
-"""
+class auction_payer(osv.osv_memory):
-take_fields = {
- 'confirm_en': {'string':'Catalog Number', 'type':'integer'},
-}
-
-def _confirm_enable(self,cr,uid,data,context={}):
- pool = pooler.get_pool(cr.dbname)
- pool.get('auction.lots').write(cr,uid,data['ids'],{'ach_emp':False})
- return {}
-
-class enable_take_away(wizard.interface):
- states = {
- 'init' : {
- 'actions' : [],
- 'result' : {
- 'type' : 'form',
- 'arch' : take_form,
- 'fields' : take_fields,
- 'state' : [ ('end', 'Cancel'),('go', 'Enable Taken away')]}
- },
- 'go' : {
- 'actions' : [_confirm_enable],
- 'result' : {'type' : 'state', 'state' : 'end'}
- },
-}
-enable_take_away('auction.lots.enable')
+ _name = "auction.payer"
+ _description = "Auction payer"
+
+ def _payer(self, cr, uid, ids, context):
+ self.pool.get('auction.lots').write(cr, uid, context['active_ids'], {'is_ok':True, 'state':'paid'})
+ return {}
+
+auction_payer()
+class auction_payer_sel(osv.osv_memory):
+ """
+ For Mark as payment for seller
+ """
+ _name = "auction.payer.sel"
+ _description = "Auction payment for seller"
+
+ def _payer_sel(self, cr, uid, ids, context):
+ """
+ This function Update auction lots object and seller paid true.
+ @param cr: the current row, from the database cursor,
+ @param uid: the current user’s ID for security checks,
+ @param ids: List of auction payer sel’s IDs.
+ """
+ self.pool.get('auction.lots').write(cr, uid, context['active_ids'], {'paid_vnd':True})
+ return {}
+
+auction_payer_sel()
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
diff --git a/addons/auction/wizard/auction_payer_sel_view.xml b/addons/auction/wizard/auction_payer_sel_view.xml
new file mode 100644
index 00000000000..93fe0ef38b1
--- /dev/null
+++ b/addons/auction/wizard/auction_payer_sel_view.xml
@@ -0,0 +1,55 @@
+
+
+
+
+ auction.payer.form
+ auction.payer
+ form
+
+
+
+
+
+
+ auction.payer.sel.form
+ auction.payer.sel
+ form
+
+
+
+
+
+
+ Mark as paid for seller
+ auction.payer.sel
+ form
+ tree,form
+
+ new
+ {'record_id' : active_id}
+
+
+
+
+
+ Mark as paid for seller
+ client_action_multi
+
+ action
+ auction.lots
+
+
+
+
diff --git a/addons/auction/wizard/auction_taken.py b/addons/auction/wizard/auction_taken.py
new file mode 100644
index 00000000000..48a5d8cf6af
--- /dev/null
+++ b/addons/auction/wizard/auction_taken.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 .
+#
+##############################################################################
+from osv import fields, osv
+from tools.translate import _
+import netsvc
+import pooler
+import time
+import tools
+import wizard
+
+class auction_taken(osv.osv_memory):
+ """
+ Auction lots taken.
+ """
+ _name = "auction.taken"
+ _description = "Auction taken"
+ _columns = {
+ 'lot_ids':fields.many2many('auction.lots', 'auction_taken_rel', 'taken_id', 'lot_id', 'Lots Emportes'),
+
+ }
+
+ def _to_xml(s):
+ return s.replace('&','&').replace('<','<').replace('>','>')
+
+ def _process(self, cr, uid, ids, context):
+ """
+ Update Auction lots state to taken_away.
+ @param cr: the current row, from the database cursor.
+ @param uid: the current user’s ID for security checks.
+ @param ids: List of Auction taken’s IDs
+ @return: dictionary of lot_ids fields with empty list
+ """
+ for data in self.read(cr, uid, ids):
+ lot_obj = self.pool.get('auction.lots')
+ if data['lot_ids']:
+ lot_obj.write(cr, uid, data['lot_ids'], {'state':'taken_away'})
+ return {'lot_ids': []}
+
+auction_taken()
diff --git a/addons/auction/wizard/auction_taken_view.xml b/addons/auction/wizard/auction_taken_view.xml
new file mode 100644
index 00000000000..8ed7f730427
--- /dev/null
+++ b/addons/auction/wizard/auction_taken_view.xml
@@ -0,0 +1,42 @@
+
+
+
+
+ auction.taken.form
+ auction.taken
+ form
+
+
+
+
+
+
+ Gestion emporte
+ auction.taken
+ form
+ tree,form
+
+ new
+
+
+
+
+
+
diff --git a/addons/auction/wizard/wizard_auction_invoice_buyer.py b/addons/auction/wizard/wizard_auction_invoice_buyer.py
deleted file mode 100644
index 6cf12b5da22..00000000000
--- a/addons/auction/wizard/wizard_auction_invoice_buyer.py
+++ /dev/null
@@ -1,111 +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 pooler
-
-invoice_form = '''
-'''
-
-invoice_fields = {
- 'amount': {'string':'Invoiced Amount', 'type':'float', 'required':True, 'readonly':True},
- 'objects': {'string':'# of objects', 'type':'integer', 'required':True, 'readonly':True},
- 'number': {'string':'Invoice Number', 'type':'char'},
- 'buyer_id':{'string': 'Buyer', 'type': 'many2one', 'relation':'res.partner'}
-
-}
-
-
-def _values(self,cr,uid, datas,context={}):
- pool = pooler.get_pool(cr.dbname)
- lots= pool.get('auction.lots').browse(cr,uid,datas['ids'])
-# price = 0.0
- amount_total=0.0
-# pt_tax=pooler.get_pool(cr.dbname).get('account.tax')
- for lot in lots:
- buyer=lot and lot.ach_uid.id or False
- amount_total+=lot.buyer_price
-# taxes = lot.product_id.taxes_id
-# if lot.author_right:
-# taxes.append(lot.author_right)
-# if lot.auction_id:
-# taxes += lot.auction_id.buyer_costs
-# tax=pt_tax.compute(cr,uid,taxes,lot.obj_price,1)
-# for t in tax:
-# amount_total+=t['amount']
-# amount_total+=lot.obj_price
- # up_auction=pooler.get_pool(cr.dbname).get('auction.lots').write(cr,uid,[lot.id],{'ach_uid':datas['form']['buyer_id']})
- invoice_number = False
- return {'objects':len(datas['ids']), 'amount':amount_total, 'number':invoice_number,'buyer_id':buyer}
-
-
-def _makeInvoices(self, cr, uid, data, context):
- newinv = []
- pool = pooler.get_pool(cr.dbname)
- order_obj = pool.get('auction.lots')
- mod_obj = pool.get('ir.model.data')
- result = mod_obj._get_id(cr, uid, 'account', 'view_account_invoice_filter')
- id = mod_obj.read(cr, uid, result, ['res_id'])
- lots= order_obj.browse(cr,uid,data['ids'])
- invoice_number=data['form']['number']
- for lot in lots:
- up_auction=pooler.get_pool(cr.dbname).get('auction.lots').write(cr,uid,[lot.id],{'ach_uid':data['form']['buyer_id']})
- ids = order_obj.lots_invoice(cr, uid, data['ids'],context,data['form']['number'])
-# ids = order_obj.lots_invoice(cr, uid, data['ids'],context,invoice_number)
- cr.commit()
- return {
- 'domain': "[('id','in', ["+','.join(map(str, ids))+"])]",
- 'name': 'Buyer invoices',
- 'view_type': 'form',
- 'view_mode': 'tree,form',
- 'res_model': 'account.invoice',
- 'view_id': False,
- 'context': "{'type':'in_refund'}",
- 'type': 'ir.actions.act_window',
- 'search_view_id': id['res_id']
- }
- return {}
-
-class make_invoice(wizard.interface):
- states = {
- 'init' : {
- 'actions' : [_values],
- 'result' : {'type' : 'form',
- 'arch' : invoice_form,
- 'fields' : invoice_fields,
- 'state' : [('end', 'Cancel'),('invoice', 'Create invoices')]}
- },
- 'invoice' : {
- 'actions' : [],
- 'result' : {'type' : 'action',
- 'action' : _makeInvoices}
- },
- }
-make_invoice("auction.lots.make_invoice_buyer")
-# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
-
diff --git a/addons/auction/wizard/wizard_auction_journal.py b/addons/auction/wizard/wizard_auction_journal.py
deleted file mode 100644
index 79329592165..00000000000
--- a/addons/auction/wizard/wizard_auction_journal.py
+++ /dev/null
@@ -1,105 +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 pooler
-
-
-
-invoice_form = '''
-'''
-
-invoice_fields = {
- 'amount': {'string':'Invoiced Amount', 'type':'float', 'required':True, 'readonly':True},
- 'objects': {'string':'# of objects', 'type':'integer', 'required':True, 'readonly':True},
- 'number': {'string':'Invoice Number', 'type':'integer'},
-}
-
-def _values(self,cr,uid, datas,context={}):
- lots= pooler.get_pool(cr.dbname).get('auction.lots').browse(cr,uid,datas['ids'])
-# service = netsvc.LocalService("object_proxy")
-# lots = service.execute(cr,uid, 'auction.lots', 'read', datas['ids'])
-# auction = service.execute(cr,uid, 'auction.dates', 'read', [lots[0]['auction_id'][0]])[0]
- price = 0.0
- amount_total=0.0
- pt_tax=pooler.get_pool(cr.dbname).get('account.tax')
- for lot in lots:
- # taxes = lot.product_id.taxes_id
- # if lot.bord_vnd_id.tax_id:
- # taxes.append(lot.bord_vnd_id.tax_id)
- # if lot.auction_id:
- # taxes += lot.auction_id.seller_costs
- # tax=pt_tax.compute(cr,uid,taxes,lot.obj_price,1)
- # for t in tax:
- # amount_total+=t['amount']
- # amount_total+=lot.obj_price
- amount_total+=lot.seller_price
-#TODO: recuperer id next invoice (de la sequence)???
- invoice_number = False
- return {'objects':len(datas['ids']), 'amount':amount_total, 'number':invoice_number}
-
-def _makeInvoices(self, cr, uid, data, context):
-
- pool = pooler.get_pool(cr.dbname)
- order_obj = pool.get('auction.lots')
- mod_obj = pool.get('ir.model.data')
- result = mod_obj._get_id(cr, uid, 'account', 'view_account_invoice_filter')
- id = mod_obj.read(cr, uid, result, ['res_id'])
- newinv = []
- ids = order_obj.seller_trans_create(cr, uid, data['ids'],context)
- cr.commit()
- return {
- 'domain': "[('id','in', ["+','.join(map(str, ids))+"])]",
- 'name': 'Seller invoices',
- 'view_type': 'form',
- 'view_mode': 'tree,form',
- 'res_model': 'account.invoice',
- 'view_id': False,
- 'context': "{'type':'out_refund'}",
- 'type': 'ir.actions.act_window',
- 'search_view_id': id['res_id']
- }
- return {}
-
-class make_invoice(wizard.interface):
- states = {
- 'init' : {
- 'actions' : [_values],
- 'result' : {'type' : 'form',
- 'arch' : invoice_form,
- 'fields' : invoice_fields,
- 'state' : [('end', 'Cancel'),('invoice', 'Create invoices')]}
- },
- 'invoice' : {
- 'actions' : [_makeInvoices],
- 'result' : {'type' : 'action',
- 'action' : _makeInvoices,
- 'state' : 'end'}
- },
- }
-make_invoice("auction.lots.make_invoice")
-# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
-
diff --git a/addons/auction/wizard/wizard_emporte.py b/addons/auction/wizard/wizard_emporte.py
deleted file mode 100644
index 1172404e218..00000000000
--- a/addons/auction/wizard/wizard_emporte.py
+++ /dev/null
@@ -1,73 +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 pooler
-from tools.misc import UpdateableStr
-
-
-# Dossier
-
-_lot_arch = """
-
-"""
-_lot_fields = {
- 'lot_ids': {'string':'Lots Emportes','relation':'auction.lots','type':'many2many'}
-}
-
-def _to_xml(s):
- return s.replace('&','&').replace('<','<').replace('>','>')
-
-def _process(self, cr, uid, data, context):
- pool = pooler.get_pool(cr.dbname)
- lot_obj = pool.get('auction.lots')
- if data['form']['lot_ids']:
- lot_obj.write(cr, uid, data['form']['lot_ids'][0][2], {'state':'taken_away'})
- return {'lot_ids': []}
-
-class wizard_reprint(wizard.interface):
- states = {
- 'valid': {
- 'actions': [_process],
- 'result': {'type':'state', 'state':'init'}
- },
- 'init': {
- 'actions': [],
- 'result': {
- 'type':'form',
- 'arch': _lot_arch,
- 'fields': _lot_fields,
- 'state': [
- ('valid',' OK ')
- ],
- }
- }
- }
-wizard_reprint('auction.taken')
-
-
-# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
-
diff --git a/addons/auction/wizard/wizard_lot_date_move.py b/addons/auction/wizard/wizard_lot_date_move.py
deleted file mode 100644
index e6e13ea0ab2..00000000000
--- a/addons/auction/wizard/wizard_lot_date_move.py
+++ /dev/null
@@ -1,96 +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 pooler
-import sql_db
-
-auction_move = '''
-'''
-
-auction_move_fields = {
- 'auction_id': {'string':'Auction Date', 'type':'many2one', 'required':True, 'relation':'auction.dates'},
-}
-
-#def _auction_move_set(self, uid, datas):
-# if datas['form']['auction_id']:
-# cr = sql_db.db.cursor()
-# cr.execute('update auction_lots set auction_id=%s, obj_price=NULL, ach_login=NULL, ach_uid=NULL, ach_pay_id=NULL, ach_inv_id=NULL, state=%s where id in ('+','.join(map(str, datas['ids']))+')', (str(datas['form']['auction_id']), 'draft'))
-# cr.execute('delete from auction_bid_line where lot_id in ('+','.join(map(str, datas['ids']))+')')
-# cr.commit()
-# cr.close()
-# return {}
-def _top(self,cr,uid,datas,context={}):
- refs = pooler.get_pool(cr.dbname).get('auction.lots')
- rec_ids = refs.browse(cr,uid,datas['ids'])
- for rec in rec_ids:
- if not rec.auction_id:
- raise wizard.except_wizard('Error !','You can not move a lot that has no auction date')
- return {}
-def _auction_move_set(self,cr,uid,datas,context={}):
- if not (datas['form']['auction_id'] and len(datas['ids'])) :
- return {}
- refs = pooler.get_pool(cr.dbname).get('auction.lots')
- rec_ids = refs.browse(cr,uid,datas['ids'])
-
- line_ids= pooler.get_pool(cr.dbname).get('auction.bid_line').search(cr,uid,[('lot_id','in',datas['ids'])])
-# pooler.get_pool(cr.dbname).get('auction.bid_line').unlink(cr, uid, line_ids)
- for rec in rec_ids:
- new_id=pooler.get_pool(cr.dbname).get('auction.lot.history').create(cr,uid,{
- 'auction_id':rec.auction_id.id,
- 'lot_id':rec.id,
- 'price': rec.obj_ret
- })
- up_auction=pooler.get_pool(cr.dbname).get('auction.lots').write(cr,uid,[rec.id],{
- 'auction_id':datas['form']['auction_id'],
- 'obj_ret':None,
- 'obj_price':None,
- 'ach_login':None,
- 'ach_uid':None,
- 'ach_inv_id':None,
- 'sel_inv_id':None,
- 'obj_num':None,
- 'state':'draft'})
- return {}
-
-class wiz_auc_lots_auction_move(wizard.interface):
- states = {
- 'init': {
- 'actions': [_top],
- 'result': {'type': 'form', 'arch':auction_move, 'fields': auction_move_fields, 'state':[('set_date', 'Move to Auction date'),('end','Cancel')]}
- },
- 'set_date': {
- 'actions': [_auction_move_set],
- 'result': {'type': 'state', 'state':'end'}
- }
- }
-
-wiz_auc_lots_auction_move('auction.lots.auction_move')
-
-# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
-
diff --git a/addons/auction/wizard/wizard_lots_pay.py b/addons/auction/wizard/wizard_lots_pay.py
deleted file mode 100644
index a6b8f635ba4..00000000000
--- a/addons/auction/wizard/wizard_lots_pay.py
+++ /dev/null
@@ -1,103 +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 netsvc
-import osv
-import time
-import pooler
-
-invoice_form = '''
-'''
-
-invoice_fields = {
- 'amount': {'string': 'Amount paid', 'type':'float', 'required':True},
- 'dest_account_id': {'string':'Payment to Account', 'type':'many2one', 'required':True, 'relation':'account.account', 'domain':[('type','=','cash')]},
- 'journal_id': {'string': 'Journal', 'type': 'many2one', 'relation':'account.journal', 'required':True},
- 'period_id': {'string': 'Period', 'type': 'many2one', 'relation':'account.period', 'required':True},
-}
-#def pay_n_check(self, cr, uid, data, context):
-#
-# auction = pool.get('auction.lots').browse(cr,uid,data['id'],context)
-# try:
-#
-# for lot in auction:
-#
-# if not lot.auction_id :
-# raise osv.except_osv("Error","No payment defined for this auction.")
-# i=1
-# tot= 0
-# for payment in auction:
-# if not payment.journal_id :
-# raise osv.except_osv("Error","No journal defined for the payment line %d" % (i,))
-# if not payment.ach_inv_id.amount :
-# raise osv.except_osv("Error","No amount defined for the payment line %d." % (i,))
-# i+=1
-# tot+= payment.ach_inv_id.amount
-# if abs(float(tot)) - abs(float(lot.obj_ret)) > 10**-6:
-# raise osv.except_osv("Error","The amount paid does not match the total amount")
-# else:
-# for lot in auction:
-# if not lot.journal_id :
-# raise osv.except_osv("Error","Please choose a journal for the auction ("+lot.name+").")
-# pool.get('auction.lots').create(cr,uid,{
-# 'auction_id': lot.auction.id,
-# 'journal_id': lot.journal_id,
-#
-# })
-# except osv.except_osv, e:
-# raise wizard.except_wizard(e.name, e.name)
-# return True
-def _pay_and_reconcile(self, cr, uid, data, context):
-
- pool = pooler.get_pool(cr.dbname)
- lot = pool.get('auction.lots').browse(cr,uid,data['id'],context)
- form = data['form']
- account_id = form.get('writeoff_acc_id', False)
- period_id = form.get('period_id', False)
- journal_id = form.get('journal_id', False)
- if lot.sel_inv_id:
- p=pool.get('account.invoice').pay_and_reconcile(['lot.sel_inv_id.id'], form['amount'], form['dest_account_id'], journal_id, account_id, period_id, journal_id, context)
-# lots.sel_inv_id.pay_and_reconcile(cr,uid,data[id], form['amount'], form['dest_account_id'], journal_id, account_id, period_id, journal_id, context)
- return {}
-
-
-class wiz_auc_lots_pay(wizard.interface):
- states = {
- 'init': {
- 'actions': [],
- 'result': {'type': 'form', 'arch':invoice_form, 'fields': invoice_fields, 'state':[ ('pay','Pay'), ('end','Cancel')]}
- },
- 'pay': {
- 'actions': [_pay_and_reconcile],
- 'result': {'type': 'state', 'state':'end'}
- }}
-wiz_auc_lots_pay('auction.pay.sel');
-
-
-# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
-
diff --git a/addons/auction/wizard/wizard_lots_sms.py b/addons/auction/wizard/wizard_lots_sms.py
deleted file mode 100644
index dc60a9bd24d..00000000000
--- a/addons/auction/wizard/wizard_lots_sms.py
+++ /dev/null
@@ -1,150 +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 urllib
-
-sms_send_form = '''
-''' % ('SMS - Gateway: clickatell', 'Bulk SMS send')
-
-sms_send_fields = {
- 'app_id': {'string':'API ID', 'type':'char', 'required':True},
- 'user': {'string':'Login', 'type':'char', 'required':True},
- 'password': {'string':'Password', 'type':'char', 'required':True},
- 'text': {'string':'SMS Message', 'type':'text', 'required':True, 'value':'Les lots [lots] vous ont etes adjuges. -- Rops'}
-}
-##############################################################################
-#
-# Copyright (c) 2004-2006 TINY SPRL. (http://tiny.be) All Rights Reserved.
-# Fabien Pinckaers
-#
-# WARNING: This program as such is intended to be used by professional
-# programmers who take the whole responsability of assessing all potential
-# consequences resulting from its eventual inadequacies and bugs
-# End users who are looking for a ready-to-use solution with commercial
-# garantees and support are strongly adviced to contract a Free Software
-# Service Company
-#
-# This program is Free Software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License
-# as published by the Free Software Foundation; either version 2
-# 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 General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-#
-##############################################################################
-
-import wizard
-import netsvc
-import pooler
-
-sms_send_form = '''
-''' % ('SMS - Gateway: clickatell','Bulk SMS send')
-
-sms_send_fields = {
- 'app_id': {'string':'API ID', 'type':'char', 'required':True},
- 'user': {'string':'Login', 'type':'char', 'required':True},
- 'password': {'string':'Password', 'type':'char', 'required':True},
- 'text': {'string':'SMS Message', 'type':'text', 'required':True}
-}
-
-def _sms_send(self, cr, uid, data, context):
- service = netsvc.LocalService("object_proxy")
- lots = service.execute(cr.dbname,uid, 'auction.lots', 'read', data['ids'], ['obj_num','obj_price','ach_uid'])
- res = service.execute(cr.dbname,uid, 'res.partner', 'read', [l['ach_uid'] for l in lots if l['ach_uid']], ['gsm'])
- #res = service.execute(cr.dbname, uid, 'res.partner', 'read', data['ids'], ['gsm'])
-# service = netsvc.LocalService("object_proxy")
-# pool=pooler.get_pool(cr.dbname)
-# lots=pool.get('auction.lots').browse(cr,uid,data['id'],context)
-# r=lots.ach_uid.id
- nbr = 0
- for r in res:
- to = r['mobile']
- if to:
- tools.smssend(data['form']['user'], data['form']['password'], data['form']['app_id'], unicode(data['form']['text'], 'utf-8').encode('latin1'), to)
- nbr += 1
- return {'sms_sent': nbr}
-
- if to:
- tools.smssend(data['form']['user'], data['form']['password'], data['form']['app_id'], unicode(data['form']['text'], 'utf-8').encode('latin1'), to)
- nbr += 1
- return {'sms_sent': nbr}
-#
-#def _sms_send(self, uid, datas):
-# service = netsvc.LocalService("object_proxy")
-# pool=pooler.ger_pool(cr.dbname)
-# lots=pool.get('auction.lots').browse(cr,uid,datas['ids'],context)
-# #lots = service.execute(uid, 'auction.lots', 'read', datas['ids'], ['obj_num','obj_price','ach_uid'])
-# #part = service.execute(uid, 'res.partner', 'read', [l['ach_uid'] for l in lots if l['ach_uid']], ['gsm'])
-#
-# part =ach_uid.id
-# part = map(lambda x: (x.id,x.mobile), part)
-# for l in lots:
-# part.append(str(l.obj_num)+'-%dEUR' % int(l.obj_price))
-#
-# for p in part.values():
-# to = p.mobile
-# if to:
-# params = urllib.urlencode({'user': datas['form']['user'], 'password': datas['form']['password'], 'api_id': datas['form']['app_id'], 'text':unicode(datas['form']['text'].replace('[lots]',', '.join(p['lots'])), 'utf-8').encode('latin1'), 'to':to})
-# f = urllib.urlopen("http://196.7.150.220/http/sendmsg", params)
-# nbr+=1
-# return {'sms_sent':nbr}
-
-class lots_sms(wizard.interface):
- states = {
- 'init': {
- 'actions': [],
- 'result': {'type': 'form', 'arch':sms_send_form, 'fields': sms_send_fields, 'state':[('send','Send SMS'), ('end','Cancel')]}
- },
- 'send': {
- 'actions': [_sms_send],
- 'result': {'type': 'state', 'state':'end'}
- }
- }
-lots_sms('auction.lots.sms_send');
-
-# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
-
diff --git a/addons/auction/wizard/wizard_pay.py b/addons/auction/wizard/wizard_pay.py
deleted file mode 100644
index ff68c2b5b8d..00000000000
--- a/addons/auction/wizard/wizard_pay.py
+++ /dev/null
@@ -1,109 +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 netsvc
-import osv
-import time
-import pooler
-pay_form = '''
-'''
-
-def _start(self,cr,uid,data,context):
- pool = pooler.get_pool(cr.dbname)
- rec=pool.get('auction.lots').browse(cr,uid,data['ids'],context)
- amount1=0.0
- for r in rec:
- amount1+=r.buyer_price
- buyer= r and r.ach_uid.id or False
- if r.is_ok:
- raise wizard.except_wizard('Error !', 'Some lots of the selection are already paid.')
- return {'amount':amount1, 'total':amount1,'buyer_id':buyer}
-
-pay_fields = {
- 'amount': {'string': 'Amount paid', 'type':'float'},
- 'buyer_id': {'string': 'Buyer', 'type': 'many2one', 'relation':'res.partner'},
- 'statement_id1': {'string':'Statement', 'type':'many2one', 'required':True, 'relation':'account.bank.statement'},
- 'amount2': {'string': 'Amount paid', 'type':'float'},
- 'statement_id2': {'string':'Statement', 'type':'many2one', 'relation':'account.bank.statement'},
- 'amount3': {'string': 'Amount paid', 'type':'float'},
- 'statement_id3': {'string':'Statement', 'type':'many2one', 'relation':'account.bank.statement'},
- 'total': {'string': 'Amount to paid', 'type':'float','readonly':True}
-}
-
-def _pay_and_reconcile(self, cr, uid, data, context):
- if not abs(data['form']['total'] - (data['form']['amount']+data['form']['amount2']+data['form']['amount3']))<0.01:
- rest=data['form']['total']-(data['form']['amount']+data['form']['amount2']+data['form']['amount3'])
- raise wizard.except_wizard('Payment aborted !', 'You should pay all the total: "%.2f" are missing to accomplish the payment.' %(round(rest,2)))
-
- pool = pooler.get_pool(cr.dbname)
- lots = pool.get('auction.lots').browse(cr,uid,data['ids'],context)
- ref_bk_s=pooler.get_pool(cr.dbname).get('account.bank.statement.line')
-
- for lot in lots:
- if data['form']['buyer_id']:
- pool.get('auction.lots').write(cr,uid,[lot.id],{'ach_uid':data['form']['buyer_id']})
- if not lot.auction_id:
- raise wizard.except_wizard('Error !', 'No auction date for "%s": Please set one.'%(lot.name))
- pool.get('auction.lots').write(cr,uid,[lot.id],{'is_ok':True})
-
- for st,stamount in [('statement_id1','amount'),('statement_id2','amount2'),('statement_id3','amount3')]:
- if data['form'][st]:
- new_id=ref_bk_s.create(cr,uid,{
- 'name':'Buyer:'+str(lot.ach_login or '')+', auction:'+ lots[0].auction_id.name,
- 'date': time.strftime('%Y-%m-%d'),
- 'partner_id':data['form']['buyer_id'] or False,
- 'type':'customer',
- 'statement_id':data['form'][st],
- 'account_id':lot.auction_id.acc_income.id,
- 'amount':data['form'][stamount]
- })
- for lot in lots:
- pool.get('auction.lots').write(cr,uid,[lot.id],{'statement_id':[(4,new_id)]})
- return {}
-
-
-class wiz_auc_lots_pay(wizard.interface):
- states = {
- 'init': {
- 'actions': [_start],
- 'result': {'type': 'form', 'arch':pay_form, 'fields': pay_fields, 'state':[('end','Cancel'),('pay','Pay')]}
- },
- 'pay': {
- 'actions': [_pay_and_reconcile],
- 'result': {'type': 'state', 'state':'end'}
- }}
-wiz_auc_lots_pay('auction.pay.buy')
-
-
-# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
-
diff --git a/addons/auction/wizard/wizard_payer.py b/addons/auction/wizard/wizard_payer.py
deleted file mode 100644
index 6e224fbadad..00000000000
--- a/addons/auction/wizard/wizard_payer.py
+++ /dev/null
@@ -1,79 +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 netsvc
-import osv
-import time
-import pooler
-
-pay_form = '''
-'''
-pay_fields = {
-}
-
-
-pay_form1 = '''
-'''
-pay_fields1 = {
-}
-def _payer(self, cr, uid, data, context):
- pool = pooler.get_pool(cr.dbname)
- pool.get('auction.lots').write(cr,uid,data['ids'],{'is_ok':True, 'state':'paid'})
- return {}
-
-
-def _payer_sel(self, cr, uid, data, context):
- pool = pooler.get_pool(cr.dbname)
- pool.get('auction.lots').write(cr,uid,data['ids'],{'paid_vnd':True})
- return {}
-
-
-class wiz_auc_pay(wizard.interface):
- states = {
- 'init': {
- 'actions': [],
- 'result': {'type': 'form', 'arch':pay_form, 'fields': pay_fields, 'state':[('end','Cancel'),('pay','Pay')]}
- },
- 'pay': {
- 'actions': [_payer],
- 'result': {'type': 'state', 'state':'end'}
- }}
-wiz_auc_pay('auction.payer')
-
-
-class wiz_auc_pay_sel(wizard.interface):
- states = {
- 'init': {
- 'actions': [],
- 'result': {'type': 'form', 'arch':pay_form1, 'fields': pay_fields1, 'state':[('end','Cancel'),('pay2','Pay')]}
- },
- 'pay2': {
- 'actions': [_payer_sel],
- 'result': {'type': 'state', 'state':'end'}
- }}
-wiz_auc_pay_sel('auction.payer.sel')
-
-# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
-
diff --git a/addons/audittrail/__terp__.py b/addons/audittrail/__terp__.py
index e7ecd839efb..8718523e7f1 100644
--- a/addons/audittrail/__terp__.py
+++ b/addons/audittrail/__terp__.py
@@ -31,6 +31,7 @@
'depends': ['base'],
'init_xml': [],
'update_xml': [
+ 'wizard/audittrail_view_log_view.xml',
'audittrail_view.xml',
'security/ir.model.access.csv',
'security/audittrail_security.xml'
diff --git a/addons/audittrail/audittrail_view.xml b/addons/audittrail/audittrail_view.xml
index 98a4ecc00e9..536ca78741e 100644
--- a/addons/audittrail/audittrail_view.xml
+++ b/addons/audittrail/audittrail_view.xml
@@ -124,8 +124,8 @@
-
-
+
+
diff --git a/addons/audittrail/wizard/__init__.py b/addons/audittrail/wizard/__init__.py
index c7b5a20d884..9b2af466a01 100644
--- a/addons/audittrail/wizard/__init__.py
+++ b/addons/audittrail/wizard/__init__.py
@@ -19,6 +19,6 @@
#
##############################################################################
-import wizard_view_log
+import audittrail_view_log
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
diff --git a/addons/audittrail/wizard/audittrail_view_log.py b/addons/audittrail/wizard/audittrail_view_log.py
new file mode 100644
index 00000000000..2e170f27200
--- /dev/null
+++ b/addons/audittrail/wizard/audittrail_view_log.py
@@ -0,0 +1,72 @@
+# -*- 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
+from tools.translate import _
+import netsvc
+import pooler
+import time
+import tools
+import wizard
+
+class audittrail_view_log(osv.osv_memory):
+
+ _name = "audittrail.view.log"
+ _description = "View Log"
+ _columns ={
+ 'from':fields.datetime('Log From'),
+ 'to':fields.datetime('Log To', required = True)
+ }
+ _defaults = {
+ 'to': lambda *a: time.strftime("%Y-%m-%d %H:%M:%S"),
+ }
+
+ def log_open_window(self, cr, uid, ids, context):
+ """
+ Open Log form from given date range..
+ @param cr: the current row, from the database cursor,
+ @param uid: the current user’s ID for security checks,
+ @param ids: List of audittrail view log’s IDs.
+ @return: Dictionary of audittrail log form on given date range.
+ """
+ mod_obj = self.pool.get('ir.model.data')
+ act_obj = self.pool.get('ir.actions.act_window')
+ result = mod_obj._get_id(cr, uid, 'audittrail', 'action_audittrail_log_tree')
+ id = mod_obj.read(cr, uid, [result], ['res_id'])[0]['res_id']
+ result = act_obj.read(cr, uid, [id])[0]
+ log_obj= self.pool.get(result['res_model'])
+ log_id = log_obj.search(cr, uid, [])
+ log_model=log_obj.read(cr, uid,log_id,['object_id'])
+ for datas in self.read(cr, uid, ids):
+ if not datas['from']:
+ if datas['to'] <> time.strftime("%Y-%m-%d %H:%M:%S"):
+ result['domain'] = str([('timestamp', '<',datas['to'])])
+ else:
+ pass
+ else:
+ result['domain'] = str([('timestamp', '>',datas['from']),('timestamp', '<',datas['to'])])
+ return result
+
+audittrail_view_log()
+
+
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
+
diff --git a/addons/audittrail/wizard/audittrail_view_log_view.xml b/addons/audittrail/wizard/audittrail_view_log_view.xml
new file mode 100644
index 00000000000..87648c7e136
--- /dev/null
+++ b/addons/audittrail/wizard/audittrail_view_log_view.xml
@@ -0,0 +1,34 @@
+
+
+
+
+ audittrail.view.log.form
+ audittrail.view.log
+ form
+
+
+
+
+
+
+ View log
+ audittrail.view.log
+ form
+ tree,form
+
+ new
+
+
+
+
diff --git a/addons/audittrail/wizard/wizard_view_log.py b/addons/audittrail/wizard/wizard_view_log.py
deleted file mode 100644
index 81936bcd54c..00000000000
--- a/addons/audittrail/wizard/wizard_view_log.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 .
-#
-##############################################################################
-
-import wizard
-import pooler
-import time
-
-class wizard_view_log(wizard.interface):
-
- form1 = '''
- '''
-
- form1_fields = {
- 'from': {
- 'string': 'Log From',
- 'type': 'datetime',
-
- },
- 'to': {
- 'string': 'Log To',
- 'type': 'datetime',
- 'default': lambda *a: time.strftime("%Y-%m-%d %H:%M:%S"),
- 'required':True
- },
- }
-
-
- def _log_open_window(self, cr, uid, data, context):
- mod_obj = pooler.get_pool(cr.dbname).get('ir.model.data')
- act_obj = pooler.get_pool(cr.dbname).get('ir.actions.act_window')
- result = mod_obj._get_id(cr, uid, 'audittrail', 'action_audittrail_log_tree')
- id = mod_obj.read(cr, uid, [result], ['res_id'])[0]['res_id']
- result = act_obj.read(cr, uid, [id])[0]
- log_obj= pooler.get_pool(cr.dbname).get(result['res_model'])
- log_id = log_obj.search(cr, uid, [])
- log_model=log_obj.read(cr, uid,log_id,['object_id'])
- if not data['form']['from']:
- if data['form']['to'] <> time.strftime("%Y-%m-%d %H:%M:%S"):
- result['domain'] = str([('timestamp', '<',data['form']['to'])])
- else:
- pass
- else:
- result['domain'] = str([('timestamp', '>',data['form']['from']),('timestamp', '<',data['form']['to'])])
-
- return result
-
- states = {
- 'init': {
- 'actions': [],
- 'result': {'type': 'form', 'arch':form1, 'fields':form1_fields, 'state': [('end', 'Cancel'), ('open', 'Open Logs')]}
- },
- 'open': {
- 'actions': [],
- 'result': {'type': 'action', 'action':_log_open_window, 'state':'end'}
- }
- }
-wizard_view_log('audittrail.view.log')
-# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
-
diff --git a/addons/base_calendar/__terp__.py b/addons/base_calendar/__terp__.py
index e433fbb7668..ce65e1166c5 100644
--- a/addons/base_calendar/__terp__.py
+++ b/addons/base_calendar/__terp__.py
@@ -40,7 +40,8 @@
],
"demo_xml" : [],
"update_xml" : [
- 'security/ir.model.access.csv',
+ 'security/ir.model.access.csv',
+ 'wizard/calendar_event_edit_all_view.xml',
'base_calendar_view.xml'
],
"installable" : True,
diff --git a/addons/base_calendar/wizard/__init__.py b/addons/base_calendar/wizard/__init__.py
index 60c61475131..38f790bcd42 100644
--- a/addons/base_calendar/wizard/__init__.py
+++ b/addons/base_calendar/wizard/__init__.py
@@ -18,7 +18,8 @@
# along with this program. If not, see .
#
##############################################################################
-import wizard_cal_edit_event
+
+import calendar_event_edit_all
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
diff --git a/addons/base_calendar/wizard/calendar_event_edit_all.py b/addons/base_calendar/wizard/calendar_event_edit_all.py
new file mode 100644
index 00000000000..0a7fddadb2a
--- /dev/null
+++ b/addons/base_calendar/wizard/calendar_event_edit_all.py
@@ -0,0 +1,85 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+# OpenERP, Open Source Management Solution
+# 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
+# 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
+import pooler
+import time
+import tools
+import wizard
+
+class calendar_event_edit_all(osv.osv_memory):
+
+ def _default_values(self, cr, uid, context={}):
+ """
+ @Return : Get Default value for Start Date
+ """
+ if context.get('date'):
+ return context.get('date')
+ else:
+ model = context.get('model')
+ model_obj = self.pool.get(model)
+ event = model_obj.read(cr, uid, context['active_id'], ['name', 'location', 'alarm_id'])
+ return event['date']
+
+ def _default_deadline(self, cr, uid, context={}):
+ """
+ @return : Get Default value for End Date
+ """
+ if context.get('date_deadline'):
+ return context.get('date_deadline')
+ else:
+ model = context.get('model')
+ model_obj = self.pool.get(model)
+ event = model_obj.read(cr, uid, context['active_id'], ['name', 'location', 'alarm_id'])
+ return event['date_deadline']
+
+ def _modify_this(self, cr, uid, ids, context=None):
+ """
+ Modify All event for Crm Meeting.
+ @param cr: the current row, from the database cursor,
+ @param uid: the current user’s ID for security checks,
+ @param ids: List of calendar event edit all’s IDs
+ """
+ for datas in self.read(cr, uid, ids):
+ model = context.get('model')
+ model_obj = self.pool.get(model)
+ model_obj.modify_all(cr, uid, [context['active_id']], datas, context)
+ return {}
+
+ _name = "calendar.event.edit.all"
+ _description = "Calendar Edit all event"
+ _columns ={
+ 'name':fields.char('Title', size=64, required=True),
+ 'date':fields.datetime('Start Date', required=True),
+ 'date_deadline':fields.datetime('End Date', required=True),
+ 'location':fields.char('Location', size=124),
+ 'alarm_id':fields.many2one('res.alarm', 'Reminder'),
+ }
+ _defaults = {
+ 'date':_default_values,
+ 'date_deadline':_default_deadline
+ }
+
+calendar_event_edit_all()
+
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
diff --git a/addons/base_calendar/wizard/calendar_event_edit_all_view.xml b/addons/base_calendar/wizard/calendar_event_edit_all_view.xml
new file mode 100644
index 00000000000..15bd025441a
--- /dev/null
+++ b/addons/base_calendar/wizard/calendar_event_edit_all_view.xml
@@ -0,0 +1,41 @@
+
+
+
+
+ calendar.event.edit.all.form
+ calendar.event.edit.all
+ form
+
+
+
+
+
+
+ Edit all events
+ calendar.event.edit.all
+ form
+ tree,form
+
+ new
+
+
+
+
diff --git a/addons/base_calendar/wizard/wizard_cal_edit_event.py b/addons/base_calendar/wizard/wizard_cal_edit_event.py
deleted file mode 100644
index 8c2da2314c5..00000000000
--- a/addons/base_calendar/wizard/wizard_cal_edit_event.py
+++ /dev/null
@@ -1,78 +0,0 @@
-# -*- coding: utf-8 -*-
-##############################################################################
-#
-# OpenERP, Open Source Management Solution
-# 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
-# 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
-
-class event_edit_all(wizard.interface):
- event_form = """
- """
-
- event_fields = {
- 'name': {'string': 'Title', 'type': 'char', 'size': 64, 'required': True},
- 'date': {'string': 'Start Date', 'type': 'datetime', 'required': True},
- 'date_deadline': {'string': 'End Date', 'type': 'datetime', 'required': True},
- 'location': {'string': 'Location', 'type': 'char', 'size': 124},
- 'alarm_id': {'string': 'Reminder', 'type': 'many2one', 'relation': 'res.alarm'},
- }
-
- def _default_values(self, cr, uid, data, context=None):
- model = data.get('model')
- model_obj = pooler.get_pool(cr.dbname).get(model)
- event = model_obj.read(cr, uid, data['id'], ['name', 'location', 'alarm_id'])
- event.update({
- 'date': context.get('date'),
- 'date_deadline': context.get('date_deadline')
- })
- return event
-
- def _modify_all(self, cr, uid, datas, context=None):
- model = datas.get('model')
- model_obj = pooler.get_pool(cr.dbname).get(model)
- model_obj.modify_all(cr, uid, datas['id'], datas['form'], context)
- return {}
-
- states = {
- 'init': {
- 'actions': [_default_values],
- 'result': {'type': 'form', 'arch': event_form, 'fields': event_fields,
- 'state': [('end', 'Cancel', 'gtk-cancel'), ('edit', '_Save', 'gtk-save')]}
- },
- 'edit': {
- 'actions': [],
- 'result': {'type': 'action', 'action': _modify_all, 'state': 'end'}
- }
- }
-
-event_edit_all('calendar.event.edit.all')
-
-# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
diff --git a/addons/base_report_creator/__terp__.py b/addons/base_report_creator/__terp__.py
index 5a78a903a5c..bee7ec57c91 100644
--- a/addons/base_report_creator/__terp__.py
+++ b/addons/base_report_creator/__terp__.py
@@ -37,6 +37,7 @@ the "Dashboard" menu.
'init_xml': [],
'update_xml': [
'security/ir.model.access.csv',
+ 'wizard/report_menu_create_view.xml',
'base_report_creator_wizard.xml',
'base_report_creator_view.xml'
],
diff --git a/addons/base_report_creator/base_report_creator_view.xml b/addons/base_report_creator/base_report_creator_view.xml
index 30c6b3735a9..1d606b93ec4 100644
--- a/addons/base_report_creator/base_report_creator_view.xml
+++ b/addons/base_report_creator/base_report_creator_view.xml
@@ -41,7 +41,7 @@
-
+
diff --git a/addons/base_report_creator/base_report_creator_wizard.xml b/addons/base_report_creator/base_report_creator_wizard.xml
index eb956e89c6d..a8dad6f9b41 100644
--- a/addons/base_report_creator/base_report_creator_wizard.xml
+++ b/addons/base_report_creator/base_report_creator_wizard.xml
@@ -1,13 +1,8 @@
-
-
-
-
+
+
+
+
diff --git a/addons/base_report_creator/wizard/__init__.py b/addons/base_report_creator/wizard/__init__.py
index 8fd4dff283a..945d42586d1 100644
--- a/addons/base_report_creator/wizard/__init__.py
+++ b/addons/base_report_creator/wizard/__init__.py
@@ -22,5 +22,6 @@
import wiz_set_filter_fields
import base_report_creator_open
import report_menu_create
+
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
diff --git a/addons/base_report_creator/wizard/report_menu_create.py b/addons/base_report_creator/wizard/report_menu_create.py
index 5d3cc322a7f..38821a81797 100644
--- a/addons/base_report_creator/wizard/report_menu_create.py
+++ b/addons/base_report_creator/wizard/report_menu_create.py
@@ -20,62 +20,55 @@
##############################################################################
-import time
-import wizard
-import osv
+from osv import fields, osv
+from tools.translate import _
+import netsvc
import pooler
+import time
+import tools
+import wizard
-section_form = '''
-'''
-
-section_fields = {
- 'menu_name': {'string':'Menu Name', 'type':'char', 'required':True, 'size':64},
- 'menu_parent_id': {'string':'Parent Menu', 'type':'many2one', 'relation':'ir.ui.menu', 'required':True},
-}
-
-def report_menu_create(self, cr, uid, data, context):
- pool = pooler.get_pool(cr.dbname)
- board = pool.get('base_report_creator.report').browse(cr, uid, data['id'])
-
- view = board.view_type1
- if board.view_type2:
- view+=','+board.view_type2
- if board.view_type3:
- view+=','+board.view_type3
- action_id = pool.get('ir.actions.act_window').create(cr, uid, {
- 'name': board.name,
- 'view_type':'form',
- 'view_mode':view,
- 'context': "{'report_id':%d}" % (board.id,),
- 'res_model': 'base_report_creator.report'
- })
- pool.get('ir.ui.menu').create(cr, uid, {
- 'name': data['form']['menu_name'],
- 'parent_id': data['form']['menu_parent_id'],
- 'icon': 'STOCK_SELECT_COLOR',
- 'action': 'ir.actions.act_window,'+str(action_id)
- }, context)
- return {}
-
-class wizard_section_menu_create(wizard.interface):
- states = {
- 'init': {
- 'actions': [],
- 'result': {'type':'form', 'arch':section_form, 'fields':section_fields, 'state':[('end','Cancel'),('create_menu','Create Menu')]}
- },
- 'create_menu': {
- 'actions': [report_menu_create],
- 'result': {
- 'type':'state',
- 'state':'end'
- }
- }
- }
-wizard_section_menu_create('base_report_creator.report.menu.create')
+class report_menu_create(osv.osv_memory):
+ """
+ Create Menu
+ """
+ _name = "report.menu.create"
+ _description = "Menu Create"
+ _columns ={
+ 'menu_name':fields.char('Menu Name', size=64, required=True),
+ 'menu_parent_id':fields.many2one('ir.ui.menu', 'Parent Menu', required=True),
+ }
+
+ def report_menu_create(self, cr, uid, ids, context):
+ """
+ Create Menu.
+ @param cr: the current row, from the database cursor,
+ @param uid: the current user’s ID for security checks,
+ @param ids: List of Report Menu Create's IDs
+ """
+ board = self.pool.get('base_report_creator.report').browse(cr, uid, context['active_id'])
+ view = board.view_type1
+ if board.view_type2:
+ view+=','+board.view_type2
+ if board.view_type3:
+ view+=','+board.view_type3
+ action_id = self.pool.get('ir.actions.act_window').create(cr, uid, {
+ 'name': board.name,
+ 'view_type':'form',
+ 'view_mode':view,
+ 'context': "{'report_id':%d}" % (board.id,),
+ 'res_model': 'base_report_creator.report'
+ })
+ for data in self.read(cr, uid, ids):
+ self.pool.get('ir.ui.menu').create(cr, uid, {
+ 'name': data['menu_name'],
+ 'parent_id': data['menu_parent_id'],
+ 'icon': 'STOCK_SELECT_COLOR',
+ 'action': 'ir.actions.act_window,'+str(action_id)
+ }, context)
+ return {}
+
+report_menu_create()
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
diff --git a/addons/base_report_creator/wizard/report_menu_create_view.xml b/addons/base_report_creator/wizard/report_menu_create_view.xml
new file mode 100644
index 00000000000..dd8ecb441c4
--- /dev/null
+++ b/addons/base_report_creator/wizard/report_menu_create_view.xml
@@ -0,0 +1,34 @@
+
+
+
+
+ report.menu.create.form
+ report.menu.create
+ form
+
+
+
+
+
+
+ Create Menu for Report
+ report.menu.create
+ form
+ tree,form
+
+ new
+
+
+
+
\ No newline at end of file
diff --git a/addons/crm/__terp__.py b/addons/crm/__terp__.py
index 7f6d8c75aaf..96cdfa0b8f3 100644
--- a/addons/crm/__terp__.py
+++ b/addons/crm/__terp__.py
@@ -77,7 +77,6 @@ between mails and Open ERP.""",
#'crm_lead_wizard.xml',
'crm_lead_view.xml',
'crm_lead_menu.xml',
- 'crm_meeting_wizard.xml',
'crm_meeting_view.xml',
'crm_meeting_menu.xml',
#'crm_phonecall_wizard.xml',
diff --git a/addons/crm/crm_meeting_view.xml b/addons/crm/crm_meeting_view.xml
index a1f1cef502e..59bedbb3b6a 100644
--- a/addons/crm/crm_meeting_view.xml
+++ b/addons/crm/crm_meeting_view.xml
@@ -38,7 +38,7 @@
diff --git a/addons/crm/crm_meeting_wizard.xml b/addons/crm/crm_meeting_wizard.xml
deleted file mode 100644
index 8d6b66b3f2d..00000000000
--- a/addons/crm/crm_meeting_wizard.xml
+++ /dev/null
@@ -1,8 +0,0 @@
-
-
-
-
-
-
diff --git a/addons/mrp/__init__.py b/addons/mrp/__init__.py
index b219d932141..ca3dfa07ac9 100644
--- a/addons/mrp/__init__.py
+++ b/addons/mrp/__init__.py
@@ -26,4 +26,6 @@ import wizard
import report
import company
import schedulers
+
+
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
diff --git a/addons/mrp/__terp__.py b/addons/mrp/__terp__.py
index a147266ce1d..dbd96f6c98e 100644
--- a/addons/mrp/__terp__.py
+++ b/addons/mrp/__terp__.py
@@ -69,6 +69,9 @@
'process/service_product_process.xml',
'process/procurement_process.xml',
'mrp_installer.xml',
+ 'make_procurement.xml',
+ 'orderpoint_procurement.xml',
+ 'schedulers_all.xml',
],
'demo_xml': ['mrp_demo.xml', 'mrp_order_point.xml'],
'installable': True,
diff --git a/addons/mrp/make_procurement.xml b/addons/mrp/make_procurement.xml
new file mode 100644
index 00000000000..fae3eab6f42
--- /dev/null
+++ b/addons/mrp/make_procurement.xml
@@ -0,0 +1,51 @@
+
+
+
+
+
+
+
+ Requisition Request
+ make.procurement
+ form
+
+
+
+
+
+
+ Requisition Request
+ ir.actions.act_window
+ make.procurement
+ form
+ form
+ new
+ {'record_id' : active_id}
+
+
+
+
+
+ Requisition Request
+ client_action_multi
+
+ action
+ product.product
+
+
+
+
\ No newline at end of file
diff --git a/addons/mrp/mrp_wizard.xml b/addons/mrp/mrp_wizard.xml
index 74001494c77..41d945f61a1 100644
--- a/addons/mrp/mrp_wizard.xml
+++ b/addons/mrp/mrp_wizard.xml
@@ -8,7 +8,7 @@
-->
-
+
@@ -24,12 +24,12 @@
-
+
+
+
+
+
+
diff --git a/addons/mrp/orderpoint_procurement.xml b/addons/mrp/orderpoint_procurement.xml
new file mode 100644
index 00000000000..3a2ac2bb638
--- /dev/null
+++ b/addons/mrp/orderpoint_procurement.xml
@@ -0,0 +1,46 @@
+
+
+
+
+
+
+
+ Compute Stock Minimum Rules Only
+ mrp.procurement.orderpoint.compute
+ form
+
+
+
+
+
+
+ Compute Stock Minimum Rules Only
+ ir.actions.act_window
+ mrp.procurement.orderpoint.compute
+ form
+ form
+ new
+ {'record_id' : active_id}
+
+
+
+
+
+ Compute Stock Minimum Rules Only
+ client_action_multi
+
+ action
+ mrp.procurement
+
+
+
+
\ No newline at end of file
diff --git a/addons/mrp/schedulers_all.xml b/addons/mrp/schedulers_all.xml
new file mode 100644
index 00000000000..84d6be3cbd4
--- /dev/null
+++ b/addons/mrp/schedulers_all.xml
@@ -0,0 +1,49 @@
+
+
+
+
+
+
+
+ Compute Schedulers
+ mrp.procurement.compute.all
+ form
+
+
+
+
+
+
+ Compute Schedulers
+ ir.actions.act_window
+ mrp.procurement.compute.all
+ form
+ form
+ new
+ {'record_id' : active_id}
+
+
+
+
+
+ Compute Schedulers
+ client_action_multi
+
+ action
+ mrp.procurement
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/addons/mrp/wizard/__init__.py b/addons/mrp/wizard/__init__.py
index 240f25daa9d..57b1dee1a7c 100644
--- a/addons/mrp/wizard/__init__.py
+++ b/addons/mrp/wizard/__init__.py
@@ -19,14 +19,14 @@
#
##############################################################################
-import wizard_orderpoint_procurement
+import make_procurement_product
+import orderpoint_procurement
+import schedulers_all
import wizard_procurement
-import wizard_schedulers_all
import wizard_price
import wizard_workcenter_load
import wizard_track_prod
import wizard_change_production_qty
-import make_procurement
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
diff --git a/addons/mrp/wizard/make_procurement.py b/addons/mrp/wizard/make_procurement.py
deleted file mode 100644
index 0cf12107181..00000000000
--- a/addons/mrp/wizard/make_procurement.py
+++ /dev/null
@@ -1,102 +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
-import netsvc
-
-import time
-
-def _get_default(obj, cr, uid, data, context=None):
- pool = pooler.get_pool(cr.dbname)
- product = pool.get('product.product').browse(cr, uid, data['id'], context)
- return {'product_id': product.id, 'uom_id':product.uom_id.id, 'qty':1.0}
-
-def make_procurement(obj, cr, uid, data, context=None):
- '''Create procurement'''
- pool = pooler.get_pool(cr.dbname)
- wh = pool.get('stock.warehouse').browse(cr, uid, data['form']['warehouse_id'], context)
- user = pool.get('res.users').browse(cr, uid, uid, context)
- procure_id = pool.get('mrp.procurement').create(cr, uid, {
- 'name':'INT:'+str(user.login),
- 'date_planned':data['form']['date_planned'],
- 'product_id':data['form']['product_id'],
- 'product_qty':data['form']['qty'],
- 'product_uom':data['form']['uom_id'],
- 'location_id':wh.lot_stock_id.id,
- 'procure_method':'make_to_order',
- }, context=context)
- wf_service = netsvc.LocalService("workflow")
- wf_service.trg_validate(uid, 'mrp.procurement', procure_id, 'button_confirm', cr)
- return {}
-
-
-class MakeProcurement(wizard.interface):
- '''Wizard that create a procurement from a product form'''
-
- done_form = """
-"""
- procurement_form = """
-"""
- procurement_fields = {
- 'qty': {'string': 'Quantity', 'type': 'float', 'digits':(16,2), 'required': True},
- 'product_id': {'string': 'product', 'type': 'many2one', 'relation': 'product.product', 'required': True, 'readonly':1},
- 'uom_id': {'string': 'Unit of Measure', 'type': 'many2one', 'relation': 'product.uom', 'required':True},
- 'warehouse_id': {'string': 'Warehouse', 'type': 'many2one', 'relation':'stock.warehouse', 'required':True},
- 'date_planned': {'string': 'Planned Date', 'type': 'date', 'required':True, 'default': lambda *args: time.strftime('%Y-%m-%d')}
- }
-
- states = {
- 'init': {
- 'actions': [_get_default],
- 'result': {'type': 'form', 'arch': procurement_form, 'fields': procurement_fields,
- 'state': [
- ('end', 'Cancel'),
- ('create', 'Ask New Products')
- ]
- }
- },
- 'done': {
- 'actions': [],
- 'result': {'type': 'form', 'arch': done_form, 'fields': {},
- 'state': [
- ('end', 'Close'),
- ]
- }
- },
- 'create': {
- 'actions': [],
- 'result': {'type': 'action', 'action': make_procurement, 'state': 'done'}
- }
- }
-
-MakeProcurement('product.product.procurement')
-# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
-
diff --git a/addons/mrp/wizard/make_procurement_product.py b/addons/mrp/wizard/make_procurement_product.py
new file mode 100644
index 00000000000..3ef342c308d
--- /dev/null
+++ b/addons/mrp/wizard/make_procurement_product.py
@@ -0,0 +1,98 @@
+# -*- 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 pooler
+import netsvc
+from osv import fields, osv
+
+import time
+
+class make_procurement(osv.osv_memory):
+ '''Wizard that create a procurement from a product form'''
+
+ _name = 'make.procurement'
+ _description = 'Make Procurements'
+
+ def onchange_product_id(self, cr, uid, ids, prod_id):
+ product = self.pool.get('product.product').browse(cr, uid, prod_id)
+ return {'value': {'uom_id': product.uom_id.id}}
+
+ _columns = {
+ 'qty': fields.float('Quantity', digits=(16,2), required=True),
+ 'product_id': fields.many2one('product.product', 'Product', required=True, readonly=1),
+ 'uom_id': fields.many2one('product.uom', 'Unit of Measure', required=True),
+ 'warehouse_id': fields.many2one('stock.warehouse', 'Warehouse', required=True),
+ 'date_planned': fields.date('Planned Date', required=True),
+ }
+
+ _defaults = {
+ 'date_planned': lambda *args: time.strftime('%Y-%m-%d'),
+ 'qty': lambda *args: 1.0,
+ }
+
+ def make_procurement(self, cr, uid, ids, context=None):
+ '''Create procurement'''
+ for proc in self.browse(cr, uid, ids):
+ wh = self.pool.get('stock.warehouse').browse(cr, uid, proc.warehouse_id.id, context)
+ user = self.pool.get('res.users').browse(cr, uid, uid, context)
+ procure_id = self.pool.get('mrp.procurement').create(cr, uid, {
+ 'name':'INT:'+str(user.login),
+ 'date_planned': proc.date_planned,
+ 'product_id': proc.product_id.id,
+ 'product_qty': proc.qty,
+ 'product_uom': proc.uom_id.id,
+ 'location_id': wh.lot_stock_id.id,
+ 'procure_method':'make_to_order',
+ })
+ wf_service = netsvc.LocalService("workflow")
+ wf_service.trg_validate(uid, 'mrp.procurement', procure_id, 'button_confirm', cr)
+
+ data_obj = self.pool.get('ir.model.data')
+ id2 = data_obj._get_id(cr, uid, 'mrp', 'mrp_procurement_tree_view')
+ id3 = data_obj._get_id(cr, uid, 'mrp', 'mrp_procurement_form_view')
+ if id2:
+ id2 = data_obj.browse(cr, uid, id2, context=context).res_id
+ if id3:
+ id3 = data_obj.browse(cr, uid, id3, context=context).res_id
+
+ return {
+ 'view_type': 'form',
+ 'view_mode': 'tree,form',
+ 'res_model': 'mrp.procurement',
+ 'res_id' : procure_id,
+ 'views': [(id3,'form'),(id2,'tree')],
+ 'type': 'ir.actions.act_window',
+ }
+
+ def default_get(self, cr, uid, fields, context=None):
+ record_id = context and context.get('record_id', False) or False
+
+ res = super(make_procurement, self).default_get(cr, uid, fields, context=context)
+
+ if record_id:
+ product_id = self.pool.get('product.product').browse(cr, uid, record_id, context=context).id
+ res['product_id'] = product_id
+
+ return res
+
+make_procurement()
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
+
diff --git a/addons/mrp/wizard/orderpoint_procurement.py b/addons/mrp/wizard/orderpoint_procurement.py
new file mode 100644
index 00000000000..bfa67f337f1
--- /dev/null
+++ b/addons/mrp/wizard/orderpoint_procurement.py
@@ -0,0 +1,61 @@
+# -*- 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 .
+#
+##############################################################################
+
+#
+# Order Point Method:
+# - Order if the virtual stock of today is bellow the min of the defined order point
+#
+
+import threading
+from osv import fields,osv
+
+class procurement_compute(osv.osv_memory):
+ _name = 'mrp.procurement.orderpoint.compute'
+ _description = 'Automatic Order Point'
+
+ _columns = {
+ 'automatic': fields.boolean('Automatic Orderpoint', help='If the stock of a product is under 0, it will act like an orderpoint'),
+ }
+
+ _defaults = {
+ 'automatic' : lambda *a: False,
+ }
+
+ def _procure_calculation_orderpoint(self, cr, uid, ids, context):
+ try:
+ proc_obj = self.pool.get('mrp.procurement')
+ for proc in self.browse(cr, uid, ids):
+ proc_obj._procure_orderpoint_confirm(cr, uid, automatic=proc.automatic, use_new_cursor=cr.dbname, context=context)
+ finally:
+ cr.close()
+ return {}
+
+ def procure_calculation(self, cr, uid, ids, context):
+ threaded_calculation = threading.Thread(target=self._procure_calculation_orderpoint, args=(cr, uid, ids, context))
+ threaded_calculation.start()
+ return {}
+
+procurement_compute()
+
+
+
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
+
diff --git a/addons/mrp/wizard/schedulers_all.py b/addons/mrp/wizard/schedulers_all.py
new file mode 100644
index 00000000000..6e8dca9d636
--- /dev/null
+++ b/addons/mrp/wizard/schedulers_all.py
@@ -0,0 +1,53 @@
+# -*- 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 threading
+from osv import osv, fields
+
+class procurement_compute(osv.osv_memory):
+ _name = 'mrp.procurement.compute.all'
+ _description = 'Compute all schedulers'
+
+ _columns = {
+ 'automatic': fields.boolean('Automatic orderpoint',help='Triggers an automatic procurement for all products that have a virtual stock under 0. You should probably not use this option, we suggest using a MTO configuration on products.'),
+ }
+
+ _defaults ={
+ 'automatic': lambda *a: False,
+ }
+
+ def _procure_calculation_all(self, cr, uid, ids, context):
+ proc_obj = self.pool.get('mrp.procurement')
+ for proc in self.browse(cr, uid, ids):
+ proc_obj.run_scheduler(cr, uid, automatic=proc.automatic, use_new_cursor=cr.dbname,\
+ context=context)
+ return {}
+
+ def procure_calculation(self, cr, uid, ids, context):
+ threaded_calculation = threading.Thread(target=self._procure_calculation_all, args=(cr, uid, ids, context))
+ threaded_calculation.start()
+ return {}
+
+procurement_compute()
+
+
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
+
diff --git a/addons/mrp/wizard/wizard_mrp.py b/addons/mrp/wizard/wizard_mrp.py
new file mode 100644
index 00000000000..fefca3ae6e4
--- /dev/null
+++ b/addons/mrp/wizard/wizard_mrp.py
@@ -0,0 +1,84 @@
+# -*- 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
+from tools.translate import _
+import netsvc
+
+class stock_move_produce(osv.osv_memory):
+ _name = "stock.move.produce"
+ _description = "Produce"
+
+ _columns = {
+ 'product_qty': fields.float('Quantity', required=True),
+ 'mode': fields.selection([('consume_produce', 'Consumme & Produce'),
+ ('consume', 'Consumme Only')], 'Mode', required=True)
+ }
+
+ def _get_product_qty(self, cr, uid, context):
+ prod = self.pool.get('mrp.production').browse(cr, uid,
+ context['active_id'], context=context)
+ done = 0.0
+ for move in prod.move_created_ids2:
+ done += move.product_qty
+ return (prod.product_qty - done) or prod.product_qty
+
+ _defaults = {
+ 'product_qty': _get_product_qty,
+ 'mode': lambda *x: 'consume'
+ }
+
+ def do_move_produce(self, cr, uid, ids, context={}):
+ datas = self.read(cr, uid, ids)[0]
+ prod_obj = self.pool.get('mrp.production')
+# wf_service = netsvc.LocalService('workflow')
+# wf_service.trg_validate(uid, 'mrp.production', context['active_id'],
+# 'button_produce_done', cr)
+ prod_obj.action_production_end(cr, uid, [context['active_id']],
+ qty=datas['product_qty'], mode=datas['mode'])
+ return {}
+
+stock_move_produce()
+
+
+class change_production_qty(osv.osv_memory):
+ _name = "change.production.qty"
+ _description = "Change Production Qty"
+
+ _columns = {
+ 'product_qty': fields.float('Quantity', required=True),
+ }
+
+ def _get_product_qty(self, cr, uid, context):
+ prod = self.pool.get('mrp.production').browse(cr, uid, context['active_id'], context=context)
+ return prod.product_qty
+
+ _defaults = {
+ 'product_qty': _get_product_qty,
+ }
+
+ def change_prod_qty(self, cr, uid, ids, context={}):
+ datas = self.read(cr, uid, ids)[0]
+ prod_obj = self.pool.get('mrp.production')
+ prod_obj._change_prod_qty(cr, uid, context['active_ids'], datas['product_qty'], context=context)
+ return {}
+
+change_production_qty()
diff --git a/addons/mrp/wizard/wizard_mrp.xml b/addons/mrp/wizard/wizard_mrp.xml
new file mode 100644
index 00000000000..7c93245a3d8
--- /dev/null
+++ b/addons/mrp/wizard/wizard_mrp.xml
@@ -0,0 +1,70 @@
+
+
+
+
+
+
+
+
+ Produce
+ stock.move.produce
+ form
+
+
+
+
+
+
+ Produce
+ ir.actions.act_window
+ stock.move.produce
+ form
+ form
+ new
+
+
+
+ Change Production Qty
+ change.production.qty
+ form
+
+
+
+
+
+
+ Change Production Qty
+ ir.actions.act_window
+ change.production.qty
+ form
+ form
+ new
+
+
+
+
+
\ No newline at end of file
diff --git a/addons/mrp/wizard/wizard_orderpoint_procurement.py b/addons/mrp/wizard/wizard_orderpoint_procurement.py
deleted file mode 100644
index a4fa57bb9a8..00000000000
--- a/addons/mrp/wizard/wizard_orderpoint_procurement.py
+++ /dev/null
@@ -1,73 +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 .
-#
-##############################################################################
-
-#
-# Order Point Method:
-# - Order if the virtual stock of today is bellow the min of the defined order point
-#
-
-import wizard
-import threading
-import pooler
-
-parameter_form = '''
-'''
-
-parameter_fields = {
- 'automatic': {'string': 'Automatic orderpoint', 'type': 'boolean', 'help': 'If the stock of a product is under 0, it will act like an orderpoint', 'default': lambda *a: False},
-}
-
-def _procure_calculation_orderpoint(self, db_name, uid, data, context):
- db, pool = pooler.get_db_and_pool(db_name)
- cr = db.cursor()
- try:
- proc_obj = pool.get('mrp.procurement')
- automatic = data['form']['automatic']
- proc_obj._procure_orderpoint_confirm(cr, uid, automatic=automatic,\
- use_new_cursor=cr.dbname, context=context)
- finally:
- cr.close()
- return {}
-
-def _procure_calculation(self, cr, uid, data, context):
- threaded_calculation = threading.Thread(target=_procure_calculation_orderpoint, args=(self, cr.dbname, uid, data, context))
- threaded_calculation.start()
- return {}
-
-class procurement_compute(wizard.interface):
- states = {
- 'init': {
- 'actions': [],
- 'result': {'type': 'form', 'arch':parameter_form, 'fields': parameter_fields, 'state':[('end','Cancel'),('compute','Compute Stock')]}
- },
- 'compute': {
- 'actions': [_procure_calculation],
- 'result': {'type': 'state', 'state':'end'}
- },
- }
-procurement_compute('mrp.procurement.orderpoint.compute')
-
-
-
-# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
-
diff --git a/addons/mrp/wizard/wizard_schedulers_all.py b/addons/mrp/wizard/wizard_schedulers_all.py
deleted file mode 100644
index e93e31c0599..00000000000
--- a/addons/mrp/wizard/wizard_schedulers_all.py
+++ /dev/null
@@ -1,64 +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 threading
-import pooler
-
-parameter_form = '''
-'''
-
-parameter_fields = {
- 'automatic': {'string': 'Automatic orderpoint', 'type': 'boolean', 'help': 'Triggers an automatic procurement for all products that have a virtual stock under 0. You should probably not use this option, we suggest using a MTO configuration on products.', 'default': lambda *a: False},
-}
-
-def _procure_calculation_all(self, db_name, uid, data, context):
- db, pool = pooler.get_db_and_pool(db_name)
- cr = db.cursor()
- proc_obj = pool.get('mrp.procurement')
- automatic = data['form']['automatic']
- proc_obj.run_scheduler(cr, uid, automatic=automatic, use_new_cursor=cr.dbname,\
- context=context)
- cr.close()
- return {}
-
-def _procure_calculation(self, cr, uid, data, context):
- threaded_calculation = threading.Thread(target=_procure_calculation_all, args=(self, cr.dbname, uid, data, context))
- threaded_calculation.start()
- return {}
-
-class procurement_compute(wizard.interface):
- states = {
- 'init': {
- 'actions': [],
- 'result': {'type': 'form', 'arch':parameter_form, 'fields': parameter_fields, 'state':[('end','Cancel'),('compute','Compute Stock') ]}
- },
- 'compute': {
- 'actions': [_procure_calculation],
- 'result': {'type': 'state', 'state':'end'}
- },
- }
-procurement_compute('mrp.procurement.compute.all')
-
-# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
-
diff --git a/addons/mrp_repair/__terp__.py b/addons/mrp_repair/__terp__.py
index 2f44e257a80..0cb90558a0c 100644
--- a/addons/mrp_repair/__terp__.py
+++ b/addons/mrp_repair/__terp__.py
@@ -39,9 +39,11 @@
'security/ir.model.access.csv',
'mrp_repair_sequence.xml',
'mrp_repair_wizard.xml',
+ 'mrp_repair_cancel_view.xml',
+ 'mrp_repair_make_invoice_view.xml',
'mrp_repair_view.xml',
'mrp_repair_workflow.xml',
- 'mrp_repair_report.xml'
+ 'mrp_repair_report.xml',
],
'demo_xml': [],
'installable': True,
diff --git a/addons/mrp_repair/mrp_repair_cancel_view.xml b/addons/mrp_repair/mrp_repair_cancel_view.xml
new file mode 100644
index 00000000000..6e900939fd6
--- /dev/null
+++ b/addons/mrp_repair/mrp_repair_cancel_view.xml
@@ -0,0 +1,45 @@
+
+
+
+
+
+
+
+ Cancel Repair
+ mrp.repair.cancel
+ form
+
+
+
+
+
+
+ Cancel Repair
+ ir.actions.act_window
+ mrp.repair.cancel
+ form
+ form
+ new
+ {'record_id' : active_id}
+
+
+
+
+
+ Cancel Repair
+
+ action
+ mrp.repair
+
+
+
+
diff --git a/addons/mrp_repair/mrp_repair_make_invoice_view.xml b/addons/mrp_repair/mrp_repair_make_invoice_view.xml
new file mode 100644
index 00000000000..6d489e5704b
--- /dev/null
+++ b/addons/mrp_repair/mrp_repair_make_invoice_view.xml
@@ -0,0 +1,46 @@
+
+
+
+
+
+
+
+ Make Invoice
+ mrp.repair.make_invoice
+ form
+
+
+
+
+
+
+ Make Invoice
+ ir.actions.act_window
+ mrp.repair.make_invoice
+ form
+ form
+ new
+ {'active_ids' : active_ids}
+
+
+
+
+ Make Invoice
+
+ client_action_multi
+ action
+ mrp.repair
+
+
+
+
diff --git a/addons/mrp_repair/mrp_repair_wizard.xml b/addons/mrp_repair/mrp_repair_wizard.xml
index 42383f517cc..b0b2c89d50d 100644
--- a/addons/mrp_repair/mrp_repair_wizard.xml
+++ b/addons/mrp_repair/mrp_repair_wizard.xml
@@ -1,21 +1,22 @@
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/addons/mrp_repair/wizard/__init__.py b/addons/mrp_repair/wizard/__init__.py
index ec3063f01de..4f3075f055c 100644
--- a/addons/mrp_repair/wizard/__init__.py
+++ b/addons/mrp_repair/wizard/__init__.py
@@ -19,7 +19,7 @@
#
##############################################################################
-import wizard_cancel_repair
-import wizard_make_invoice
+import cancel_repair
+import make_invoice
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
diff --git a/addons/mrp_repair/wizard/cancel_repair.py b/addons/mrp_repair/wizard/cancel_repair.py
new file mode 100644
index 00000000000..423be2e27b3
--- /dev/null
+++ b/addons/mrp_repair/wizard/cancel_repair.py
@@ -0,0 +1,63 @@
+# -*- 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
+from osv import osv,fields
+from tools.translate import _
+
+class repair_cancel(osv.osv_memory):
+ _name = 'mrp.repair.cancel'
+ _description = 'Cancel Repair'
+
+ def cancel_repair(self, cr, uid, ids, context):
+ record_id = context and context.get('record_id', False) or False
+ if record_id:
+ repair_obj = self.pool.get('mrp.repair').browse(cr, uid, [record_id])
+
+ if repair_obj[0].invoiced or repair_obj[0].invoice_method == 'none':
+ self.pool.get('mrp.repair').write(cr, uid, record_id, {'state':'cancel'})
+ mrp_line_obj = self.pool.get('mrp.repair.line')
+ for line in repair_obj:
+ mrp_line_obj.write(cr, uid, [l.id for l in line.operations], {'state': 'cancel'})
+ else:
+ raise osv.except_osv(_('Warning!'),_('Repair is not cancelled. It is not invoiced.'))
+
+ return {}
+
+ def fields_view_get(self, cr, uid, view_id=None, view_type='form', context=None, toolbar=False, submenu=False):
+ record_id = context and context.get('record_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)
+ if record_id:
+ repair_obj = self.pool.get('mrp.repair').browse(cr, uid, [record_id])[0]
+ if not repair_obj.invoice_id:
+ res['arch'] = """
+ """
+ return res
+
+repair_cancel()
+
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
+
diff --git a/addons/auction/wizard/auction_wizard_able_taken.py b/addons/mrp_repair/wizard/make_invoice.py
similarity index 52%
rename from addons/auction/wizard/auction_wizard_able_taken.py
rename to addons/mrp_repair/wizard/make_invoice.py
index 261cc47c48b..983ebabac25 100644
--- a/addons/auction/wizard/auction_wizard_able_taken.py
+++ b/addons/mrp_repair/wizard/make_invoice.py
@@ -19,43 +19,34 @@
#
##############################################################################
-import wizard
import netsvc
-import pooler
-take_form = """
-
-"""
+from osv import osv, fields
-take_fields = {
-# 'confirm_en': {'string':'Catalog Number', 'type':'integer'},
-}
+class make_invoice(osv.osv_memory):
+ _name = 'mrp.repair.make_invoice'
+ _description = 'Make Invoice'
+
+ _columns = {
+ 'group': fields.boolean('Group by partner invoice address'),
+ }
-def _confirm_able(self,cr,uid,data,context={}):
- res={}
- pool = pooler.get_pool(cr.dbname)
- pool.get('auction.lots').write(cr,uid,data['ids'],{'ach_emp':True})
- return {}
-
-class able_take_away(wizard.interface):
- states = {
- 'init' : {
- 'actions' : [],
- 'result' : {
- 'type' : 'form',
- 'arch' : take_form,
- 'fields' : take_fields,
- 'state' : [('end', 'Cancel'),('go', 'Able Taken away')]}
- },
- 'go' : {
- 'actions' : [_confirm_able],
- 'result' : {'type' : 'state', 'state' : 'end'}
- },
-}
-able_take_away('auction.lots.able')
+ def make_invoices(self, cr, uid, ids, context):
+ 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)
+
+ return {
+ 'domain': [('id','in', newinv.values())],
+ 'name': 'Invoices',
+ 'view_type': 'form',
+ 'view_mode': 'tree,form',
+ 'res_model': 'account.invoice',
+ 'view_id': False,
+ 'context': "{'type':'out_invoice'}",
+ 'type': 'ir.actions.act_window'
+ }
+make_invoice()
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
diff --git a/addons/mrp_repair/wizard/wizard_cancel_repair.py b/addons/mrp_repair/wizard/wizard_cancel_repair.py
deleted file mode 100644
index d895096ce6f..00000000000
--- a/addons/mrp_repair/wizard/wizard_cancel_repair.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 .
-#
-##############################################################################
-
-import wizard
-import netsvc
-import pooler
-
-cancel_form = """
-
-"""
-
-cancel_fields = {}
-
-def check_state(self, cr, uid, data, context):
- pool = pooler.get_pool(cr.dbname)
- repair_obj = pool.get('mrp.repair').browse(cr, uid, data['ids'])[0]
- if repair_obj.invoice_id:
- return 'display'
- else:
- pool.get('mrp.repair').write(cr,uid,data['ids'],{'state':'cancel'})
- return 'end'
-
-
-def _cancel_repair(self, cr, uid, data, context):
- pool = pooler.get_pool(cr.dbname)
- repair_obj = pool.get('mrp.repair').browse(cr, uid, data['ids'])
- pool.get('mrp.repair').write(cr,uid,data['ids'],{'state':'cancel'})
- mrp_line_obj = pool.get('mrp.repair.line')
- for line in repair_obj:
- mrp_line_obj.write(cr, uid, [l.id for l in line.operations], {'state': 'cancel'})
- return {}
-
-class repair_cancel(wizard.interface):
- states = {
- 'init' : {
- 'actions' : [],
- 'result' : {'type' : 'choice', 'next_state' : check_state}
- },
-
- 'display' : {
- 'actions' : [],
- 'result' : {'type' : 'form',
- 'arch' : cancel_form,
- 'fields' : cancel_fields,
- 'state' : [('end', 'No'),('yes', 'Yes') ]}
- },
- 'yes' : {
- 'actions' : [],
- 'result' : {'type' : 'action',
- 'action' : _cancel_repair,
- 'state' : 'end'}
- },
- 'end' : {
- 'actions' : [],
- 'result': {'type': 'state', 'state': 'end'},
- },
- }
-repair_cancel("mrp.repair.cancel")
-
-# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
-
diff --git a/addons/mrp_repair/wizard/wizard_make_invoice.py b/addons/mrp_repair/wizard/wizard_make_invoice.py
deleted file mode 100644
index 71aefadfe4b..00000000000
--- a/addons/mrp_repair/wizard/wizard_make_invoice.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 .
-#
-##############################################################################
-
-import wizard
-import netsvc
-import pooler
-
-invoice_form = """
-
-"""
-invoice_fields = {
- 'group': {
- 'string': 'Group by partner invoice address',
- 'type':'boolean'
- },
-}
-
-ack_form = """
-"""
-
-ack_fields = {}
-
-def _makeInvoices(self, cr, uid, data, context):
- order_obj = pooler.get_pool(cr.dbname).get('mrp.repair')
- newinv = order_obj.action_invoice_create(cr, uid, data['ids'],group=data['form']['group'],context=context)
-
- return {
- 'domain': [('id','in', newinv.values())],
- 'name': 'Invoices',
- 'view_type': 'form',
- 'view_mode': 'tree,form',
- 'res_model': 'account.invoice',
- 'view_id': False,
- 'context': "{'type':'out_refund'}",
- 'type': 'ir.actions.act_window'
- }
-
-
-class make_invoice(wizard.interface):
- states = {
- 'init' : {
- 'actions' : [],
- 'result' : {'type' : 'form',
- 'arch' : invoice_form,
- 'fields' : invoice_fields,
- 'state' : [('end', 'Cancel'),('invoice', 'Create invoices') ]}
- },
- 'invoice' : {
- 'actions' : [],
- 'result' : {'type' : 'action',
- 'action' : _makeInvoices,
- 'state' : 'end'}
- },
- }
-make_invoice("mrp.repair.make_invoice")
-
-# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
-
diff --git a/addons/product/__terp__.py b/addons/product/__terp__.py
index 4128e992c82..ef8dd5de345 100644
--- a/addons/product/__terp__.py
+++ b/addons/product/__terp__.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 .
#
##############################################################################
@@ -51,6 +51,7 @@
'security/ir.model.access.csv',
'product_data.xml',
'product_report.xml',
+ 'wizard/product_price_list_view.xml',
'product_view.xml',
'pricelist_view.xml',
'partner_view.xml',
diff --git a/addons/product/product_view.xml b/addons/product/product_view.xml
index e6c5588f4f7..6272645f907 100644
--- a/addons/product/product_view.xml
+++ b/addons/product/product_view.xml
@@ -602,6 +602,15 @@
+
+
+ Price List
+ client_print_multi
+
+ action
+ product.product
+
+
diff --git a/addons/product/wizard/__init__.py b/addons/product/wizard/__init__.py
index fed1bcf3783..7382a1fc2b1 100644
--- a/addons/product/wizard/__init__.py
+++ b/addons/product/wizard/__init__.py
@@ -18,7 +18,8 @@
# along with this program. If not, see .
#
##############################################################################
-import wizard_price
+
+import product_price_list
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
diff --git a/addons/product/wizard/product_price_list.py b/addons/product/wizard/product_price_list.py
new file mode 100644
index 00000000000..9e39b009445
--- /dev/null
+++ b/addons/product/wizard/product_price_list.py
@@ -0,0 +1,49 @@
+# -*- 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
+from service import web_services
+import time
+import wizard
+import pooler
+
+class product_price_list(osv.osv_memory):
+ _name = "product.price.list"
+ _description = "Product Price List"
+
+ _columns = {
+ 'price_list': fields.many2one('product.pricelist', 'PriceList', required=True),
+ 'qty1':fields.integer('Quantity-1'),
+ 'qty2':fields.integer('Quantity-2'),
+ 'qty3':fields.integer('Quantity-3'),
+ 'qty4':fields.integer('Quantity-4'),
+ 'qty5':fields.integer('Quantity-5'),
+}
+
+ _defaults = {
+ 'qty1': lambda *a:'0',
+ 'qty2': lambda * a:'0',
+ 'qty3': lambda *a:'0',
+ 'qty4': lambda *a:'0',
+ 'qty5': lambda *a:'0',
+ }
+product_price_list()
+
diff --git a/addons/product/wizard/product_price_list_view.xml b/addons/product/wizard/product_price_list_view.xml
new file mode 100644
index 00000000000..370e04ff32e
--- /dev/null
+++ b/addons/product/wizard/product_price_list_view.xml
@@ -0,0 +1,36 @@
+
+
+
+
+ Price list
+ product.price.list
+ form
+
+
+
+
+
+
+ Price List
+ ir.actions.act_window
+ product.price.list
+ form
+ form
+ new
+
+
+
+
+
+
diff --git a/addons/product_margin/__terp__.py b/addons/product_margin/__terp__.py
index b0e81f341a7..dc7f13d6cb8 100644
--- a/addons/product_margin/__terp__.py
+++ b/addons/product_margin/__terp__.py
@@ -31,7 +31,8 @@ the report has several options to help you get the data you need.
""",
'author': 'Tiny',
'depends': ['base', 'product', 'account'],
- 'update_xml': ['product_margin_view.xml'],
+ 'update_xml': ['wizard/product_margin_view.xml',
+ 'product_margin_view.xml'],
'demo_xml': [],
'installable': True,
'active': False,
diff --git a/addons/product_margin/product_margin_view.xml b/addons/product_margin/product_margin_view.xml
index 03dfbdf2280..eaf64179015 100644
--- a/addons/product_margin/product_margin_view.xml
+++ b/addons/product_margin/product_margin_view.xml
@@ -1,15 +1,6 @@
-
-
-
-
-
-
-
-
-
product.margin.graphproduct.product
diff --git a/addons/product_margin/wizard/__init__.py b/addons/product_margin/wizard/__init__.py
index 4e2ecc2e39a..578c1de3b78 100644
--- a/addons/product_margin/wizard/__init__.py
+++ b/addons/product_margin/wizard/__init__.py
@@ -19,7 +19,8 @@
#
##############################################################################
-import wizard_product_margin
+
+import product_margin
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
diff --git a/addons/product_margin/wizard/product_margin.py b/addons/product_margin/wizard/product_margin.py
new file mode 100644
index 00000000000..b82445bc874
--- /dev/null
+++ b/addons/product_margin/wizard/product_margin.py
@@ -0,0 +1,98 @@
+# -*- 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
+from osv import fields
+
+import netsvc
+import time
+from tools.translate import _
+class product_margin(osv.osv_memory):
+ '''
+ Product Margin
+ '''
+ _name = 'product.margin'
+ _description = 'Product Margin'
+
+ def _action_open_window(self, cr, uid, ids, context):
+ """
+ @summary:
+
+ @param cr: the current row, from the database cursor,
+ @param uid: the current user’s ID for security checks,
+ @param ids: the account ID or list of IDs if we want more than one
+
+ @return:
+ """
+ mod_obj = self.pool.get('ir.model.data')
+ result = mod_obj._get_id(cr, uid, 'product', 'product_search_form_view')
+ id = mod_obj.read(cr, uid, result, ['res_id'])
+ cr.execute('select id,name from ir_ui_view where name=%s and type=%s', ('product.margin.graph', 'graph'))
+ view_res3 = cr.fetchone()[0]
+ cr.execute('select id,name from ir_ui_view where name=%s and type=%s', ('product.margin.form.inherit', 'form'))
+ view_res2 = cr.fetchone()[0]
+ cr.execute('select id,name from ir_ui_view where name=%s and type=%s', ('product.margin.tree', 'tree'))
+ view_res = cr.fetchone()[0]
+
+ #get the current product.margin object to obtain the values from it
+ product_margin_obj = self.browse(cr,uid,ids)[0]
+
+ return {
+ 'name': _('Product Margins'),
+ 'context':{'date_from':product_margin_obj.from_date,'date_to':product_margin_obj.to_date,'invoice_state' : product_margin_obj.invoice_state},
+ 'view_type': 'form',
+ "view_mode": 'tree,form,graph',
+ 'res_model':'product.product',
+ 'type': 'ir.actions.act_window',
+ 'views': [(view_res,'tree'), (view_res2,'form'), (view_res3,'graph')],
+ 'view_id': False,
+ 'search_view_id': id['res_id']
+ }
+
+ def action_cancel(self, cr, uid, ids, context=None):
+ """
+ @summary:
+
+ @param cr: the current row, from the database cursor,
+ @param uid: the current user’s ID for security checks,
+ @param ids: the account ID or list of IDs if we want more than one
+
+ @return:
+ """
+ return {'type':'ir.actions.act_window_close'}
+
+ _columns = {
+ #TODO : import time required to get currect date
+ 'from_date': fields.datetime('From'),
+ #TODO : import time required to get currect date
+ 'to_date': fields.datetime('To'),
+ 'invoice_state':fields.selection([
+ ('paid','Paid'),
+ ('open_paid','Open and Paid'),
+ ('draft_open_paid','Draft, Open and Paid'),
+ ],'Invoice State', select=True, required=True),
+ }
+ _defaults = {
+ 'from_date': lambda *a:time.strftime('%Y-01-01'),
+ 'to_date': lambda *a:time.strftime('%Y-01-01'),
+ 'invoice_state': lambda *a:"open_paid",
+ }
+product_margin()
diff --git a/addons/product_margin/wizard/product_margin_view.xml b/addons/product_margin/wizard/product_margin_view.xml
new file mode 100644
index 00000000000..f7c292b576d
--- /dev/null
+++ b/addons/product_margin/wizard/product_margin_view.xml
@@ -0,0 +1,35 @@
+
+
+
+
+ product.margin.form
+ product.margin
+ form
+
+
+
+
+
+ Product Margine
+ ir.actions.act_window
+ new
+ product.margin
+ form
+ form
+
+
+
+
+
diff --git a/addons/product_margin/wizard/wizard_product_margin.py b/addons/product_margin/wizard/wizard_product_margin.py
deleted file mode 100644
index 625cfd4c1df..00000000000
--- a/addons/product_margin/wizard/wizard_product_margin.py
+++ /dev/null
@@ -1,93 +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
-import time
-
-from tools.translate import _
-
-def _action_open_window(self, cr, uid, data, context):
- pool = pooler.get_pool(cr.dbname)
- mod_obj = pool.get('ir.model.data')
- result = mod_obj._get_id(cr, uid, 'product', 'product_search_form_view')
- id = mod_obj.read(cr, uid, result, ['res_id'])
- cr.execute('select id,name from ir_ui_view where name=%s and type=%s', ('product.margin.graph', 'graph'))
- view_res3 = cr.fetchone()[0]
- cr.execute('select id,name from ir_ui_view where name=%s and type=%s', ('product.margin.form.inherit', 'form'))
- view_res2 = cr.fetchone()[0]
- cr.execute('select id,name from ir_ui_view where name=%s and type=%s', ('product.margin.tree', 'tree'))
- view_res = cr.fetchone()[0]
- return {
- 'name': _('Product Margins'),
- 'context':{'date_from':data['form']['from_date'],'date_to':data['form']['to_date'],'invoice_state' : data['form']['invoice_state']},
- 'view_type': 'form',
- "view_mode": 'tree,form,graph',
- 'res_model':'product.product',
- 'type': 'ir.actions.act_window',
- 'views': [(view_res,'tree'), (view_res2,'form'), (view_res3,'graph')],
- 'view_id': False,
- 'search_view_id': id['res_id']
- }
-
-
-class product_margins(wizard.interface):
- form1 = '''
- '''
- form1_fields = {
- 'from_date': {
- 'string': 'From',
- 'type': 'date',
- 'default': lambda *a:time.strftime('%Y-01-01'),
-
- },
- 'to_date': {
- 'string': 'To',
- 'type': 'date',
- 'default': lambda *a:time.strftime('%Y-12-31'),
-
- },
- 'invoice_state': {
- 'string': 'Invoice State',
- 'type': 'selection',
- 'selection': [('paid','Paid'),('open_paid','Open and Paid'),('draft_open_paid','Draft, Open and Paid'),],
- 'required': True,
- 'default': lambda *a:"open_paid",
- },
- }
-
- states = {
- 'init': {
- 'actions': [],
- 'result': {'type': 'form', 'arch':form1, 'fields':form1_fields, 'state': [('end', 'Cancel','gtk-cancel'),('open', 'Open Margins','gtk-ok')]}
- },
- 'open': {
- 'actions': [],
- 'result': {'type': 'action', 'action': _action_open_window, 'state':'end'}
- }
- }
-product_margins('product.margins')
-# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
diff --git a/addons/project_caldav/project_caldav_wizard.xml b/addons/project_caldav/project_caldav_wizard.xml
index 2bb677eea46..53c78a99bf2 100644
--- a/addons/project_caldav/project_caldav_wizard.xml
+++ b/addons/project_caldav/project_caldav_wizard.xml
@@ -1,18 +1,5 @@
-
-
-
-
-
-
-
diff --git a/addons/sale/__terp__.py b/addons/sale/__terp__.py
index 70d9f084afb..f08a548fcf7 100644
--- a/addons/sale/__terp__.py
+++ b/addons/sale/__terp__.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 .
#
##############################################################################
@@ -45,6 +45,8 @@
'depends': ['product', 'stock', 'mrp', 'process'],
'init_xml': [],
'update_xml': [
+ 'wizard/sale_make_invoice_advance.xml',
+ 'wizard/sale_line_invoice.xml',
'security/sale_security.xml',
'security/ir.model.access.csv',
'sale_workflow.xml',
diff --git a/addons/sale/sale_view.xml b/addons/sale/sale_view.xml
index b3cec7496e4..2508ae0d6df 100644
--- a/addons/sale/sale_view.xml
+++ b/addons/sale/sale_view.xml
@@ -149,7 +149,12 @@
-
+
@@ -379,8 +384,14 @@
-
-
+
+
diff --git a/addons/sale/sale_wizard.xml b/addons/sale/sale_wizard.xml
index 9df05e8e5dd..c364c419857 100644
--- a/addons/sale/sale_wizard.xml
+++ b/addons/sale/sale_wizard.xml
@@ -10,19 +10,19 @@
multi="True"
string="Make invoices"/>
-
+
+
+
+
+
+
+
-
+ menu="True"/> -->
diff --git a/addons/sale/wizard/__init__.py b/addons/sale/wizard/__init__.py
index 6141e90b83b..07c5ceea83d 100644
--- a/addons/sale/wizard/__init__.py
+++ b/addons/sale/wizard/__init__.py
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
##############################################################################
-#
+#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL ().
#
@@ -15,13 +15,12 @@
# 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 make_invoice import make_invoice
+#remaining make_invoice
+import sale_line_invoice
+import sale_make_invoice_advance
-import wizard_sale_line_invoice
-import make_invoice_advance
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
-
diff --git a/addons/sale/wizard/make_invoice_advance.py b/addons/sale/wizard/make_invoice_advance.py
deleted file mode 100644
index eaa1fc4a14b..00000000000
--- a/addons/sale/wizard/make_invoice_advance.py
+++ /dev/null
@@ -1,157 +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
-from osv import fields, osv
-from tools.translate import _
-
-form = """
-
-"""
-fields = {
- 'product_id': {'string':'Product', 'type':'many2one','relation':'product.product','required':True},
- 'amount': {'string':'Unit Price', 'type':'float', 'size':(16,2),'required':True},
- 'qtty': {'string':'Quantity', 'type':'float', 'size':(16,2),'required':True, 'default': lambda *a: 1},
-}
-
-form_msg = """
-
-"""
-fields_msg = {}
-
-def _createInvoices(self, cr, uid, data, context={}):
- list_inv = []
- pool_obj = pooler.get_pool(cr.dbname)
- obj_sale = pool_obj.get('sale.order')
- data_sale = obj_sale.browse(cr,uid,data['ids'])
- obj_lines = pool_obj.get('account.invoice.line')
- for sale in data_sale:
- address_contact = False
- address_invoice = False
- create_ids = []
- ids_inv = []
- if sale.order_policy == 'postpaid':
- raise osv.except_osv(
- _('Error'),
- _("You cannot make an advance on a sale order that is defined as 'Automatic Invoice after delivery'."))
- val = obj_lines.product_id_change(cr, uid, [], data['form']['product_id'],uom = False, partner_id = sale.partner_id.id, fposition_id=sale.fiscal_position.id)
- line_id =obj_lines.create(cr, uid, {
- 'name': val['value']['name'],
- 'account_id':val['value']['account_id'],
- 'price_unit': data['form']['amount'],
- 'quantity': data['form']['qtty'],
- 'discount': False,
- 'uos_id': val['value']['uos_id'],
- 'product_id':data['form']['product_id'],
- 'invoice_line_tax_id': [(6,0,val['value']['invoice_line_tax_id'])],
- 'account_analytic_id': sale.project_id and sale.project_id.id or False,
- 'note':'',
- })
- create_ids.append(line_id)
- inv = {
- 'name': sale.name,
- 'origin': sale.name,
- 'type': 'out_invoice',
- 'reference': False,
- 'account_id': sale.partner_id.property_account_receivable.id,
- 'partner_id': sale.partner_id.id,
- 'address_invoice_id':sale.partner_invoice_id.id,
- 'address_contact_id':sale.partner_order_id.id,
- 'invoice_line': [(6,0,create_ids)],
- 'currency_id' :sale.pricelist_id.currency_id.id,
- 'comment': '',
- 'payment_term':sale.payment_term.id,
- 'fiscal_position': sale.partner_id.property_account_position.id
- }
- inv_obj = pool_obj.get('account.invoice')
- inv_id = inv_obj.create(cr, uid, inv)
-
- for inv in sale.invoice_ids:
- ids_inv.append(inv.id)
- ids_inv.append(inv_id)
- obj_sale.write(cr,uid,sale.id,{'invoice_ids':[(6,0,ids_inv)]})
- list_inv.append(inv_id)
-#
-# If invoice on picking: add the cost on the SO
-# If not, the advance will be deduced when generating the final invoice
-#
- if sale.order_policy=='picking':
- pool_obj.get('sale.order.line').create(cr, uid, {
- 'order_id': sale.id,
- 'name': val['value']['name'],
- 'price_unit': -data['form']['amount'],
- 'product_uom_qty': data['form']['qtty'],
- 'product_uos_qty': data['form']['qtty'],
- 'product_uos': val['value']['uos_id'],
- 'product_uom': val['value']['uos_id'],
- 'product_id':data['form']['product_id'],
- 'discount': False,
- 'tax_id': [(6,0,val['value']['invoice_line_tax_id'])],
- }, context)
- return {'invoice_ids':list_inv}
-
-class sale_advance_payment(wizard.interface):
- def _open_invoice(self, cr, uid, data, context):
- pool_obj = pooler.get_pool(cr.dbname)
- mod_obj = pool_obj.get('ir.model.data')
- result = mod_obj._get_id(cr, uid, 'account', 'view_account_invoice_filter')
- id = mod_obj.read(cr, uid, result, ['res_id'])
- model_data_ids = pool_obj.get('ir.model.data').search(cr,uid,[('model','=','ir.ui.view'),('name','=','invoice_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':'out_invoice'}",
- 'type': 'ir.actions.act_window',
- 'search_view_id': id['res_id']
- }
-
- states = {
- 'init' : {
- 'actions' : [],
- 'result' : {'type' : 'form' , 'arch' : form,'fields' : fields,'state' : [('end','Cancel','gtk-cancel'),('create','Create Advance Invoice','gtk-ok')]}
- },
- 'create': {
- 'actions': [_createInvoices],
- 'result': {'type' : 'form' ,'arch' : form_msg,'fields' : fields_msg, 'state':[('end','Close','gtk-close'),('open','Open Advance Invoice','gtk-open')]}
- },
- 'open': {
- 'actions': [],
- 'result': {'type':'action', 'action':_open_invoice, 'state':'end'}
- }
- }
-
-sale_advance_payment("sale.advance_payment_inv")
-# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
-
diff --git a/addons/sale/wizard/sale_line_invoice.py b/addons/sale/wizard/sale_line_invoice.py
new file mode 100644
index 00000000000..7dd7fef78cb
--- /dev/null
+++ b/addons/sale/wizard/sale_line_invoice.py
@@ -0,0 +1,100 @@
+# -*- 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
+from service import web_services
+import wizard
+import netsvc
+import ir
+import pooler
+
+class sale_order_line_make_invoice(osv.osv_memory):
+ _name = "sale.order.line.make.invoice"
+ _description = "Sale OrderLine Make_invoice"
+ _columns = {
+ 'grouped': fields.boolean('Group the invoices'),
+ }
+ _default = {
+ 'grouped' : lambda *a: False
+ }
+
+ def makeInvoices(self, cr, uid, ids, context):
+ res = False
+ invoices = {}
+
+ #TODO: merge with sale.py/make_invoice
+ def make_invoice(order, lines):
+ a = order.partner_id.property_account_receivable.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': 'out_invoice',
+ 'reference': "P%dSO%d" % (order.partner_id.id, order.id),
+ 'account_id': a,
+ 'partner_id': order.partner_id.id,
+ 'address_invoice_id': order.partner_invoice_id.id,
+ 'address_contact_id': order.partner_invoice_id.id,
+ 'invoice_line': [(6,0,lines)],
+ 'currency_id' : order.pricelist_id.currency_id.id,
+ 'comment': order.note,
+ 'payment_term': pay_term,
+ 'fiscal_position': order.partner_id.property_account_position.id
+ }
+ inv_id = self.pool.get('account.invoice').create(cr, uid, inv)
+ return inv_id
+
+ for line in self.pool.get('sale.order.line').browse(cr,uid,context['active_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] = []
+ line_id = self.pool.get('sale.order.line').invoice_line_create(cr, uid,
+ [line.id])
+ for lid in line_id:
+ invoices[line.order_id.id].append((line, lid))
+ self.pool.get('sale.order.line').write(cr, uid, [line.id],
+ {'invoiced': True})
+ flag = True
+ data_sale = self.pool.get('sale.order').browse(cr,uid,line.order_id.id)
+ for line in data_sale.order_line:
+ if not line.invoiced:
+ flag = False
+ break
+ if flag:
+ wf_service = netsvc.LocalService('workflow')
+ wf_service.trg_validate(uid, 'sale.order', line.order_id.id, 'all_lines', cr)
+ self.pool.get('sale.order').write(cr,uid,[line.order_id.id],{'state' : 'progress'})
+
+ for result in invoices.values():
+ order = result[0][0].order_id
+ il = map(lambda x: x[1], result)
+ res = make_invoice(order, il)
+ cr.execute('INSERT INTO sale_order_invoice_rel \
+ (order_id,invoice_id) values (%s,%s)', (order.id, res))
+ return {}
+
+
+sale_order_line_make_invoice()
+
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
diff --git a/addons/sale/wizard/sale_line_invoice.xml b/addons/sale/wizard/sale_line_invoice.xml
new file mode 100644
index 00000000000..823b5a04662
--- /dev/null
+++ b/addons/sale/wizard/sale_line_invoice.xml
@@ -0,0 +1,40 @@
+
+
+
+
+ Sale OrderLine Make Invoice
+ sale.order.line.make.invoice
+ form
+
+
+
+
+
+
+ Make Invoices
+ ir.actions.act_window
+ sale.order.line.make.invoice
+ form
+ form
+ new
+ {'record_id' : active_id}
+
+
+
+
+
+ Make Invoices
+ client_action_multi
+
+ action
+ sale.order.line
+
+
+
+
\ No newline at end of file
diff --git a/addons/sale/wizard/sale_make_invoice_advance.py b/addons/sale/wizard/sale_make_invoice_advance.py
new file mode 100644
index 00000000000..9a079c4f8ec
--- /dev/null
+++ b/addons/sale/wizard/sale_make_invoice_advance.py
@@ -0,0 +1,154 @@
+##############################################################################
+#
+# 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
+from service import web_services
+from tools.translate import _
+import ir
+import netsvc
+import pooler
+import wizard
+
+
+class sale_advance_payment_inv(osv.osv_memory):
+ _name = "sale.advance.payment.inv"
+ _description = "Sale Advance Payment Invoice"
+ _columns = {
+ 'product_id': fields.many2one('product.product', 'Product', required=True),
+ 'amount': fields.float('Unit Price', size=(16, 2), required=True),
+ 'qtty': fields.float('Quantity', size=(16, 2), required=True),
+ }
+ _default = {
+ 'qtty' : lambda *a: 1
+ }
+ def createInvoices(self, cr, uid, ids, context={}):
+ list_inv = []
+ obj_sale = self.pool.get('sale.order')
+ obj_lines = self.pool.get('account.invoice.line')
+ for sale_adv_obj in self.browse(cr, uid, ids):
+ for sale in obj_sale.browse(cr, uid, context['active_ids']):
+ address_contact = False
+ address_invoice = False
+ create_ids = []
+ ids_inv = []
+ if sale.order_policy == 'postpaid':
+ raise osv.except_osv(
+ _('Error'),
+ _("You cannot make an advance on a sale order \
+ that is defined as 'Automatic Invoice after delivery'."))
+ val = obj_lines.product_id_change(cr, uid, [], sale_adv_obj.product_id.id,
+ uom = False, partner_id = sale.partner_id.id, fposition_id=sale.fiscal_position.id)
+ line_id =obj_lines.create(cr, uid, {
+ 'name': val['value']['name'],
+ 'account_id': val['value']['account_id'],
+ 'price_unit': sale_adv_obj.amount,
+ 'quantity': sale_adv_obj.qtty,
+ 'discount': False,
+ 'uos_id': val['value']['uos_id'],
+ 'product_id': sale_adv_obj.product_id.id,
+ 'invoice_line_tax_id': [(6, 0, val['value']['invoice_line_tax_id'])],
+ 'account_analytic_id': sale.project_id.id or False,
+ #'note':'',
+ })
+ create_ids.append(line_id)
+ inv = {
+ 'name': sale.name,
+ 'origin': sale.name,
+ 'type': 'out_invoice',
+ 'reference': False,
+ 'account_id': sale.partner_id.property_account_receivable.id,
+ 'partner_id': sale.partner_id.id,
+ 'address_invoice_id':sale.partner_invoice_id.id,
+ 'address_contact_id':sale.partner_order_id.id,
+ 'invoice_line': [(6, 0, create_ids)],
+ 'currency_id' :sale.pricelist_id.currency_id.id,
+ 'comment': '',
+ 'payment_term':sale.payment_term.id,
+ 'fiscal_position': sale.partner_id.property_account_position.id
+ }
+ inv_obj = self.pool.get('account.invoice')
+ inv_id = inv_obj.create(cr, uid, inv)
+
+ for inv in sale.invoice_ids:
+ ids_inv.append(inv.id)
+ ids_inv.append(inv_id)
+ obj_sale.write(cr, uid, sale.id, {'invoice_ids':[(6, 0, ids_inv)]})
+ list_inv.append(inv_id)
+ #
+ # If invoice on picking: add the cost on the SO
+ # If not, the advance will be deduced when generating the final invoice
+ #
+ if sale.order_policy=='picking':
+ self.pool.get('sale.order.line').create(cr, uid, {
+ 'order_id': sale.id,
+ 'name': val['value']['name'],
+ 'price_unit': -sale_adv_obj.amount,
+ 'product_uom_qty': sale_adv_obj.qtty,
+ 'product_uos_qty': sale_adv_obj.qtty,
+ 'product_uos': val['value']['uos_id'],
+ 'product_uom': val['value']['uos_id'],
+ 'product_id': sale_adv_obj.product_id.id,
+ 'discount': False,
+ 'tax_id': [(6, 0, val['value']['invoice_line_tax_id'])],
+ }, context)
+
+ return {#'invoice_ids':list_inv,
+ 'name': 'Open Invoice',
+ 'view_type': 'form',
+ 'view_mode': 'form',
+ 'res_model': 'sale.open.invoice',
+ 'type': 'ir.actions.act_window',
+ 'target': 'new',
+ 'context': "{'invoice_ids'=%s}" % (list_inv)
+ }
+
+sale_advance_payment_inv()
+
+class sale_open_invoice(osv.osv_memory):
+ _name = "sale.open.invoice"
+ _description = "Sale Open Invoice"
+ _columns = {
+ }
+
+ def open_invoice(self, cr, uid, ids, context):
+ mod_obj = self.pool.get('ir.model.data')
+ invoices = []
+ #TODO: Can not get invoice ids here
+ for advance_pay in self.browse(cr, uid, ids):
+ result = mod_obj._get_id(cr, uid, 'account', 'view_account_invoice_filter')
+ id = mod_obj.read(cr, uid, result, ['res_id'])
+ model_data_ids = self.pool.get('ir.model.data').search(cr, uid,
+ [('model', '=', 'ir.ui.view'), ('name', '=', 'invoice_form')])
+ resource_id = self.pool.get('ir.model.data').read(cr, uid, model_data_ids,
+ fields=['res_id'])[0]['res_id']
+ return {
+# 'domain': "[('id','in', ["+','.join(map(str, invoices))+"])]", # TODO
+ 'name': 'Invoices',
+ 'view_type': 'form',
+ 'view_mode': 'tree,form',
+ 'res_model': 'account.invoice',
+ 'views': [(False, 'tree'), (resource_id, 'form')],
+ 'context': "{'type':'out_invoice'}",
+ 'type': 'ir.actions.act_window',
+ 'search_view_id': id['res_id']
+ }
+sale_open_invoice()
+
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
diff --git a/addons/sale/wizard/sale_make_invoice_advance.xml b/addons/sale/wizard/sale_make_invoice_advance.xml
new file mode 100644
index 00000000000..eb333f42b64
--- /dev/null
+++ b/addons/sale/wizard/sale_make_invoice_advance.xml
@@ -0,0 +1,70 @@
+
+
+
+
+ Sale Advance Payment Invoive
+ sale.advance.payment.inv
+ form
+
+
+
+
+
+
+ Advance Invoice
+ ir.actions.act_window
+ sale.advance.payment.inv
+ form
+ form
+ new
+ {'record_id' : active_id}
+
+
+
+
+
+ Advance Invoice
+ client_action_multi
+
+ action
+ sale.order
+
+
+
+
+ Open Invoice
+ sale.open.invoice
+ form
+
+
+
+
+
+
+ Open Invoice
+ ir.actions.act_window
+ sale.open.invoice
+ form
+ form
+ new
+
+
+
diff --git a/addons/sale/wizard/wizard_sale_line_invoice.py b/addons/sale/wizard/wizard_sale_line_invoice.py
deleted file mode 100644
index 8e1e49ab22d..00000000000
--- a/addons/sale/wizard/wizard_sale_line_invoice.py
+++ /dev/null
@@ -1,121 +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
-
-invoice_form = """
-
-"""
-
-invoice_fields = {
- 'grouped' : {'string':'Group the invoices', 'type':'boolean', 'default': lambda *a: False}
-}
-
-def _makeInvoices(self, cr, uid, data, context):
- pool = pooler.get_pool(cr.dbname)
- res = False
- invoices = {}
-
- #TODO: merge with sale.py/make_invoice
- def make_invoice(order, lines):
- a = order.partner_id.property_account_receivable.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': 'out_invoice',
- 'reference': "P%dSO%d" % (order.partner_id.id, order.id),
- 'account_id': a,
- 'partner_id': order.partner_id.id,
- 'address_invoice_id': order.partner_invoice_id.id,
- 'address_contact_id': order.partner_invoice_id.id,
- 'invoice_line': [(6,0,lines)],
- 'currency_id' : order.pricelist_id.currency_id.id,
- 'comment': order.note,
- '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('sale.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] = []
- line_id = pool.get('sale.order.line').invoice_line_create(cr, uid,
- [line.id])
- for lid in line_id:
- invoices[line.order_id.id].append((line, lid))
- pool.get('sale.order.line').write(cr, uid, [line.id],
- {'invoiced': True})
- flag = True
- data_sale = pool.get('sale.order').browse(cr,uid,line.order_id.id)
- for line in data_sale.order_line:
- if not line.invoiced:
- flag = False
- break
- if flag:
- wf_service = netsvc.LocalService('workflow')
- wf_service.trg_validate(uid, 'sale.order', line.order_id.id, 'all_lines', cr)
- pool.get('sale.order').write(cr,uid,[line.order_id.id],{'state' : 'progress'})
-
- for result in invoices.values():
- order = result[0][0].order_id
- il = map(lambda x: x[1], result)
- res = make_invoice(order, il)
- cr.execute('INSERT INTO sale_order_invoice_rel \
- (order_id,invoice_id) values (%s,%s)', (order.id, res))
- return {}
-
-
-class line_make_invoice(wizard.interface):
- 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': 'end'}
- },
- }
-
-line_make_invoice("sale.order.line.make_invoice")
-
-# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
-
diff --git a/addons/stock/__init__.py b/addons/stock/__init__.py
index d728efbf2fe..12a218a31be 100644
--- a/addons/stock/__init__.py
+++ b/addons/stock/__init__.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 .
#
##############################################################################
@@ -26,9 +26,9 @@ import product
import report
import wizard
import report_stock
-
import stock_wizard
+
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
diff --git a/addons/stock/__terp__.py b/addons/stock/__terp__.py
index 8081c4b6738..ba5e435fcbb 100644
--- a/addons/stock/__terp__.py
+++ b/addons/stock/__terp__.py
@@ -41,11 +41,16 @@ Thanks to the double entry management, the inventory controlling is powerful and
"init_xml" : [],
"demo_xml" : ["stock_demo.xml"],
"update_xml" : [
- "stock_workflow.xml",
"stock_data.xml",
+ "wizard/stock_inventory_set_stock_zero_view.xml",
+ "wizard/stock_fill_inventory_view.xml",
+ "wizard/stock_invoice_onshipping_view.xml",
+ "wizard/stock_location_product_view.xml",
+ "wizard/stock_inventory_line_split_view.xml",
+ "stock_workflow.xml",
"stock_incoterms.xml",
"stock_wizard.xml",
- "stock_wizard_view.xml",
+ "stock_wizard_view.xml",
"stock_view.xml",
"stock_report.xml",
"stock_sequence.xml",
diff --git a/addons/stock/stock.py b/addons/stock/stock.py
index a403c141be4..3c6fdfc9ab2 100644
--- a/addons/stock/stock.py
+++ b/addons/stock/stock.py
@@ -223,7 +223,7 @@ class stock_location(osv.osv):
# Take the user company and pricetype
price_type_id=self.pool.get('res.users').browse(cr,uid,uid).company_id.property_valuation_price_type.id
pricetype=self.pool.get('product.price.type').browse(cr,uid,price_type_id)
-
+
if not product_ids:
product_ids = product_obj.search(cr, uid, [])
@@ -254,10 +254,10 @@ class stock_location(osv.osv):
continue
product = products_by_id[product_id]
quantity_total += qty[product_id]
-
+
# Compute based on pricetype
# Choose the right filed standard_price to read
- amount_unit=product.price_get(pricetype.field, context)[product.id]
+ amount_unit=product.price_get(pricetype.field, context)[product.id]
price = qty[product_id] * amount_unit
# price = qty[product_id] * product.standard_price
@@ -661,13 +661,13 @@ class stock_picking(osv.osv):
'''Return comment string for invoice'''
return picking.note or ''
- def _get_price_unit_invoice(self, cursor, user, move_line, type):
+ def _get_price_unit_invoice(self, cr, users, move_line, type):
'''Return the price unit for the move line'''
if type in ('in_invoice', 'in_refund'):
# Take the user company and pricetype
- price_type_id=self.pool.get('res.users').browse(cr,users,users).company_id.property_valuation_price_type.id
- pricetype=self.pool.get('product.price.type').browse(cr,uid,price_type_id)
- amount_unit=move_line.product_id.price_get(pricetype.field, context)[move_line.product_id.id]
+ price_type_id=self.pool.get('res.users').browse(cr, users, users).company_id.property_valuation_price_type.id
+ pricetype=self.pool.get('product.price.type').browse(cr, users, price_type_id)
+ amount_unit=move_line.product_id.price_get(pricetype.field, context={})[move_line.product_id.id]
return amount_unit
else:
return move_line.product_id.list_price
@@ -1383,12 +1383,12 @@ class stock_move(osv.osv):
# Base computation on valuation price type
else:
company_id=move.company_id.id
-
+
pricetype=self.pool.get('product.price.type').browse(cr,uid,move.company_id.property_valuation_price_type.id)
amount_unit=move.product_id.price_get(pricetype.field, context)[move.product_id.id]
amount=amount_unit * q or 1.0
# amount = q * move.product_id.standard_price
-
+
partner_id = False
if move.picking_id:
partner_id = move.picking_id.address_id and (move.picking_id.address_id.partner_id and move.picking_id.address_id.partner_id.id or False) or False
@@ -1434,7 +1434,7 @@ class stock_move(osv.osv):
raise osv.except_osv(_('UserError'),
_('You can only delete draft moves.'))
return super(stock_move, self).unlink(
- cr, uid, ids, context=context)
+ cr, uid, ids, context=context)
def _create_lot(self, cr, uid, ids, product_id, prefix=False):
prodlot_obj = self.pool.get('stock.production.lot')
@@ -1442,23 +1442,31 @@ class stock_move(osv.osv):
sequence = ir_sequence_obj.get(cr, uid, 'stock.lot.serial')
if not sequence:
raise wizard.except_wizard(_('Error!'), _('No production sequence defined'))
+ new_move = []
+
+ def _create_lot(move_id, product_id):
+ prodlot_id = prodlot_obj.create(cr, uid, {'name': sequence, 'prefix': prefix}, {'product_id': product_id})
+ prodlot = prodlot_obj.browse(cr, uid, prodlot_id)
+ ref = '%d' % (move_id)
+ if prodlot.ref:
+ ref = '%s, %s' % (prodlot.ref, ref)
+ prodlot_obj.write(cr, uid, [prodlot_id], {'ref': ref})
+ return prodlot_id
prodlot_id = prodlot_obj.create(cr, uid, {'name': sequence, 'prefix': prefix}, {'product_id': product_id})
- prodlot = prodlot_obj.browse(cr, uid, prodlot_id)
+ prodlot = prodlot_obj.browse(cr, uid, prodlot_id)
ref = ','.join(map(lambda x:str(x),ids))
if prodlot.ref:
- ref = '%s, %s' % (prodlot.ref, ref)
+ ref = '%s, %s' % (prodlot.ref, ref)
prodlot_obj.write(cr, uid, [prodlot_id], {'ref': ref})
return prodlot_id
def split_lines(self, cr, uid, ids, quantity, split_by_qty=1, prefix=False, with_lot=True, context=None):
-
if quantity <= 0:
raise osv.except_osv(_('Warning!'), _('Please provide Proper Quantity !'))
res = []
-
- for move in self.browse(cr, uid, ids):
+ for move in self.browse(cr, uid, ids):
if split_by_qty <= 0 or quantity == 0:
return res
@@ -1470,8 +1478,18 @@ class stock_move(osv.osv):
update_val = {
'product_qty': split_by_qty,
'product_uos_qty': uos_qty,
- }
- for idx in range(int(quantity//split_by_qty)):
+ }
+
+ for idx in range(int(quantity//split_by_qty)):
+ if idx:
+ current_move = self.copy(cr, uid, move.id, {'state': move.state})
+ new_move.append(current_move)
+ else:
+ update_val = {
+ 'product_qty': split_by_qty,
+ 'product_uos_qty': uos_qty,
+ }
+ for idx in range(int(quantity//split_by_qty)):
if not idx and move.product_qty<=quantity:
current_move = move.id
else:
@@ -1481,94 +1499,154 @@ class stock_move(osv.osv):
update_val['prodlot_id'] = self._create_lot(cr, uid, [current_move], move.product_id.id)
self.write(cr, uid, [current_move], update_val)
-
-
- if quantity_rest > 0:
- idx = int(quantity//split_by_qty)
+ if quantity_rest > 0:
+ idx = int(quantity//split_by_qty)
+
+ if quantity_rest > 0:
+ idx = int(quantity//split_by_qty)
update_val['product_qty'] = quantity_rest
- update_val['product_uos_qty'] = uos_qty_rest
- if not idx and move.product_qty<=quantity:
- current_move = move.id
+ update_val['product_uos_qty'] = uos_qty_rest
+ if idx:
+ current_move = self.copy(cr, uid, move.id, {'state': move.state})
+ new_move.append(current_move)
+ update_val['product_uos_qty'] = uos_qty_rest
+ if not idx and move.product_qty<=quantity:
+ current_move = move.id
else:
- current_move = self.copy(cr, uid, move.id, {'state': move.state})
-
+ current_move = move.id
+ update_val['prodlot_id'] = _create_lot(current_move, move.product_id.id)
+ current_move = self.copy(cr, uid, move.id, {'state': move.state})
+
res.append(current_move)
-
-
- if with_lot:
+
+
+ if with_lot:
update_val['prodlot_id'] = self._create_lot(cr, uid, [current_move], move.product_id.id)
self.write(cr, uid, [current_move], update_val)
- return res
+ return res
- def consume_moves(self, cr, uid, ids, quantity, location_id=False, location_dest_id=False, consume=True, context=None):
+ def consume_moves(self, cr, uid, ids, quantity, location_id=False, location_dest_id=False, consume=True, context=None):
if not context:
context = {}
-
+ context = {}
+
if quantity <= 0:
raise osv.except_osv(_('Warning!'), _('Please provide Proper Quantity !'))
- res = []
- for move in self.browse(cr, uid, ids, context=context):
+ for move in self.browse(cr, uid, ids, context=context):
+
+ res = []
+ for move in self.browse(cr, uid, ids, context=context):
move_qty = move.product_qty
quantity_rest = move.product_qty
- quantity_rest -= quantity
+ quantity_rest -= quantity
uos_qty_rest = quantity_rest / move_qty * move.product_uos_qty
if quantity_rest <= 0:
- quantity_rest = 0
+ quantity_rest = quantity
+ break
+
+ default_val = {
+ 'product_qty': quantity,
+ 'product_uos_qty': uos_qty,
+ 'location_id': location_id or move.location_id.id,
+ }
+ if move.product_id.track_production:
+ new_move = self.split_lines(cr, uid, [move.id], quantity, split_by_qty=1, context=context)
+ else:
+ current_move = self.copy(cr, uid, move.id, default_val)
+ new_move.append(current_move)
+
+ update_val = {}
+ if quantity_rest > 0:
+ quantity_rest = 0
uos_qty_rest = 0
quantity = move.product_qty
-
+
uos_qty = quantity / move_qty * move.product_uos_qty
- if quantity_rest > 0:
+ if quantity_rest > 0:
default_val = {
- 'product_qty': quantity,
- 'product_uos_qty': uos_qty,
- 'state': move.state,
+ 'product_qty': quantity,
+ 'product_uos_qty': uos_qty,
+ 'state': move.state,
}
if location_dest_id:
- default_val.update({'location_dest_id': location_dest_id})
+ default_val.update({'location_dest_id': location_dest_id})
if location_id:
- default_val.update({'location_id': location_id})
-
+ default_val.update({'location_id': location_id})
+
if move.product_id.track_production and location_id:
res += self.split_lines(cr, uid, [move.id], quantity, split_by_qty=1, context=context)
else:
current_move = self.copy(cr, uid, move.id, default_val)
res += [current_move]
- update_val = {}
+ update_val = {}
update_val['product_qty'] = quantity_rest
- update_val['product_uos_qty'] = uos_qty_rest
- self.write(cr, uid, [move.id], update_val)
+ update_val['product_uos_qty'] = uos_qty_rest
+ self.write(cr, uid, [move.id], update_val)
- else:
- quantity_rest = quantity
+ self.action_done(cr, uid, new_move)
+ return new_move
+ update_val['product_uos_qty'] = uos_qty_rest
+ self.write(cr, uid, [move.id], update_val)
+
+ else:
+ quantity_rest = quantity
uos_qty_rest = uos_qty
-
+
if move.product_id.track_production and location_id:
res += self.split_lines(cr, uid, [move.id], quantity_rest, split_by_qty=1, context=context)
- else:
- res += [move.id]
- update_val = {}
+ else:
+ res += [move.id]
+ update_val = {}
update_val['product_qty'] = quantity_rest
update_val['product_uos_qty'] = uos_qty_rest
if location_dest_id:
- update_val.update({'location_dest_id': location_dest_id})
+ update_val.update({'location_dest_id': location_dest_id})
if location_id:
- update_val.update({'location_id': location_id})
+ update_val.update({'location_id': location_id})
self.write(cr, uid, [move.id], update_val)
if consume:
- self.action_done(cr, uid, res)
+ self.action_done(cr, uid, res)
return res
def scrap_moves(self, cr, uid, ids, quantity, location_dest_id, context=None):
- return self.consume_moves(cr, uid, ids, quantity, location_id=False, location_dest_id=location_dest_id, consume=False, context=context)
+ new_move = []
+ if quantity <= 0:
+ raise osv.except_osv(_('Warning!'), _('Please provide Proper Quantity !'))
+ for move in self.browse(cr, uid, ids, context=context):
+ location = move.location_dest_id.id
+ move_qty = move.product_qty
+ quantity_rest = move.product_qty
+
+ quantity_rest -= quantity
+ uos_qty = quantity / move_qty * move.product_uos_qty
+ uos_qty_rest = quantity_rest / move_qty * move.product_uos_qty
+ if quantity_rest <= 0:
+ quantity_rest = quantity
+ break
+
+ default_val = {
+ 'product_qty': quantity,
+ 'product_uos_qty': uos_qty,
+ 'location_dest_id': location_dest_id,
+ 'state': move.state
+ }
+ current_move = self.copy(cr, uid, move.id, default_val)
+ new_move.append(current_move)
+ update_val = {}
+ if quantity_rest > 0:
+ update_val['product_qty'] = quantity_rest
+ update_val['product_uos_qty'] = uos_qty_rest
+ self.write(cr, uid, [move.id], update_val)
+ return new_move
+ return self.consume_moves(cr, uid, ids, quantity, location_id=False, location_dest_id=location_dest_id, consume=False, context=context)
stock_move()
@@ -1599,7 +1677,7 @@ class stock_inventory(osv.osv):
move_line = []
for line in inv.inventory_line_id:
pid = line.product_id.id
-
+
# price = line.product_id.standard_price or 0.0
amount = self.pool.get('stock.location')._product_get(cr, uid, line.location_id.id, [pid], {'uom': line.product_uom.id})[pid]
change = line.product_qty - amount
diff --git a/addons/stock/stock_view.xml b/addons/stock/stock_view.xml
index 3cada5cbb6d..c112ab44d5e 100644
--- a/addons/stock/stock_view.xml
+++ b/addons/stock/stock_view.xml
@@ -33,7 +33,12 @@
-
+
+
@@ -50,6 +55,7 @@
+
@@ -64,6 +70,7 @@
+
stock.inventory.form
@@ -89,11 +96,12 @@
+
-
-
-
-
+
+
@@ -106,6 +114,7 @@
+
@@ -138,6 +147,9 @@
+
+
+
@@ -524,7 +536,7 @@
new{'action_id': active_id}
-
+
stock.picking.calendar
@@ -585,7 +597,7 @@
-
+
+
@@ -726,6 +741,7 @@
+
@@ -740,7 +756,7 @@
-
+
+
@@ -890,9 +909,6 @@
-
@@ -925,7 +941,7 @@
-
+
-
+ states="done,cancel" />
+
@@ -137,6 +142,14 @@
+
+
@@ -234,7 +247,7 @@
res_model="wiki.wiki"
src_model="wiki.groups"/>
- ).
#
@@ -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 open_page
-import open_help
-import create_menu
-import show_diff
-import make_index
+import wiki_wiki_page_open
+import wiki_create_menu
+import wiki_wiki_help_open
+import wiki_make_index
+
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
diff --git a/addons/wiki/wizard/create_menu.py b/addons/wiki/wizard/create_menu.py
deleted file mode 100644
index e31a9daa664..00000000000
--- a/addons/wiki/wizard/create_menu.py
+++ /dev/null
@@ -1,79 +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 osv
-import pooler
-
-section_form = '''
-
-
-
-
-
-
'''
-
-section_fields = {
- 'menu_name': {'string':'Menu Name', 'type':'char', 'required':True, 'size':64},
- 'menu_parent_id': {'string':'Parent Menu', 'type':'many2one', 'relation':'ir.ui.menu', 'required':True},
- 'page': {'string':'Group Home Page', 'type':'many2one', 'relation':'wiki.wiki'},
-}
-
-def wiki_menu_create(self, cr, uid, data, context):
- pool = pooler.get_pool(cr.dbname)
- group = pool.get('wiki.groups').browse(cr, uid, data['id'])
- action_id = pool.get('ir.actions.wizard').search(cr, uid, [('wiz_name','=','wiki.wiki.page.open')])
-
- menu_id = pool.get('ir.ui.menu').create(cr, uid, {
- 'name': data['form']['menu_name'],
- 'parent_id': data['form']['menu_parent_id'],
- 'icon': 'STOCK_DIALOG_QUESTION',
- 'action': 'ir.actions.wizard,'+str(action_id[0])
- }, context)
-
- home = data['form']['page']
- group_id = data['id']
- res = {
- 'home':home,
- }
- pool.get('wiki.groups').write(cr, uid, [data['id']], res)
- pool.get('wiki.groups.link').create(cr, uid, {'group_id':group_id, 'action_id':menu_id})
-
- return {}
-
-class wizard_create_menu(wizard.interface):
- states = {
- 'init': {
- 'actions': [],
- 'result': {'type':'form', 'arch':section_form, 'fields':section_fields, 'state':[('end','Cancel'),('create_menu','Create Menu')]}
- },
- 'create_menu': {
- 'actions': [wiki_menu_create],
- 'result': {
- 'type':'state',
- 'state':'end'
- }
- }
- }
-wizard_create_menu('wiki.create.menu')
-
-# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
diff --git a/addons/wiki/wizard/make_index.py b/addons/wiki/wizard/make_index.py
deleted file mode 100644
index 09a3b5de4ac..00000000000
--- a/addons/wiki/wizard/make_index.py
+++ /dev/null
@@ -1,98 +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 osv
-import pooler
-
-section_form = '''
-
-
-
-
'''
-
-def wiki_do_index(self, cr, uid, data, context):
- ids = data['ids']
- pool = pooler.get_pool(cr.dbname)
- wiki_pool = pool.get('wiki.wiki')
- cr.execute("Select id, section from wiki_wiki where id = ANY(%s) order by section " ,(ids,))
- lst0 = cr.fetchall()
- lst = []
- ids = {}
- for l in lst0:
- ids[l[1]] = l[0]
- lst.append(l[1])
-
- lst.sort()
- val = None
- def toint(x):
- try:
- return int(x)
- except:
- return 1
-
- lst = map(lambda x: map(toint, x.split('.')), lst)
-
- result = []
- current = ['0']
- current2 = []
-
- for l in lst:
- for pos in range(len(l)):
- if pos >= len(current):
- current.append('1')
- continue
- if (pos == len(l) - 1) or (pos >= len(current2)) or (toint(l[pos]) > toint(current2[pos])):
- current[pos] = str(toint(current[pos]) + 1)
- current = current[:pos + 1]
- if pos == len(l) - 1:
- break
-
- key = ('.'.join([str(x) for x in l]))
- id = ids[key]
- val = ('.'.join([str(x) for x in current[:]]), id)
-
- if val:
- result.append(val)
- current2 = l
-
- for rs in result:
- wiki_pool.write(cr, uid, [rs[1]], {'section':rs[0]})
- return {}
-
-class make_index(wizard.interface):
- states = {
- 'init': {
- 'actions': [],
- 'result': {'type':'form', 'arch':section_form, 'fields':{}, 'state':[('end','Cancel'),('yes','Create Index')]}
- },
- 'yes': {
- 'actions': [wiki_do_index],
- 'result': {
- 'type':'state',
- 'state':'end'
- }
- }
- }
-make_index('wiki.make.index')
-
-# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
diff --git a/addons/wiki/wizard/wiki_create_menu.py b/addons/wiki/wizard/wiki_create_menu.py
new file mode 100644
index 00000000000..352e9e78a4c
--- /dev/null
+++ b/addons/wiki/wizard/wiki_create_menu.py
@@ -0,0 +1,65 @@
+# -*- 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
+from osv import fields, osv
+from service import web_services
+import pooler
+import time
+import wizard
+
+class wiki_create_menu(osv.osv_memory):
+ _name = "wiki.create.menu"
+ _description = "Wizard Create Menu"
+ _columns = {
+ 'menu_name': fields.char('Menu Name', size=256, select=True, required=True),
+ 'menu_parent_id': fields.many2one('ir.ui.menu', 'Parent Menu', required=True),
+ 'page': fields.many2one('wiki.wiki', 'Group Home Page'),
+ }
+
+ def wiki_menu_create(self, cr, uid, ids, context):
+ """ Create Menu On the base of Group id and Action id """
+
+ for group in self.pool.get('wiki.groups').browse(cr, uid, ids):
+ for menu in self.pool.get('wiki.create.menu').browse(cr, uid, ids):
+
+ mod_obj = self.pool.get('ir.model.data')
+ action_id = mod_obj._get_id(cr, uid, 'wiki', 'action_view_wiki_wiki_page_open')
+ menu_id = self.pool.get('ir.ui.menu').create(cr, uid, {
+ 'name':menu.menu_name,
+ 'parent_id':menu.menu_parent_id.id,
+ 'icon': 'STOCK_DIALOG_QUESTION',
+ 'action': 'ir.actions.act_window,'+ str(action_id)
+ }, context)
+ home = menu.page.id
+ group_id = menu.id
+ res = {
+ 'home':home,
+ }
+ self.pool.get('wiki.groups').write(cr, uid, ids, res)
+ self.pool.get('wiki.groups.link').create(cr, uid,
+ {'group_id': group_id, 'action_id':menu_id})
+
+ return {}
+
+wiki_create_menu()
+
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
\ No newline at end of file
diff --git a/addons/wiki/wizard/wiki_create_menu_view.xml b/addons/wiki/wizard/wiki_create_menu_view.xml
new file mode 100644
index 00000000000..7acd1e2a70d
--- /dev/null
+++ b/addons/wiki/wizard/wiki_create_menu_view.xml
@@ -0,0 +1,32 @@
+
+
+
+
+ Create Menu
+ wiki.create.menu
+ form
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Create Menu
+ ir.actions.act_window
+ wiki.create.menu
+ form
+ form
+ new
+
+
+
+
\ No newline at end of file
diff --git a/addons/wiki/wizard/wiki_make_index.py b/addons/wiki/wizard/wiki_make_index.py
new file mode 100644
index 00000000000..56980c5288e
--- /dev/null
+++ b/addons/wiki/wizard/wiki_make_index.py
@@ -0,0 +1,86 @@
+# -*- 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
+from service import web_services
+import time
+import wizard
+import pooler
+
+class wiki_make_index(osv.osv_memory):
+ _name = "wiki.make.index"
+ _description = "Create Index"
+ _columns = {
+ }
+
+ def wiki_do_index(self, cr, uid, ids, context):
+ """ Makes Index according to page hierarchy"""
+ for index_obj in self.browse(cr,uid,ids):
+ wiki_pool = self.pool.get('wiki.wiki')
+ cr.execute("Select id, section from wiki_wiki where id = ANY(%s) \
+ order by section " ,(context['active_ids'],))
+ lst0 = cr.fetchall()
+ lst = []
+ s_ids = {}
+ for l in lst0:
+ s_ids[l[1]] = l[0]
+ lst.append(l[1])
+
+ lst.sort()
+ val = None
+ def toint(x):
+ try:
+ return int(x)
+ except:
+ return 1
+
+ lst = map(lambda x: map(toint, x.split('.')), lst)
+
+ result = []
+ current = ['0']
+ current2 = []
+
+ for l in lst:
+ for pos in range(len(l)):
+ if pos >= len(current):
+ current.append('1')
+ continue
+ if (pos == len(l) - 1) or (pos >= len(current2)) or (toint(l[pos]) > toint(current2[pos])):
+ current[pos] = str(toint(current[pos]) + 1)
+ current = current[:pos + 1]
+ if pos == len(l) - 1:
+ break
+
+ key = ('.'.join([str(x) for x in l]))
+ id = s_ids[key]
+ val = ('.'.join([str(x) for x in current[:]]), id)
+
+ if val:
+ result.append(val)
+ current2 = l
+
+ for rs in result:
+ wiki_pool.write(cr, uid, [rs[1]], {'section':rs[0]})
+ return {}
+
+wiki_make_index()
+
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
diff --git a/addons/wiki/wizard/wiki_make_index_view.xml b/addons/wiki/wizard/wiki_make_index_view.xml
new file mode 100644
index 00000000000..fcba8909f5f
--- /dev/null
+++ b/addons/wiki/wizard/wiki_make_index_view.xml
@@ -0,0 +1,30 @@
+
+
+
+
+ Create Index
+ wiki.make.index
+ form
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Create Index
+ ir.actions.act_window
+ wiki.make.index
+ form
+ form
+ new
+
+
+
+
\ No newline at end of file
diff --git a/addons/wiki/wizard/open_help.py b/addons/wiki/wizard/wiki_wiki_help_open.py
similarity index 68%
rename from addons/wiki/wizard/open_help.py
rename to addons/wiki/wizard/wiki_wiki_help_open.py
index 6be88349a81..933aa54f7cd 100644
--- a/addons/wiki/wizard/open_help.py
+++ b/addons/wiki/wizard/wiki_wiki_help_open.py
@@ -1,7 +1,7 @@
# -*- coding: utf-8 -*-
##############################################################################
#
-# OpenERP, Open Source Management Solution
+# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (). All Rights Reserved
# $Id$
#
@@ -20,22 +20,22 @@
#
##############################################################################
-
-import wizard
-import netsvc
+from osv import fields, osv
+from service import web_services
import time
+import wizard
import pooler
-from osv import osv
-from tools.translate import _
-class wiz_open_help(wizard.interface):
-
- def _open_wiki_page(self, cr, uid, data, context):
- pool = pooler.get_pool(cr.dbname)
- pages = pool.get('wiki.wiki').search(cr, uid, [('name','=','Basic Wiki Editing')])
-
+class wiki_wiki_help_open(osv.osv_memory):
+ _name = "wiki.wiki.help.open"
+ _description = "Basic Wiki Editing"
+ _columns = {
+ }
+ def _open_wiki_page(self, cr, uid, ids, context):
+ """ Opens Wiki Page for Editing"""
+ pages = self.pool.get('wiki.wiki').search(cr, uid, [('name','=','Basic Wiki Editing')])
+
value = {
- 'name': 'Basic Wiki Editing',
'view_type': 'form',
'view_mode': 'form,tree',
'res_model': 'wiki.wiki',
@@ -43,16 +43,10 @@ class wiz_open_help(wizard.interface):
'res_id': pages[0],
'type': 'ir.actions.act_window',
}
-
+
return value
- states = {
- 'init' : {
- 'actions' : [],
- 'result' : {'type':'action', 'action':_open_wiki_page, 'state':'end'}
- }
- }
-wiz_open_help('wiki.wiki.help.open')
+wiki_wiki_help_open()
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
diff --git a/addons/wiki/wizard/wiki_wiki_help_open_view.xml b/addons/wiki/wizard/wiki_wiki_help_open_view.xml
new file mode 100644
index 00000000000..2f525443900
--- /dev/null
+++ b/addons/wiki/wizard/wiki_wiki_help_open_view.xml
@@ -0,0 +1,26 @@
+
+
+
+
+ Basic Wiki Editing
+ wiki.wiki.help.open
+ form
+
+
+
+
+
+
+
+
+
+
+ Basic Wiki Editing
+ ir.actions.act_window
+ wiki.wiki.help.open
+ form
+ form
+ new
+
+
+
\ No newline at end of file
diff --git a/addons/wiki/wizard/open_page.py b/addons/wiki/wizard/wiki_wiki_page_open.py
similarity index 62%
rename from addons/wiki/wizard/open_page.py
rename to addons/wiki/wizard/wiki_wiki_page_open.py
index df015f5c5a0..4102e6486dd 100644
--- a/addons/wiki/wizard/open_page.py
+++ b/addons/wiki/wizard/wiki_wiki_page_open.py
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
##############################################################################
-#
+#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL ().
#
@@ -15,33 +15,36 @@
# 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 wizard
-import netsvc
+from osv import fields, osv
+from service import web_services
import time
+import wizard
import pooler
-from osv import osv
-from tools.translate import _
-class wiz_open_page(wizard.interface):
-
- def _open_wiki_page(self, cr, uid, data, context):
- pool = pooler.get_pool(cr.dbname)
- group = pool.get('wiki.groups').browse(cr, uid, data['id'])
-
- value = {
- 'context': "{'group_id':%d, 'section':%s}" % (group.id, group.section),
- 'domain': "[('group_id','=',%d)]" % (group.id),
- 'name': 'Wiki Page',
- 'view_type': 'form',
- 'view_mode': 'form,tree',
- 'res_model': 'wiki.wiki',
- 'view_id': False,
- 'type': 'ir.actions.act_window',
+class wiki_wiki_page_open(osv.osv_memory):
+ _name = "wiki.wiki.page.open"
+ _description = "wiz open page"
+ _columns = {
+
+ }
+ def _open_wiki_page(self, cr, uid, ids, context):
+ """ Opens Wiki Page of Group"""
+ for group in self.pool.get('wiki.groups').browse(cr, uid,ids):
+
+ for openpage in self.pool.get('wiki.wiki.page.open').browse(cr, uid,ids):
+
+ value = {
+ 'domain': "[('group_id','=',%d)]" % (group.id),
+ 'name': 'Wiki Page',
+ 'view_type': 'form',
+ 'view_mode': 'form,tree',
+ 'res_model': 'wiki.wiki',
+ 'view_id': False,
+ 'type': 'ir.actions.act_window',
}
if group.method == 'page':
value['res_id'] = group.home.id
@@ -52,17 +55,10 @@ class wiz_open_page(wizard.interface):
view_id = pool.get('ir.ui.view').search(cr, uid, [('name','=','wiki.wiki.tree.childs')])
value['view_id'] = view_id
value['domain'] = [('group_id','=',group.id),('parent_id','=',False)]
- value['view_type'] = 'tree'
+ value['view_type'] = 'tree'
return value
- states = {
- 'init' : {
- 'actions' : [],
- 'result' : {'type':'action', 'action':_open_wiki_page, 'state':'end'}
- }
- }
-wiz_open_page('wiki.wiki.page.open')
-
+wiki_wiki_page_open()
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
diff --git a/addons/wiki/wizard/wiki_wiki_page_open_view.xml b/addons/wiki/wizard/wiki_wiki_page_open_view.xml
new file mode 100644
index 00000000000..7e21f868d6e
--- /dev/null
+++ b/addons/wiki/wizard/wiki_wiki_page_open_view.xml
@@ -0,0 +1,26 @@
+
+
+
+
+ Open Page
+ wiki.wiki.page.open
+ form
+
+
+
+
+
+
+
+
+
+
+ Open Page
+ ir.actions.act_window
+ wiki.wiki.page.open
+ form
+ form
+ new
+
+
+
diff --git a/addons/wiki/wizard/wizard_view.xml b/addons/wiki/wizard/wizard_view.xml
index cbc5f020731..ce639714daf 100644
--- a/addons/wiki/wizard/wizard_view.xml
+++ b/addons/wiki/wizard/wizard_view.xml
@@ -13,18 +13,18 @@
-
+ model="wiki.wiki"/>
).
+#
+# 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 service import web_services
+import time
+import wizard
+import pooler
+
+
+class wizard_create_menu(osv.osv_memory):
+ _name = "wiki.wizard.create.menu"
+ _description="Wiki.Wizard Create Menu"
+ _columns={
+ 'menu_name':fields.char('Menu Name', size=256, select=True, required=True),
+ 'menu_parent_id': fields.many2one('ir.ui.menu', 'Parent Menu', required=True),
+ 'page': fields.many2one('wiki.wiki', 'Group Home Page'),
+ }
+
+ def wiki_menu_create(self, cr, uid, ids, context):
+ group = self.pool.get('wiki.groups').browse(cr, uid, ids)[0]
+ menu = self.pool.get('wiki.wizard.create.menu').browse(cr, uid, ids)[0]
+ action_id = self.pool.get('').search(cr, uid, [('wiz_name', '=', 'wiki.wiki.page.open')])
+
+ menu_id = self.pool.get('ir.ui.menu').create(cr, uid, {
+ 'name':menu.menu_name,
+ 'parent_id':menu.menu_parent_id.id,
+ 'icon': 'STOCK_DIALOG_QUESTION',
+ 'action': 'ir.actions.wizard,'+str(action_id[0])
+ }, context)
+
+ home = menu.page.id
+ group_id = menu.id
+ res = {
+ 'home':home,
+ }
+ self.pool.get('wiki.groups').write(cr, uid, ids, res)
+ self.pool.get('wiki.groups.link').create(cr, uid, {'group_id':group_id, 'action_id':menu_id})
+
+ return {}
+
+
+wizard_create_menu()
+
+class wiz_open_help(osv.osv_memory):
+ _name = "wiki.wiz.open.help"
+ _description="Wiki Open Help"
+ _columns={
+ 'name':fields.char('Basic Wiki Editing', size=256, select=True, required=False),
+
+ }
+ def _open_wiki_page(self, cr, uid, ids, context):
+ pages = self.pool.get('wiki.wiki').search(cr, uid, [('name', '=', 'Basic Wiki Editing')])
+
+ value = {
+ 'view_id': False,
+ 'res_id': pages[0],
+ }
+
+ return value
+
+wiz_open_help()
+
+class wiz_open_page(osv.osv_memory):
+ _name = "wiki.wiz.open.page"
+ _description="wiz open page"
+ _columns={
+ 'name':fields.char('Wiki Page', size=256, select=True, required=False),
+
+ }
+ def _open_wiki_page(self, cr, uid, ids, context):
+ group = self.pool.get('wiki.groups').browse(cr, uid, ids)[0]
+ openpage = self.pool.get('wiki.wiz.open.page').browse(cr, uid, ids)[0]
+
+ value = {
+ 'context': "{'group_id':%d, 'section':%s}" % (group.id, group.section),
+ 'domain': "[('group_id','=',%d)]" % (group.id),
+ 'type': 'ir.actions.act_window',
+ }
+ if group.method == 'page':
+ value['res_id'] = group.home.id
+ elif group.method == 'list':
+ value['view_type'] = 'form'
+ value['view_mode'] = 'tree,form'
+ elif group.method == 'tree':
+ view_id = pool.get('ir.ui.view').search(cr, uid, [('name', '=', 'wiki.wiki.tree.childs')])
+ value['view_id'] = view_id
+ value['domain'] = [('group_id', '=', group.id), ('parent_id', '=', False)]
+ value['view_type'] = 'tree'
+
+ return value
+wiz_open_page()
+
+class showdiff(osv.osv_memory):
+ _name = 'wizard.wiki.history.show_diff'
+
+ def _get_diff(self, cr, uid, ctx):
+ history = self.pool.get('wiki.wiki.history')
+ ids = ctx.get('active_ids')
+ diff = ""
+ if len(ids) == 2:
+ if ids[0] > ids[1]:
+ diff = history.getDiff(cr, uid, ids[1], ids[0])
+ else:
+ diff = history.getDiff(cr, uid, ids[0], ids[1])
+
+ elif len(ids) == 1:
+ old = history.browse(cr, uid, ids[0])
+ nids = history.search(cr, uid, [('wiki_id', '=', old.wiki_id.id)])
+ nids.sort()
+ diff = history.getDiff(cr, uid, ids[0], nids[-1])
+ else:
+ raise osv.except_osv(_('Warning'), _('You need to select minimum 1 or maximum 2 history revision!'))
+ return diff
+
+ _columns = {
+ 'diff': fields.text('Diff'),
+ }
+ _defaults = {
+ 'diff': _get_diff
+ }
+
+showdiff()
+
diff --git a/addons/wiki/wizard/wizard_wiki.xml b/addons/wiki/wizard/wizard_wiki.xml
new file mode 100644
index 00000000000..8125836d8bf
--- /dev/null
+++ b/addons/wiki/wizard/wizard_wiki.xml
@@ -0,0 +1,105 @@
+
+
+
+
+
+
+
+ Create Menu
+ wiki.wizard.create.menu
+ form
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Create Menu
+ ir.actions.act_window
+ wiki.wizard.create.menu
+ form
+ form
+ new
+
+
+
+
+
+ Open Help
+ wiki.wiz.open.help
+ form
+
+
+
+
+
+
+
+
+
+
+ Open Help
+ ir.actions.act_window
+ wiki.wiki
+ form
+ form,tree
+ new
+
+
+
+
+ Open Page
+ wiki.wiz.open.page
+ form
+
+
+
+
+
+
+
+
+
+
+ Open Page
+ ir.actions.act_window
+ wiki.wiki
+ form
+ form,tree
+ new
+
+
+
+
+ Differences
+ wizard.wiki.history.show_diff
+ form
+
+