[MERGE]: Merge with lp:~openerp-dev/openobject-addons/trunk-dev-addons2
bzr revid: rpa@tinyerp.com-20100317132726-li1bad11xetkv1wh
This commit is contained in:
@@ -42,18 +42,9 @@
|
||||
'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',
|
||||
|
||||
@@ -191,18 +191,14 @@
|
||||
<field name="amount_total"/>
|
||||
<field name="state" select="2"/>
|
||||
<field name="residual"/>
|
||||
<group col="7" colspan="4">
|
||||
<group col="3" colspan="4">
|
||||
<button name="invoice_open" states="draft,proforma2" string="Validate" icon="gtk-apply"/>
|
||||
<button name="invoice_cancel" states="draft,proforma2,sale,open" string="Cancel" icon="gtk-cancel"/>
|
||||
<button name="action_cancel_draft" states="cancel" string="Set to Draft" type="object" icon="gtk-convert"/>
|
||||
<button name='%(wizard_paid_open)d' type='action' string='Re-Open' states='paid' icon="gtk-convert"/>
|
||||
<!-- Wizard Buttons: To Remove -->
|
||||
<button name="%(wizard_invoice_pay)d" type="action" string="Pay Invoice" states="open,paid,proforma2" icon="STOCK_EXECUTE" />
|
||||
<button name="%(action_account_invoice_refund)d" type="action" string="Credit Note" icon="STOCK_EXECUTE" />
|
||||
</group>
|
||||
</group>
|
||||
</page>
|
||||
|
||||
<page string="Other Info">
|
||||
<field name="company_id" on_change="onchange_company_id(company_id,partner_id,type,invoice_line,currency_id)" widget="selection" groups="base.group_multi_company"/>
|
||||
<field name="fiscal_position" groups="base.group_extended" widget="selection"/>
|
||||
@@ -285,16 +281,13 @@
|
||||
<field name="amount_total"/>
|
||||
<field name="state" select="2"/>
|
||||
<field name="residual"/>
|
||||
<group col="7" colspan="4" groups="base.group_user">
|
||||
<group col="3" colspan="4" groups="base.group_user">
|
||||
<button name="invoice_proforma2" states="draft" string="PRO-FORMA" icon="gtk-print"/>
|
||||
<button name="invoice_open" states="draft,proforma2" string="Create" icon="gtk-execute"/>
|
||||
<button name="invoice_cancel" states="draft,proforma2,sale,open" string="Cancel" icon="gtk-cancel"/>
|
||||
<button name="action_cancel_draft" states="cancel" string="Set to Draft" type="object" icon="gtk-convert"/>
|
||||
<button name='%(wizard_paid_open)d' type='action' string='Re-Open' states='paid' icon="gtk-convert"/>
|
||||
<!-- Wizard Buttons: To Remove -->
|
||||
<button name="%(wizard_invoice_pay)d" type="action" string="Pay Invoice" states="open,paid,proforma2" icon="STOCK_EXECUTE" />
|
||||
<button name="%(action_account_invoice_refund)d" type="action" string="Credit Note" icon="STOCK_EXECUTE" />
|
||||
</group>
|
||||
</group>
|
||||
</group>
|
||||
</page>
|
||||
<page string="Other Info">
|
||||
|
||||
@@ -81,10 +81,6 @@
|
||||
<separator colspan="4" string="States"/>
|
||||
<field name="state" select="1"/>
|
||||
<button name="action_draft" states="done" string="Set to Draft" type="object" icon="gtk-convert"/>
|
||||
<!-- Wizard Buttons: To Remove -->
|
||||
<button name="%(action_account_period_close)d"
|
||||
states="draft" string="Close Period" type="action"
|
||||
icon="gtk-close" />
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
@@ -671,8 +667,9 @@
|
||||
<field eval="'ir.actions.wizard,%d'%action_move_journal_line_form_select" name="value"/>
|
||||
<field eval="True" name="object"/>
|
||||
</record>
|
||||
<!-- <wizard id="action_move_journal_line_form" menu="False" model="account.move.line" name="account.move.journal" string="Making Entries by Line"/>
|
||||
<menuitem icon="STOCK_JUSTIFY_FILL" action="action_move_journal_line_form" id="menu_action_move_journal_line_form" parent="account.menu_finance_entries" type="wizard" sequence="5"/>-->
|
||||
|
||||
<wizard id="action_move_journal_line_form" menu="False" model="account.move.line" name="account.move.journal" string="Entries by Line"/>
|
||||
<menuitem icon="STOCK_JUSTIFY_FILL" action="action_move_journal_line_form" id="menu_action_move_journal_line_form" parent="account.menu_finance_entries" type="wizard" sequence="5"/>
|
||||
|
||||
<!--
|
||||
Entries lines
|
||||
@@ -977,7 +974,7 @@
|
||||
<menuitem action="action_move_line_form" id="menu_action_move_line_form" parent="next_id_29"/>
|
||||
|
||||
<record id="action_move_line_form_encode_by_move" model="ir.actions.act_window">
|
||||
<field name="name">Making Entries by Move</field>
|
||||
<field name="name">Entries by Move</field>
|
||||
<field name="res_model">account.move</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_mode">tree,form</field>
|
||||
@@ -1010,9 +1007,9 @@
|
||||
<menuitem action="action_move_line_search" id="menu_action_move_line_search" parent="account.next_id_29"/>
|
||||
|
||||
<menuitem id="menu_finance_charts" name="Charts" parent="account.menu_finance" sequence="4"/>
|
||||
<!-- <wizard id="wizard_account_chart" menu="False" model="account.account" name="account.chart" string="Chart of Accounts"/>
|
||||
<menuitem icon="STOCK_INDENT" action="wizard_account_chart" id="menu_action_account_tree2" parent="account.menu_finance_charts" type="wizard"/> -->
|
||||
|
||||
<wizard id="wizard_account_chart" menu="False" model="account.account" name="account.chart" string="Chart of Accounts"/>
|
||||
<menuitem icon="STOCK_INDENT" action="wizard_account_chart" id="menu_action_account_tree2" parent="account.menu_finance_charts" type="wizard"/>
|
||||
|
||||
|
||||
|
||||
<record id="view_bank_statement_reconcile_form" model="ir.ui.view">
|
||||
@@ -1082,11 +1079,8 @@
|
||||
groups="group_account_user"/>
|
||||
|
||||
<menuitem action="action_bank_statement_reconciliation_form" id="menu_action_account_bank_reconcile_tree" parent="next_id_30"/>
|
||||
|
||||
<!--<wizard id="action_account_bank_reconcile_tree" menu="False" model="account.move.line" name="account.move.bank.reconcile" string="Bank reconciliation"/> -->
|
||||
<menuitem action="action_account_bank_reconcile_tree"
|
||||
id="menu_action_account_bank_reconcile_check_tree"
|
||||
parent="account.next_id_30" />
|
||||
<wizard id="action_account_bank_reconcile_tree" menu="False" model="account.move.line" name="account.move.bank.reconcile" string="Bank reconciliation"/>
|
||||
<menuitem action="action_account_bank_reconcile_tree" id="menu_action_account_bank_reconcile_check_tree" parent="account.next_id_30" type="wizard"/>
|
||||
|
||||
<act_window
|
||||
domain="[('account_id', '=', active_id)]"
|
||||
|
||||
@@ -11,18 +11,18 @@
|
||||
|
||||
<wizard id="wizard_invoice_pay" model="account.invoice" name="account.invoice.pay" string="Pay invoice" groups="base.group_user"/>
|
||||
|
||||
<!-- close year, period, journal -->
|
||||
<!-- close year, period, journal -->
|
||||
<wizard id="wizard_fiscalyear_close" menu="False" model="account.fiscalyear" name="account.fiscalyear.close" string="Generate Fiscal Year Opening Entries"/>
|
||||
|
||||
<!-- <menuitem
|
||||
<menuitem
|
||||
action="wizard_fiscalyear_close"
|
||||
id="menu_wizard_fy_close"
|
||||
parent="menu_account_end_year_treatments"
|
||||
|
||||
sequence="1"/>-->
|
||||
type="wizard"
|
||||
sequence="1"/>
|
||||
|
||||
<wizard id="wizard_fiscalyear_close_state" menu="False" model="account.fiscalyear" name="account.fiscalyear.close.state" string="Close a Fiscal Year"/>
|
||||
|
||||
<menuitem action="wizard_fiscalyear_close_state" id="menu_wizard_fy_close_state" parent="menu_account_end_year_treatments" type="wizard"/>
|
||||
|
||||
<wizard
|
||||
id="wizard_open_closed_fiscalyear"
|
||||
@@ -36,12 +36,13 @@
|
||||
sequence="2"
|
||||
parent="account.menu_account_end_year_treatments" type="wizard"/>
|
||||
|
||||
<!-- <wizard id="wizard_period_close" model="account.period" name="account.period.close" string="Close a Period"/>-->
|
||||
<wizard id="wizard_period_close" model="account.period" name="account.period.close" string="Close a Period"/>
|
||||
|
||||
<!-- automatic reconcile -->
|
||||
<wizard id="wizard_automatic_reconcile" menu="False" model="account.account" name="account.automatic.reconcile" string="Automatic reconciliation"/>
|
||||
<menuitem id="next_id_20" name="Reconciliation" parent="menu_finance_periodical_processing"/><menuitem action="wizard_automatic_reconcile" id="menu_automatic_reconcile" parent="next_id_20" type="wizard"/>
|
||||
|
||||
<!-- Import entry in statement -->
|
||||
<!-- Import entry in statement -->
|
||||
|
||||
<wizard
|
||||
string="Import invoices"
|
||||
@@ -56,7 +57,8 @@
|
||||
<wizard id="wizard_reconcile_unreconcile" model="account.move.reconcile" name="account.reconcile.unreconcile" string="Unreconcile Entries"/>
|
||||
|
||||
|
||||
|
||||
<wizard id="wizard_reconcile_select" menu="False" model="account.move.line" name="account.move.line.reconcile.select" string="Reconcile entries"/>
|
||||
<menuitem action="wizard_reconcile_select" id="menu_reconcile_select" parent="account.next_id_20" type="wizard"/>
|
||||
|
||||
<!-- unreconcile -->
|
||||
<wizard id="wizard_unreconcile" model="account.move.line" name="account.move.line.unreconcile" string="Unreconcile Entries"/>
|
||||
|
||||
@@ -1136,7 +1136,8 @@ class account_invoice_line(osv.osv):
|
||||
'invoice_line_tax_id': fields.many2many('account.tax', 'account_invoice_line_tax', 'invoice_line_id', 'tax_id', 'Taxes', domain=[('parent_id','=',False)]),
|
||||
'note': fields.text('Notes', translate=True),
|
||||
'account_analytic_id': fields.many2one('account.analytic.account', 'Analytic Account'),
|
||||
'company_id': fields.related('invoice_id','company_id',type='many2one',relation='res.company',string='Company',store=True)
|
||||
'company_id': fields.related('invoice_id','company_id',type='many2one',relation='res.company',string='Company',store=True),
|
||||
'partner_id': fields.related('invoice_id','partner_id',type='many2one',relation='res.partner',string='Partner',store=True)
|
||||
}
|
||||
_defaults = {
|
||||
'quantity': lambda *a: 1,
|
||||
|
||||
@@ -202,7 +202,7 @@
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_id" ref="view_account_analytic_line_tree"/>
|
||||
</record>
|
||||
<wizard id="action_account_analytic_line" menu="False" model="account.analytic.line" name="account.analytic.line" string="Making Entries by Line"/>
|
||||
<wizard id="action_account_analytic_line" menu="False" model="account.analytic.line" name="account.analytic.line" string="Entries by Line"/>
|
||||
<menuitem id="next_id_41" name="Analytic Entries" parent="account.menu_finance_entries"/>
|
||||
<menuitem type="wizard" icon="STOCK_JUSTIFY_FILL" action="action_account_analytic_line" id="account_entries_analytic_entries" parent="next_id_41"/>
|
||||
|
||||
|
||||
@@ -39,7 +39,7 @@ def _action_open_window(self, cr, uid, data, context):
|
||||
id = mod_obj.read(cr, uid, result, ['res_id'])
|
||||
|
||||
return {
|
||||
'name': _('Analytic Entries'),
|
||||
'name': _('Analytic Entries by line'),
|
||||
'view_type': 'form',
|
||||
"view_mode": 'tree,form',
|
||||
'res_model': 'account.analytic.line',
|
||||
@@ -71,11 +71,11 @@ class account_analytic_line(wizard.interface):
|
||||
}
|
||||
|
||||
states = {
|
||||
'init': {
|
||||
'init': {
|
||||
'actions': [],
|
||||
'result': {'type': 'form', 'arch':form1, 'fields':form1_fields, 'state': [('end', 'Cancel','gtk-cancel'),('open', 'Open Entries','gtk-ok')]}
|
||||
},
|
||||
'open': {
|
||||
'open': {
|
||||
'actions': [],
|
||||
'result': {'type': 'action', 'action': _action_open_window, 'state':'end'}
|
||||
}
|
||||
|
||||
@@ -19,14 +19,17 @@
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
# 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
|
||||
@@ -35,8 +38,9 @@ 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
|
||||
@@ -44,6 +48,7 @@ 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
|
||||
@@ -57,12 +62,7 @@ import wizard_central_journal
|
||||
import wizard_general_journal
|
||||
import wizard_change_currency
|
||||
|
||||
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:
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
||||
|
||||
@@ -1,87 +0,0 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
##############################################################################
|
||||
#
|
||||
# OpenERP, Open Source Management Solution
|
||||
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
|
||||
#
|
||||
# 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 <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
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:
|
||||
|
||||
@@ -1,40 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<openerp>
|
||||
<data>
|
||||
|
||||
<record id="view_account_chart" model="ir.ui.view">
|
||||
<field name="name">account.chart.form</field>
|
||||
<field name="model">account.chart</field>
|
||||
<field name="type">form</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Account charts">
|
||||
<group colspan="4" >
|
||||
<field name="fiscalyear"/>
|
||||
<label align="0.7" colspan="6" string="(If you do not select Fiscal year it will take all open fiscal years)"/>
|
||||
<field name="target_move"/>
|
||||
</group>
|
||||
<separator string="" colspan="4" />
|
||||
<group colspan="4" col="6">
|
||||
<label string ="" colspan="2"/>
|
||||
<button icon="gtk-cancel" special="cancel" string="Cancel" />
|
||||
<button icon="gtk-open" string="Open Charts"
|
||||
name="_account_chart_open_window" type="object" />
|
||||
</group>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="action_account_chart" model="ir.actions.act_window">
|
||||
<field name="name">Chart of Accounts</field>
|
||||
<field name="res_model">account.chart</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_mode">tree,form</field>
|
||||
<field name="view_id" ref="view_account_chart"/>
|
||||
<field name="target">new</field>
|
||||
</record>
|
||||
|
||||
<menuitem icon="STOCK_INDENT" action="action_account_chart"
|
||||
id="menu_action_account_tree2"
|
||||
parent="account.menu_finance_charts" />
|
||||
</data>
|
||||
</openerp>
|
||||
@@ -1,70 +0,0 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
##############################################################################
|
||||
#
|
||||
# OpenERP, Open Source Management Solution
|
||||
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
|
||||
#
|
||||
# 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 <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
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:
|
||||
|
||||
@@ -1,39 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<openerp>
|
||||
<data>
|
||||
<record id="view_account_fiscalyear_close_state" model="ir.ui.view">
|
||||
<field name="name">account.fiscalyear.close.state.form</field>
|
||||
<field name="model">account.fiscalyear.close.state</field>
|
||||
<field name="type">form</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Close states of Fiscal year and periods">
|
||||
<group colspan="4" >
|
||||
<field name="fy_id" domain = "[('state','=','draft')]"/>
|
||||
<separator string="Are you sure you want to close the fiscal year ?" colspan="4"/>
|
||||
<field name="sure"/>
|
||||
</group>
|
||||
<separator string="" colspan="4" />
|
||||
<group colspan="4" col="6">
|
||||
<label string ="" colspan="2"/>
|
||||
<button icon="gtk-cancel" special="cancel" string="Cancel"/>
|
||||
<button icon="gtk-close" string="Close states" name="_data_save" type="object"/>
|
||||
</group>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="action_account_fiscalyear_close_state" model="ir.actions.act_window">
|
||||
<field name="name">Close a Fiscal Year</field>
|
||||
<field name="res_model">account.fiscalyear.close.state</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_mode">tree,form</field>
|
||||
<field name="view_id" ref="view_account_fiscalyear_close_state"/>
|
||||
<field name="target">new</field>
|
||||
</record>
|
||||
|
||||
<menuitem action="action_account_fiscalyear_close_state"
|
||||
id="menu_wizard_fy_close_state"
|
||||
parent="menu_account_end_year_treatments" />
|
||||
|
||||
</data>
|
||||
</openerp>
|
||||
@@ -1,214 +0,0 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
##############################################################################
|
||||
#
|
||||
# OpenERP, Open Source Management Solution
|
||||
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
|
||||
#
|
||||
# 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 <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
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:
|
||||
|
||||
@@ -1,40 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<openerp>
|
||||
<data>
|
||||
|
||||
<record id="view_account_invoice_refund" model="ir.ui.view">
|
||||
<field name="name">account.invoice.refund.form</field>
|
||||
<field name="model">account.invoice.refund</field>
|
||||
<field name="type">form</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Credit Note">
|
||||
<group colspan="4" >
|
||||
<label string="Are you sure you want to refund this invoice ?" colspan="2"/>
|
||||
<newline/>
|
||||
<field name="date"/>
|
||||
<field name="period"/>
|
||||
<field name="description"/>
|
||||
</group>
|
||||
<separator string="" colspan="4" />
|
||||
<group colspan="4" col="6">
|
||||
<label string ="" colspan="2"/>
|
||||
<button icon="gtk-cancel" special="cancel" string="Cancel"/>
|
||||
<button icon="gtk-redo" string="Refund Invoice" name="_invoice_refund" type="object"/>
|
||||
<button icon="gtk-ok" string="Cancel Invoice" name="_invoice_cancel" type="object"/>
|
||||
<button icon="gtk-undo" string="Modify Invoice" name="_invoice_modify" type="object"/>
|
||||
</group>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="action_account_invoice_refund" model="ir.actions.act_window">
|
||||
<field name="name">Credit Note</field>
|
||||
<field name="res_model">account.invoice.refund</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_mode">tree,form</field>
|
||||
<field name="view_id" ref="view_account_invoice_refund"/>
|
||||
<field name="target">new</field>
|
||||
</record>
|
||||
|
||||
</data>
|
||||
</openerp>
|
||||
@@ -1,67 +0,0 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
##############################################################################
|
||||
#
|
||||
# OpenERP, Open Source Management Solution
|
||||
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
|
||||
#
|
||||
# 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 <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
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:
|
||||
@@ -1,33 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<openerp>
|
||||
<data>
|
||||
<record id="view_account_move_bank_reconcile" model="ir.ui.view">
|
||||
<field name="name">account.move.bank.reconcile.form</field>
|
||||
<field name="model">account.move.bank.reconcile</field>
|
||||
<field name="type">form</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Bank reconciliation">
|
||||
<group colspan="4" >
|
||||
<field name="journal_id"/>
|
||||
</group>
|
||||
<separator string="" colspan="4" />
|
||||
<group colspan="4" col="6">
|
||||
<label string ="" colspan="2"/>
|
||||
<button icon="gtk-cancel" special="cancel" string="Cancel"/>
|
||||
<button icon="gtk-open" string="Open for bank reconciliation" name="_action_open_window" type="object"/>
|
||||
</group>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="action_account_bank_reconcile_tree" model="ir.actions.act_window">
|
||||
<field name="name">Bank reconciliation</field>
|
||||
<field name="res_model">account.move.bank.reconcile</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_mode">tree,form</field>
|
||||
<field name="view_id" ref="view_account_move_bank_reconcile"/>
|
||||
<field name="target">new</field>
|
||||
</record>
|
||||
|
||||
</data>
|
||||
</openerp>
|
||||
@@ -1,102 +0,0 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
##############################################################################
|
||||
#
|
||||
# OpenERP, Open Source Management Solution
|
||||
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
|
||||
#
|
||||
# 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 <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
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:
|
||||
|
||||
@@ -1,41 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<openerp>
|
||||
<data>
|
||||
|
||||
<record id="view_account_move_journal_form" model="ir.ui.view">
|
||||
<field name="name">account.move.journal.form</field>
|
||||
<field name="model">account.move.journal</field>
|
||||
<field name="type">form</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Standard entries">
|
||||
<group colspan="4" >
|
||||
<field name="journal_id"/>
|
||||
<newline/>
|
||||
<field name="period_id" />
|
||||
</group>
|
||||
<separator string="" colspan="4" />
|
||||
<group colspan="4" col="6">
|
||||
<label string ="" colspan="2"/>
|
||||
<button icon="gtk-cancel" special="cancel" string="Cancel"/>
|
||||
<button icon="gtk-open" string="Open Journal" name="_action_open_window" type="object"/>
|
||||
</group>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="action_account_move_journal_line_form" model="ir.actions.act_window">
|
||||
<field name="name">Making Entries by Line</field>
|
||||
<field name="res_model">account.move.journal</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_mode">tree,form</field>
|
||||
<field name="view_id" ref="view_account_move_journal_form"/>
|
||||
<field name="target">new</field>
|
||||
</record>
|
||||
|
||||
<menuitem icon="STOCK_JUSTIFY_FILL"
|
||||
action="action_account_move_journal_line_form"
|
||||
id="menu_action_move_journal_line_form"
|
||||
parent="account.menu_finance_entries" sequence="5" />
|
||||
|
||||
</data>
|
||||
</openerp>
|
||||
@@ -1,61 +0,0 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
##############################################################################
|
||||
#
|
||||
# OpenERP, Open Source Management Solution
|
||||
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
|
||||
#
|
||||
# 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 <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
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:
|
||||
@@ -1,40 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<openerp>
|
||||
<data>
|
||||
<record id="view_account_move_line_reconcile_select" model="ir.ui.view">
|
||||
<field name="name">account.move.line.reconcile.select.form</field>
|
||||
<field name="model">account.move.line.reconcile.select</field>
|
||||
<field name="type">form</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Reconciliation">
|
||||
<group colspan="4" >
|
||||
<field name="account_id"/>
|
||||
</group>
|
||||
<separator string="" colspan="4" />
|
||||
<group colspan="4" col="6">
|
||||
<label string ="" colspan="2"/>
|
||||
<button icon="gtk-cancel" special="cancel" string="Cancel" />
|
||||
<button icon="gtk-open"
|
||||
string="Open for reconciliation" name="_action_open_window"
|
||||
type="object" />
|
||||
</group>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
<record id="action_account_reconcile_select" model="ir.actions.act_window">
|
||||
<field name="name">Reconcile entries</field>
|
||||
<field name="res_model">account.move.line.reconcile.select</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_mode">tree,form</field>
|
||||
<field name="view_id" ref="view_account_move_line_reconcile_select"/>
|
||||
<field name="target">new</field>
|
||||
</record>
|
||||
|
||||
<menuitem id="next_id_20" name="Reconciliation"
|
||||
parent="menu_finance_periodical_processing" />
|
||||
|
||||
<menuitem action="action_account_reconcile_select"
|
||||
id="menu_reconcile_select" parent="account.next_id_20" />
|
||||
|
||||
</data>
|
||||
</openerp>
|
||||
@@ -1,61 +0,0 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
##############################################################################
|
||||
#
|
||||
# OpenERP, Open Source Management Solution
|
||||
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
|
||||
#
|
||||
# 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 <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
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:
|
||||
|
||||
@@ -1,35 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<openerp>
|
||||
<data>
|
||||
|
||||
<record id="view_account_period_close" model="ir.ui.view">
|
||||
<field name="name">account.period.close.form</field>
|
||||
<field name="model">account.period.close</field>
|
||||
<field name="type">form</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Close Period">
|
||||
<group colspan="4" >
|
||||
<separator string="Are you sure ?" colspan="4"/>
|
||||
<field name="sure"/>
|
||||
</group>
|
||||
<separator string="" colspan="4" />
|
||||
<group colspan="4" col="6">
|
||||
<label string ="" colspan="2"/>
|
||||
<button icon="gtk-cancel" special="cancel" string="Cancel"/>
|
||||
<button icon="gtk-close" string="Close Period" name="_data_save" type="object"/>
|
||||
</group>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="action_account_period_close" model="ir.actions.act_window">
|
||||
<field name="name">Close a Period</field>
|
||||
<field name="res_model">account.period.close</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_mode">tree,form</field>
|
||||
<field name="view_id" ref="view_account_period_close"/>
|
||||
<field name="target">new</field>
|
||||
</record>
|
||||
|
||||
</data>
|
||||
</openerp>
|
||||
@@ -0,0 +1,80 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
##############################################################################
|
||||
#
|
||||
# OpenERP, Open Source Management Solution
|
||||
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
|
||||
#
|
||||
# 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 <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
import wizard
|
||||
import pooler
|
||||
|
||||
class wizard_account_chart(wizard.interface):
|
||||
_account_chart_arch = '''<?xml version="1.0"?>
|
||||
<form string="Account charts">
|
||||
<field name="fiscalyear"/>
|
||||
<label align="0.7" colspan="6" string="(If you do not select Fiscal year it will take all open fiscal years)"/>
|
||||
<field name="target_move"/>
|
||||
</form>'''
|
||||
|
||||
_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:
|
||||
|
||||
@@ -0,0 +1,67 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
##############################################################################
|
||||
#
|
||||
# OpenERP, Open Source Management Solution
|
||||
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
|
||||
#
|
||||
# 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 <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
import wizard
|
||||
from tools.translate import _
|
||||
|
||||
_journal_form = '''<?xml version="1.0"?>
|
||||
<form string="%s">
|
||||
<field name="journal_id"/>
|
||||
</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:
|
||||
|
||||
@@ -0,0 +1,71 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
##############################################################################
|
||||
#
|
||||
# OpenERP, Open Source Management Solution
|
||||
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
|
||||
#
|
||||
# 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 <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
import wizard
|
||||
import osv
|
||||
import pooler
|
||||
from tools.translate import _
|
||||
|
||||
_transaction_form = '''<?xml version="1.0"?>
|
||||
<form string=" Close states of Fiscal year and periods">
|
||||
<field name="fy_id"/>
|
||||
<separator string="Are you sure you want to close the fiscal year ?" colspan="4"/>
|
||||
<field name="sure"/>
|
||||
</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:
|
||||
|
||||
@@ -0,0 +1,99 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
##############################################################################
|
||||
#
|
||||
# OpenERP, Open Source Management Solution
|
||||
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
|
||||
#
|
||||
# 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 <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
import wizard
|
||||
from osv import osv
|
||||
import pooler
|
||||
from tools.translate import _
|
||||
|
||||
_journal_form = '''<?xml version="1.0"?>
|
||||
<form string="Standard entries">
|
||||
<field name="journal_id"/>
|
||||
<newline/>
|
||||
<field name="period_id"/>
|
||||
</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:
|
||||
|
||||
@@ -0,0 +1,57 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
##############################################################################
|
||||
#
|
||||
# OpenERP, Open Source Management Solution
|
||||
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
|
||||
#
|
||||
# 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 <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
import wizard
|
||||
|
||||
_transaction_form = '''<?xml version="1.0"?>
|
||||
<form string="Close Period">
|
||||
<separator string="Are you sure ?" colspan="4"/>
|
||||
<field name="sure"/>
|
||||
</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:
|
||||
|
||||
@@ -19,13 +19,13 @@
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
from datetime import datetime
|
||||
from tools.translate import _
|
||||
import wizard
|
||||
import netsvc
|
||||
import time
|
||||
import osv
|
||||
import pooler
|
||||
import time
|
||||
import wizard
|
||||
from datetime import datetime
|
||||
from tools.translate import _
|
||||
|
||||
_transaction_form = '''<?xml version="1.0"?>
|
||||
<form string="Reconciliation">
|
||||
@@ -39,10 +39,10 @@ _transaction_form = '''<?xml version="1.0"?>
|
||||
</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 = '''<?xml version="1.0"?>
|
||||
</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'}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,61 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
##############################################################################
|
||||
#
|
||||
# OpenERP, Open Source Management Solution
|
||||
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
|
||||
#
|
||||
# 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 <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
import wizard
|
||||
from tools.translate import _
|
||||
|
||||
|
||||
_journal_form = '''<?xml version="1.0"?>
|
||||
<form string="%s">
|
||||
<field name="account_id"/>
|
||||
</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:
|
||||
|
||||
@@ -0,0 +1,226 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
##############################################################################
|
||||
#
|
||||
# OpenERP, Open Source Management Solution
|
||||
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
|
||||
#
|
||||
# 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 <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
import wizard
|
||||
import pooler
|
||||
import osv
|
||||
import netsvc
|
||||
import time
|
||||
from tools.translate import _
|
||||
|
||||
sur_form = '''<?xml version="1.0"?>
|
||||
<form string="Credit Note">
|
||||
<label string="Are you sure you want to refund this invoice ?" colspan="2"/>
|
||||
<newline />
|
||||
<field name="date" />
|
||||
<field name="period" />
|
||||
<field name="description" width="150" />
|
||||
</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:
|
||||
|
||||
@@ -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],
|
||||
|
||||
@@ -43,8 +43,7 @@
|
||||
"voucher_sequence.xml",
|
||||
"account_report.xml",
|
||||
"voucher_view.xml",
|
||||
"wizard/account_voucher_open_view.xml",
|
||||
#"voucher_wizard.xml",
|
||||
"voucher_wizard.xml",
|
||||
"account_view.xml",
|
||||
],
|
||||
'certificate': '0037580727101',
|
||||
|
||||
@@ -19,5 +19,4 @@
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
|
||||
import account_voucher_open
|
||||
import open_voucher
|
||||
|
||||
@@ -1,76 +0,0 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
##############################################################################
|
||||
#
|
||||
# OpenERP, Open Source Management Solution
|
||||
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
|
||||
#
|
||||
# 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 <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
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()
|
||||
|
||||
|
||||
@@ -1,41 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<openerp>
|
||||
<data>
|
||||
<record id="view_account_voucher_open_form" model="ir.ui.view">
|
||||
<field name="name">account.voucher.open.form</field>
|
||||
<field name="model">account.voucher.open</field>
|
||||
<field name="type">form</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Open Vouchers">
|
||||
<group colspan="4" >
|
||||
<field name="type"/>
|
||||
<field name="state"/>
|
||||
<field name="period_ids" colspan="4"/>
|
||||
</group>
|
||||
<separator string="" colspan="4" />
|
||||
<group colspan="4" col="6">
|
||||
<label string ="" colspan="2"/>
|
||||
<button icon="gtk-cancel" special="cancel" string="Cancel"/>
|
||||
<button icon="gtk-open" string="Open Voucher Entries" name="_action_open_window" type="object"/>
|
||||
</group>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="action_account_voucher_open" model="ir.actions.act_window">
|
||||
<field name="name">Open a Voucher Entry</field>
|
||||
<field name="res_model">account.voucher.open</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_mode">tree,form</field>
|
||||
<field name="view_id" ref="view_account_voucher_open_form"/>
|
||||
<field name="target">new</field>
|
||||
</record>
|
||||
|
||||
<menuitem
|
||||
action="action_account_voucher_open"
|
||||
id="menu_wizard_account_voucher_open"
|
||||
name="Open Vouchers"
|
||||
sequence="0"
|
||||
parent="menu_action_voucher_list"/>
|
||||
</data>
|
||||
</openerp>
|
||||
@@ -0,0 +1,104 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
##############################################################################
|
||||
#
|
||||
# OpenERP, Open Source Management Solution
|
||||
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
|
||||
#
|
||||
# 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 <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
import wizard
|
||||
from tools.translate import _
|
||||
import pooler
|
||||
|
||||
_voucher_form = '''<?xml version="1.0"?>
|
||||
<form string="Open Vouchers">
|
||||
<field name="type"/>
|
||||
<field name="state"/>
|
||||
<field name="period_ids" colspan="4"/>
|
||||
</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:
|
||||
@@ -34,16 +34,6 @@
|
||||
'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'
|
||||
|
||||
@@ -478,15 +478,13 @@ 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=None, operator='ilike', context={}):
|
||||
if not args:
|
||||
args = []
|
||||
def name_search(self, cr, user, name, args=[], operator='ilike', context={}):
|
||||
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):
|
||||
|
||||
@@ -3,8 +3,7 @@
|
||||
<data>
|
||||
<menuitem name="Auction Management" id="auction_menu_root" icon="terp-purchase"/>
|
||||
<menuitem name="Configuration" parent="auction_menu_root" id="auction_config_menu" sequence="7"/>
|
||||
<menuitem name="Tools Bar Codes" id="auction_outils_menu" parent="auction_menu_root" sequence="5" />
|
||||
<menuitem name="Deliveries Management" action="action_auction_taken" id="menu_wizard_emporte" parent="auction_outils_menu"/>
|
||||
|
||||
=======================================================
|
||||
Auction Management/Configuration/artist
|
||||
=======================================================
|
||||
@@ -204,7 +203,6 @@
|
||||
<field name="lot_est2"/>
|
||||
<field name="product_id"/>
|
||||
<field name="state" readonly="1"/>
|
||||
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
@@ -279,7 +277,7 @@
|
||||
<separator string="Description" colspan="4"/>
|
||||
<field name="obj_desc" colspan="4" nolabel="1" select="2"/>
|
||||
<field name="state" colspan="1" select="2"/>
|
||||
<group col="8" colspan="2">
|
||||
<group col="4" colspan="2">
|
||||
<button name="button_bought" string="Sold" states="draft" type="object" icon="gtk-jump-to"/>
|
||||
<button name="button_not_bought" string="Not sold" states="draft" type="object" icon="gtk-undo"/>
|
||||
<button name="button_taken_away" string="Taken away" states="sold" type="object" icon="gtk-goto-last"/>
|
||||
@@ -332,6 +330,7 @@
|
||||
<field name="date"/>
|
||||
</tree>
|
||||
</field>
|
||||
|
||||
</page>
|
||||
<page string="Bids">
|
||||
<field name="bid_lines" colspan="4" nolabel="1" editable="top">
|
||||
@@ -341,7 +340,9 @@
|
||||
<field name="call"/>
|
||||
</tree>
|
||||
</field>
|
||||
|
||||
</page>
|
||||
|
||||
</notebook>
|
||||
</form>
|
||||
</field>
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
<?xml version="1.0"?>
|
||||
<openerp>
|
||||
<data>
|
||||
<!-- Following wizard is remaining to implement in osv_memory-->
|
||||
<!--
|
||||
<!--<delete model="ir.actions.wizard" search="[('wiz_name','like','auction.lots.')]"/>-->
|
||||
|
||||
<wizard string="Send to website"
|
||||
model="auction.lots"
|
||||
name="auction.lots.send.aie"
|
||||
@@ -20,6 +20,45 @@
|
||||
multi="1"
|
||||
id="wizard_map_user"/>
|
||||
|
||||
<wizard string="Change Auction Date"
|
||||
model="auction.lots"
|
||||
name="auction.lots.auction_move"
|
||||
multi="1"
|
||||
id="wizard_change_auction"/>
|
||||
|
||||
<!--wizard string="Pay objects of the seller"
|
||||
model="auction.lots"
|
||||
name="auction.pay.sel"
|
||||
id="wizard_lots_pay"/-->
|
||||
<wizard string="Pay objects of the buyer"
|
||||
model="auction.lots"
|
||||
name="auction.pay.buy"
|
||||
id="wizard_pay"/>
|
||||
|
||||
<wizard
|
||||
string="Gestion emporte"
|
||||
model="auction.dates"
|
||||
name="auction.taken"
|
||||
multi="1"
|
||||
id="wizard_emporte"/>
|
||||
|
||||
<menuitem name="Tools Bar Codes"
|
||||
id="auction_outils_menu"
|
||||
parent="auction_menu_root" sequence="5"
|
||||
/>
|
||||
|
||||
<menuitem name="Deliveries Management"
|
||||
action="wizard_emporte"
|
||||
type="wizard"
|
||||
id="menu_wizard_emporte"
|
||||
parent="auction_outils_menu"
|
||||
/>
|
||||
|
||||
<!--wizard string="Cancel payment"
|
||||
model="auction.lots"
|
||||
name="auction.lots.cancel"
|
||||
multi="1"
|
||||
id="wizard_cancel_pay"/-->
|
||||
|
||||
<wizard string="Numerotation (per lot)"
|
||||
model="auction.lots"
|
||||
@@ -33,13 +72,56 @@
|
||||
multi="1"
|
||||
id="wizard_numerotate_automatic"/>
|
||||
|
||||
<wizard string="SMS Send"
|
||||
model="auction.lots"
|
||||
name="auction.lots.sms_send"
|
||||
multi="1"
|
||||
id="wizard_sms"/>
|
||||
|
||||
<!--wizard string="Invoice"
|
||||
model="auction.lots"
|
||||
name="auction.lots.invoice"
|
||||
multi="1"
|
||||
id="wizard_invoicing"/-->
|
||||
|
||||
|
||||
<wizard string="Invoice Seller objects"
|
||||
model="auction.lots"
|
||||
name="auction.lots.make_invoice"
|
||||
multi="1"
|
||||
id="wizard_invoice"/>
|
||||
|
||||
<wizard string="Invoice Buyer objects"
|
||||
model="auction.lots"
|
||||
name="auction.lots.make_invoice_buyer"
|
||||
id="wizard_invoice_buyer1"/>
|
||||
|
||||
<wizard string="Unmark as taken away"
|
||||
model="auction.lots"
|
||||
name="auction.lots.enable"
|
||||
multi="1"
|
||||
id="auction_wizard_enable_taken"/>
|
||||
|
||||
<wizard string="Mark as taken away"
|
||||
model="auction.lots"
|
||||
name="auction.lots.able"
|
||||
multi="1"
|
||||
id="auction_wizard_able_taken"/>
|
||||
|
||||
<wizard
|
||||
id="auction_catalog_flagy"
|
||||
string="Auction Catalog Flagey"
|
||||
model="auction.dates"
|
||||
name="auction.catalog.flagey"
|
||||
keyword="client_print_multi"/>
|
||||
-->
|
||||
|
||||
<wizard string="Mark as paid for seller"
|
||||
model="auction.lots"
|
||||
name="auction.payer.sel"
|
||||
multi="1"
|
||||
id="auction_wizard_payer_sel"/>
|
||||
|
||||
|
||||
|
||||
</data>
|
||||
</openerp>
|
||||
|
||||
@@ -19,27 +19,24 @@
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
#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
|
||||
|
||||
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
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
||||
|
||||
@@ -1,44 +0,0 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
##############################################################################
|
||||
#
|
||||
# OpenERP, Open Source Management Solution
|
||||
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
|
||||
#
|
||||
# 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 <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
##############################################################################
|
||||
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()
|
||||
@@ -1,43 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<openerp>
|
||||
<data>
|
||||
<record id="view_auction_lots_able" model="ir.ui.view">
|
||||
<field name="name">auction.lots.able.form</field>
|
||||
<field name="model">auction.lots.able</field>
|
||||
<field name="type">form</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Confirm">
|
||||
<group colspan="4" >
|
||||
<separator string="Confirmation set taken away" colspan="4"/>
|
||||
<newline/>
|
||||
</group>
|
||||
<separator string="" colspan="4" />
|
||||
<group colspan="4" col="6">
|
||||
<button icon="gtk-cancel" special="cancel" string="Cancel"/>
|
||||
<button icon="gtk-goto-last" string="Able Taken away" name="confirm_able" type="object"/>
|
||||
</group>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="action_auction_lots_able" model="ir.actions.act_window">
|
||||
<field name="name">Mark as taken away</field>
|
||||
<field name="res_model">auction.lots.able</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_mode">tree,form</field>
|
||||
<field name="view_id" ref="view_auction_lots_able"/>
|
||||
<field name="target">new</field>
|
||||
<field name="context">{'record_id' : active_id}</field>
|
||||
</record>
|
||||
|
||||
<record id="auction_lots_able_values" model="ir.values">
|
||||
<field name="model_id" ref="auction.model_auction_lots" />
|
||||
<field name="object" eval="1" />
|
||||
<field name="name">Mark as taken away</field>
|
||||
<field name="key2">client_action_multi</field>
|
||||
<field name="value" eval="'ir.actions.act_window,' + str(ref('action_auction_lots_able'))" />
|
||||
<field name="key">action</field>
|
||||
<field name="model">auction.lots</field>
|
||||
</record>
|
||||
</data>
|
||||
</openerp>
|
||||
@@ -1,84 +0,0 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
##############################################################################
|
||||
#
|
||||
# OpenERP, Open Source Management Solution
|
||||
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
|
||||
#
|
||||
# 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 <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
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:
|
||||
|
||||
@@ -1,45 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<openerp>
|
||||
<data>
|
||||
<record id="view_auction_lots_auction_move" model="ir.ui.view">
|
||||
<field name="name">auction.lots.auction.move.form</field>
|
||||
<field name="model">auction.lots.auction.move</field>
|
||||
<field name="type">form</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Change Auction Date">
|
||||
<group colspan="4" >
|
||||
<label string="Warning, this will erase the object adjudication price and its buyer !" colspan="2"/>
|
||||
<newline/>
|
||||
<field name="auction_id"/>
|
||||
</group>
|
||||
<separator string="" colspan="4" />
|
||||
<group colspan="4" col="6">
|
||||
<button icon="gtk-cancel" special="cancel" string="Cancel"/>
|
||||
<button icon="gtk-redo" string="Move to Auction date" name="auction_move_set" type="object"/>
|
||||
</group>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="action_auction_lots_auction_move" model="ir.actions.act_window">
|
||||
<field name="name">Change Auction Date</field>
|
||||
<field name="res_model">auction.lots.auction.move</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_mode">tree,form</field>
|
||||
<field name="view_id" ref="view_auction_lots_auction_move"/>
|
||||
<field name="target">new</field>
|
||||
<field name="context">{'record_id' : active_id}</field>
|
||||
</record>
|
||||
|
||||
<record id="auction_lots_auction_move_values" model="ir.values">
|
||||
<field name="model_id" ref="auction.model_auction_lots" />
|
||||
<field name="object" eval="1" />
|
||||
<field name="name">Change Auction Date</field>
|
||||
<field name="key2">client_action_multi</field>
|
||||
<field name="value" eval="'ir.actions.act_window,' + str(ref('action_auction_lots_auction_move'))" />
|
||||
<field name="key">action</field>
|
||||
<field name="model">auction.lots</field>
|
||||
</record>
|
||||
|
||||
</data>
|
||||
</openerp>
|
||||
@@ -1,47 +0,0 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
##############################################################################
|
||||
#
|
||||
# OpenERP, Open Source Management Solution
|
||||
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
|
||||
#
|
||||
# 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 <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
##############################################################################
|
||||
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()
|
||||
@@ -1,45 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<openerp>
|
||||
<data>
|
||||
<record id="view_auction_lots_enable" model="ir.ui.view">
|
||||
<field name="name">auction.lots.enable.form</field>
|
||||
<field name="model">auction.lots.enable</field>
|
||||
<field name="type">form</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Confirm">
|
||||
<group colspan="4" >
|
||||
<separator string="Confirmation enable taken away" colspan="4"/>
|
||||
<newline/>
|
||||
</group>
|
||||
<separator string="" colspan="4" />
|
||||
<group colspan="4" col="6">
|
||||
<button icon="gtk-cancel" special="cancel" string="Cancel"/>
|
||||
<button icon="gtk-goto-last" string="Enable Taken away" name="confirm_enable" type="object"/>
|
||||
</group>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="action_auction_lots_enable" model="ir.actions.act_window">
|
||||
<field name="name">Unmark as taken away</field>
|
||||
<field name="res_model">auction.lots.enable</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_mode">tree,form</field>
|
||||
<field name="view_id" ref="view_auction_lots_enable"/>
|
||||
<field name="target">new</field>
|
||||
<field name="context">{'record_id' : active_id}</field>
|
||||
</record>
|
||||
|
||||
<record id="auction_lots_enable_values" model="ir.values">
|
||||
<field name="model_id" ref="auction.model_auction_lots" />
|
||||
<field name="object" eval="1" />
|
||||
<field name="name">Unmark as taken away</field>
|
||||
<field name="key2">client_action_multi</field>
|
||||
<field name="value" eval="'ir.actions.act_window,' + str(ref('action_auction_lots_enable'))" />
|
||||
<field name="key">action</field>
|
||||
<field name="model">auction.lots</field>
|
||||
</record>
|
||||
|
||||
|
||||
</data>
|
||||
</openerp>
|
||||
@@ -1,93 +0,0 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
##############################################################################
|
||||
#
|
||||
# OpenERP, Open Source Management Solution
|
||||
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
|
||||
#
|
||||
# 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 <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
##############################################################################
|
||||
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()
|
||||
@@ -1,109 +0,0 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
##############################################################################
|
||||
#
|
||||
# OpenERP, Open Source Management Solution
|
||||
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
|
||||
#
|
||||
# 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 <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
##############################################################################
|
||||
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()
|
||||
@@ -1,49 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<openerp>
|
||||
<data>
|
||||
<record id="view_auction_lots_make_invoice_buyer" model="ir.ui.view">
|
||||
<field name="name">auction.lots.make.invoice.buyer.form</field>
|
||||
<field name="model">auction.lots.make.invoice.buyer</field>
|
||||
<field name="type">form</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Paid">
|
||||
<group colspan="4" >
|
||||
<field name="amount"/>
|
||||
<field name="objects"/>
|
||||
<field name="number"/>
|
||||
<label string="(Keep empty for automatic number)" colspan="2"/>
|
||||
<field name="buyer_id"/>
|
||||
</group>
|
||||
<separator string="" colspan="4" />
|
||||
<group colspan="4" col="6">
|
||||
<button icon="gtk-cancel" special="cancel" string="Cancel"/>
|
||||
<button icon="gtk-ok" string="Create invoices" name="makeInvoices" type="object"/>
|
||||
</group>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="action_auction_lots_make_invoice_buyer" model="ir.actions.act_window">
|
||||
<field name="name">Invoice Buyer objects</field>
|
||||
<field name="res_model">auction.lots.make.invoice.buyer</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_mode">tree,form</field>
|
||||
<field name="view_id" ref="view_auction_lots_make_invoice_buyer"/>
|
||||
<field name="target">new</field>
|
||||
<field name="context">{'record_id' : active_id}</field>
|
||||
</record>
|
||||
|
||||
<record id="auction_lots_make_invoice_buyer_values" model="ir.values">
|
||||
<field name="model_id" ref="auction.model_auction_lots" />
|
||||
<field name="object" eval="1" />
|
||||
<field name="name">Invoice Buyer objects</field>
|
||||
<field name="key2">client_action_multi</field>
|
||||
<field name="value" eval="'ir.actions.act_window,' + str(ref('action_auction_lots_make_invoice_buyer'))" />
|
||||
<field name="key">action</field>
|
||||
<field name="model">auction.lots</field>
|
||||
</record>
|
||||
|
||||
|
||||
|
||||
</data>
|
||||
</openerp>
|
||||
@@ -1,45 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<openerp>
|
||||
<data>
|
||||
<record id="view_auction_lots_make_invoice" model="ir.ui.view">
|
||||
<field name="name">auction.lots.make.invoice.form</field>
|
||||
<field name="model">auction.lots.make.invoice</field>
|
||||
<field name="type">form</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Paid">
|
||||
<group colspan="4" >
|
||||
<field name="amount"/>
|
||||
<field name="objects"/>
|
||||
<field name="number" colspan="3"/>
|
||||
</group>
|
||||
<separator string="" colspan="4" />
|
||||
<group colspan="4" col="6">
|
||||
<button icon="gtk-cancel" special="cancel" string="Cancel"/>
|
||||
<button icon="gtk-ok" string="Create invoices" name="makeInvoices" type="object"/>
|
||||
</group>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="action_auction_lots_make_invoice" model="ir.actions.act_window">
|
||||
<field name="name">Invoice Seller objects</field>
|
||||
<field name="res_model">auction.lots.make.invoice</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_mode">tree,form</field>
|
||||
<field name="view_id" ref="view_auction_lots_make_invoice"/>
|
||||
<field name="target">new</field>
|
||||
<field name="context">{'record_id' : active_id}</field>
|
||||
</record>
|
||||
|
||||
<record id="auction_lots_make_invoice_values" model="ir.values">
|
||||
<field name="model_id" ref="auction.model_auction_lots" />
|
||||
<field name="object" eval="1" />
|
||||
<field name="name">Invoice Seller objects</field>
|
||||
<field name="key2">client_action_multi</field>
|
||||
<field name="value" eval="'ir.actions.act_window,' + str(ref('action_auction_lots_make_invoice'))" />
|
||||
<field name="key">action</field>
|
||||
<field name="model">auction.lots</field>
|
||||
</record>
|
||||
|
||||
</data>
|
||||
</openerp>
|
||||
@@ -1,67 +0,0 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
##############################################################################
|
||||
#
|
||||
# OpenERP, Open Source Management Solution
|
||||
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
|
||||
#
|
||||
# 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 <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
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:
|
||||
|
||||
@@ -1,49 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<openerp>
|
||||
<data>
|
||||
<record id="view_auction_lots_sms_send" model="ir.ui.view">
|
||||
<field name="name">auction.lots.sms.send.form</field>
|
||||
<field name="model">auction.lots.sms.send</field>
|
||||
<field name="type">form</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="SMS - Gateway: clickatell','Bulk SMS send">
|
||||
<group colspan="4" >
|
||||
<separator string="SMS - Gateway: clickatell','Bulk SMS send" colspan="4"/>
|
||||
<field name="app_id"/>
|
||||
<newline/>
|
||||
<field name="user"/>
|
||||
<field name="password"/>
|
||||
<newline/>
|
||||
<field name="text" colspan="3"/>
|
||||
</group>
|
||||
<separator string="" colspan="4" />
|
||||
<group colspan="4" col="6">
|
||||
<button icon="gtk-cancel" special="cancel" string="Cancel"/>
|
||||
<button icon="gtk-go-back" string="Send SMS" name="sms_send" type="object"/>
|
||||
</group>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="action_auction_lots_sms_send" model="ir.actions.act_window">
|
||||
<field name="name">SMS Send</field>
|
||||
<field name="res_model">auction.lots.sms.send</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_mode">tree,form</field>
|
||||
<field name="view_id" ref="view_auction_lots_sms_send"/>
|
||||
<field name="target">new</field>
|
||||
<field name="context">{'record_id' : active_id}</field>
|
||||
</record>
|
||||
|
||||
<record id="auction_lots_sms_send_values" model="ir.values">
|
||||
<field name="model_id" ref="auction.model_auction_lots" />
|
||||
<field name="object" eval="1" />
|
||||
<field name="name">SMS Send</field>
|
||||
<field name="key2">client_action_multi</field>
|
||||
<field name="value" eval="'ir.actions.act_window,' + str(ref('action_auction_lots_sms_send'))" />
|
||||
<field name="key">action</field>
|
||||
<field name="model">auction.lots</field>
|
||||
</record>
|
||||
|
||||
</data>
|
||||
</openerp>
|
||||
@@ -1,105 +0,0 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
##############################################################################
|
||||
#
|
||||
# OpenERP, Open Source Management Solution
|
||||
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
|
||||
#
|
||||
# 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 <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
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:
|
||||
|
||||
@@ -1,51 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<openerp>
|
||||
<data>
|
||||
<record id="view_auction_pay_buy" model="ir.ui.view">
|
||||
<field name="name">auction.pay.buy.form</field>
|
||||
<field name="model">auction.pay.buy</field>
|
||||
<field name="type">form</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Pay objects">
|
||||
<group colspan="4" >
|
||||
<field name="amount"/>
|
||||
<field name="statement_id1" domain="[('state','=','draft')]"/>
|
||||
<field name="amount2"/>
|
||||
<field name="statement_id2" domain="[('state','=','draft')]"/>
|
||||
<field name="amount3"/>
|
||||
<field name="statement_id3" domain="[('state','=','draft')]"/>
|
||||
<newline/>
|
||||
<field name="buyer_id"/>
|
||||
<field name="total"/>
|
||||
</group>
|
||||
<separator string="" colspan="4" />
|
||||
<group colspan="4" col="6">
|
||||
<button icon="gtk-cancel" special="cancel" string="Cancel"/>
|
||||
<button icon="gtk-yes" string="Pay" name="pay_and_reconcile" type="object"/>
|
||||
</group>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="action_auction_pay_buy" model="ir.actions.act_window">
|
||||
<field name="name">Pay objects of the buyer</field>
|
||||
<field name="res_model">auction.pay.buy</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_mode">tree,form</field>
|
||||
<field name="view_id" ref="view_auction_pay_buy"/>
|
||||
<field name="target">new</field>
|
||||
<field name="context">{'record_id' : active_id}</field>
|
||||
</record>
|
||||
|
||||
<record id="auction_pay_buy_values" model="ir.values">
|
||||
<field name="model_id" ref="auction.model_auction_lots" />
|
||||
<field name="object" eval="1" />
|
||||
<field name="name">Pay objects of the buyer</field>
|
||||
<field name="key2">client_action_multi</field>
|
||||
<field name="value" eval="'ir.actions.act_window,' + str(ref('action_auction_pay_buy'))" />
|
||||
<field name="key">action</field>
|
||||
<field name="model">auction.lots</field>
|
||||
</record>
|
||||
|
||||
</data>
|
||||
</openerp>
|
||||
@@ -1,51 +0,0 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
##############################################################################
|
||||
#
|
||||
# OpenERP, Open Source Management Solution
|
||||
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
|
||||
#
|
||||
# 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 <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
##############################################################################
|
||||
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()
|
||||
@@ -1,35 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<openerp>
|
||||
<data>
|
||||
<record id="view_auction_pay_sel" model="ir.ui.view">
|
||||
<field name="name">auction.pay.sel.form</field>
|
||||
<field name="model">auction.pay.sel</field>
|
||||
<field name="type">form</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Pay invoice">
|
||||
<group colspan="4" >
|
||||
<field name="amount"/>
|
||||
<field name="dest_account_id"/>
|
||||
<field name="journal_id"/>
|
||||
<field name="period_id"/>
|
||||
</group>
|
||||
<separator string="" colspan="4" />
|
||||
<group colspan="4" col="6">
|
||||
<button icon="gtk-cancel" special="cancel" string="Cancel"/>
|
||||
<button icon="gtk-yes" string="Pay" name="pay_and_reconcile" type="object"/>
|
||||
</group>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="action_auction_pay_sel" model="ir.actions.act_window">
|
||||
<field name="name">Pay objects of the seller</field>
|
||||
<field name="res_model">auction.pay.sel</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_mode">tree,form</field>
|
||||
<field name="view_id" ref="view_auction_pay_sel"/>
|
||||
<field name="target">new</field>
|
||||
</record>
|
||||
|
||||
</data>
|
||||
</openerp>
|
||||
@@ -1,55 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<openerp>
|
||||
<data>
|
||||
<record id="view_auction_payer" model="ir.ui.view">
|
||||
<field name="name">auction.payer.form</field>
|
||||
<field name="model">auction.payer</field>
|
||||
<field name="type">form</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Check payment for buyer">
|
||||
<separator string="" colspan="4" />
|
||||
<group colspan="4" col="2">
|
||||
<button icon="gtk-cancel" special="cancel" string="Cancel"/>
|
||||
<button icon = "gtk-yes" string="Pay" name="payer" type="object"/>
|
||||
</group>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="view_auction_payer_sel" model="ir.ui.view">
|
||||
<field name="name">auction.payer.sel.form</field>
|
||||
<field name="model">auction.payer.sel</field>
|
||||
<field name="type">form</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Check payment for seller">
|
||||
<separator string="" colspan="4" />
|
||||
<group colspan="4" col="6">
|
||||
<button icon="gtk-cancel" special="cancel" string="Cancel"/>
|
||||
<button icon="gtk-yes" string="Pay" name="payer_sel" type="object"/>
|
||||
</group>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="action_auction_payer_sel" model="ir.actions.act_window">
|
||||
<field name="name">Mark as paid for seller</field>
|
||||
<field name="res_model">auction.payer.sel</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_mode">tree,form</field>
|
||||
<field name="view_id" ref="view_auction_payer_sel"/>
|
||||
<field name="target">new</field>
|
||||
<field name="context">{'record_id' : active_id}</field>
|
||||
</record>
|
||||
|
||||
<record id="auction_payer_sel_values" model="ir.values">
|
||||
<field name="model_id" ref="auction.model_auction_lots" />
|
||||
<field name="object" eval="1" />
|
||||
<field name="name">Mark as paid for seller</field>
|
||||
<field name="key2">client_action_multi</field>
|
||||
<field name="value" eval="'ir.actions.act_window,' + str(ref('action_auction_payer_sel'))" />
|
||||
<field name="key">action</field>
|
||||
<field name="model">auction.lots</field>
|
||||
</record>
|
||||
|
||||
</data>
|
||||
</openerp>
|
||||
@@ -1,57 +0,0 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
##############################################################################
|
||||
#
|
||||
# OpenERP, Open Source Management Solution
|
||||
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
|
||||
#
|
||||
# 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 <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
##############################################################################
|
||||
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()
|
||||
@@ -1,42 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<openerp>
|
||||
<data>
|
||||
<record id="view_auction_taken" model="ir.ui.view">
|
||||
<field name="name">auction.taken.form</field>
|
||||
<field name="model">auction.taken</field>
|
||||
<field name="type">form</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Mark Lots">
|
||||
<group colspan="4" >
|
||||
<label string="Select lots which are Sold" colspan="4"/>
|
||||
<field name="lot_ids" nolabel="1" colspan="4" domain="[('state','=','sold')]"/>
|
||||
</group>
|
||||
<separator string="" colspan="4" />
|
||||
<group colspan="4" col="6">
|
||||
<button icon="gtk-ok" string="OK" name="process" type="object" />
|
||||
</group>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="action_auction_taken" model="ir.actions.act_window">
|
||||
<field name="name">Gestion emporte</field>
|
||||
<field name="res_model">auction.taken</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_mode">tree,form</field>
|
||||
<field name="view_id" ref="view_auction_taken"/>
|
||||
<field name="target">new</field>
|
||||
</record>
|
||||
|
||||
<!-- <menuitem name="Tools Bar Codes"
|
||||
id="auction_outils_menu"
|
||||
parent="auction_menu_root" sequence="5"
|
||||
/>
|
||||
<menuitem name="Deliveries Management"
|
||||
action="action_auction_taken"
|
||||
id="menu_wizard_emporte"
|
||||
parent="auction_outils_menu"
|
||||
/> -->
|
||||
|
||||
</data>
|
||||
</openerp>
|
||||
+33
-24
@@ -19,34 +19,43 @@
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
import wizard
|
||||
import netsvc
|
||||
from osv import osv, fields
|
||||
import pooler
|
||||
take_form = """<?xml version="1.0"?>
|
||||
<form title="Confirm">
|
||||
<separator string="Confirmation set taken away" colspan="4"/>
|
||||
<newline/>
|
||||
</form>
|
||||
"""
|
||||
|
||||
class make_invoice(osv.osv_memory):
|
||||
_name = 'mrp.repair.make_invoice'
|
||||
_description = 'Make Invoice'
|
||||
|
||||
_columns = {
|
||||
'group': fields.boolean('Group by partner invoice address'),
|
||||
}
|
||||
take_fields = {
|
||||
# 'confirm_en': {'string':'Catalog Number', 'type':'integer'},
|
||||
}
|
||||
|
||||
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'
|
||||
}
|
||||
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')
|
||||
|
||||
make_invoice()
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
||||
+33
-32
@@ -19,42 +19,43 @@
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
from osv import fields, osv
|
||||
from tools.translate import _
|
||||
import wizard
|
||||
import netsvc
|
||||
import pooler
|
||||
import time
|
||||
import tools
|
||||
import wizard
|
||||
#field name="confirm_en"/>
|
||||
|
||||
class auction_payer(osv.osv_memory):
|
||||
take_form = """<?xml version="1.0"?>
|
||||
<form title="Confirm">
|
||||
<separator string="Confirmation enable taken away" colspan="4"/>
|
||||
<newline/>
|
||||
</form>
|
||||
"""
|
||||
|
||||
_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()
|
||||
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')
|
||||
|
||||
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:
|
||||
|
||||
@@ -0,0 +1,111 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
##############################################################################
|
||||
#
|
||||
# OpenERP, Open Source Management Solution
|
||||
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
|
||||
#
|
||||
# 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 <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
import wizard
|
||||
import netsvc
|
||||
import pooler
|
||||
|
||||
invoice_form = '''<?xml version="1.0"?>
|
||||
<form title="Paid ?">
|
||||
<field name="amount"/>
|
||||
<field name="objects"/>
|
||||
<field name="number"/>
|
||||
<label string="(Keep empty for automatic number)" colspan="2"/>
|
||||
<field name="buyer_id"/>
|
||||
</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:
|
||||
|
||||
@@ -0,0 +1,105 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
##############################################################################
|
||||
#
|
||||
# OpenERP, Open Source Management Solution
|
||||
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
|
||||
#
|
||||
# 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 <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
import wizard
|
||||
import netsvc
|
||||
import pooler
|
||||
|
||||
|
||||
|
||||
invoice_form = '''<?xml version="1.0"?>
|
||||
<form title="Paid ?">
|
||||
<field name="amount"/>
|
||||
<field name="objects"/>
|
||||
<field name="number" colspan="3"/>
|
||||
</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:
|
||||
|
||||
@@ -0,0 +1,73 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
##############################################################################
|
||||
#
|
||||
# OpenERP, Open Source Management Solution
|
||||
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
|
||||
#
|
||||
# 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 <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
import wizard
|
||||
import netsvc
|
||||
|
||||
import pooler
|
||||
from tools.misc import UpdateableStr
|
||||
|
||||
|
||||
# Dossier
|
||||
|
||||
_lot_arch = """<?xml version="1.0"?>
|
||||
<form string="Mark Lots" height="500" width="1000">
|
||||
<label string="Select lots which are Sold" colspan="4"/>
|
||||
<field name="lot_ids" nolabel="1" colspan="4" domain="[('state','=','sold')]"/>
|
||||
</form>
|
||||
"""
|
||||
_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:
|
||||
|
||||
@@ -0,0 +1,96 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
##############################################################################
|
||||
#
|
||||
# OpenERP, Open Source Management Solution
|
||||
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
|
||||
#
|
||||
# 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 <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
import wizard
|
||||
import netsvc
|
||||
import pooler
|
||||
import sql_db
|
||||
|
||||
auction_move = '''<?xml version="1.0"?>
|
||||
<form string="Change Auction Date">
|
||||
<group col="1" colspan="2">
|
||||
<label string="Warning, this will erase the object adjudication price and its buyer !" colspan="2"/>
|
||||
</group>
|
||||
<newline/>
|
||||
<field name="auction_id"/>
|
||||
</form>'''
|
||||
|
||||
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:
|
||||
|
||||
@@ -0,0 +1,103 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
##############################################################################
|
||||
#
|
||||
# OpenERP, Open Source Management Solution
|
||||
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
|
||||
#
|
||||
# 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 <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
import wizard
|
||||
import netsvc
|
||||
import netsvc
|
||||
import osv
|
||||
import time
|
||||
import pooler
|
||||
|
||||
invoice_form = '''<?xml version="1.0"?>
|
||||
<form string="Pay invoice">
|
||||
<field name="amount"/>
|
||||
<field name="dest_account_id"/>
|
||||
<field name="journal_id"/>
|
||||
<field name="period_id"/>
|
||||
</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:
|
||||
|
||||
@@ -0,0 +1,150 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
##############################################################################
|
||||
#
|
||||
# OpenERP, Open Source Management Solution
|
||||
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
|
||||
#
|
||||
# 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 <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
import wizard
|
||||
import netsvc
|
||||
|
||||
import urllib
|
||||
|
||||
sms_send_form = '''<?xml version="1.0"?>
|
||||
<form title="%s">
|
||||
<separator string="%s" colspan="4"/>
|
||||
<field name="app_id"/>
|
||||
<newline/>
|
||||
<field name="user"/>
|
||||
<field name="password"/>
|
||||
<newline/>
|
||||
<field name="text" colspan="3"/>
|
||||
</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 <fp@tiny.Be>
|
||||
#
|
||||
# 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 = '''<?xml version="1.0"?>
|
||||
<form string="%s">
|
||||
<separator string="%s" colspan="4"/>
|
||||
<field name="app_id"/>
|
||||
<newline/>
|
||||
<field name="user"/>
|
||||
<field name="password"/>
|
||||
<newline/>
|
||||
<field name="text" colspan="3"/>
|
||||
</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:
|
||||
|
||||
@@ -0,0 +1,109 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
##############################################################################
|
||||
#
|
||||
# OpenERP, Open Source Management Solution
|
||||
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
|
||||
#
|
||||
# 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 <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
import wizard
|
||||
import netsvc
|
||||
import netsvc
|
||||
import osv
|
||||
import time
|
||||
import pooler
|
||||
pay_form = '''<?xml version="1.0"?>
|
||||
<form string="Pay objects">
|
||||
<field name="amount"/>
|
||||
<field name="statement_id1" domain="[('state','=','draft')]"/>
|
||||
<field name="amount2"/>
|
||||
<field name="statement_id2" domain="[('state','=','draft')]"/>
|
||||
<field name="amount3"/>
|
||||
<field name="statement_id3" domain="[('state','=','draft')]"/>
|
||||
<newline/>
|
||||
<field name="buyer_id"/>
|
||||
<field name="total"/>
|
||||
</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:
|
||||
|
||||
@@ -0,0 +1,79 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
##############################################################################
|
||||
#
|
||||
# OpenERP, Open Source Management Solution
|
||||
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
|
||||
#
|
||||
# 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 <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
import wizard
|
||||
import netsvc
|
||||
import netsvc
|
||||
import osv
|
||||
import time
|
||||
import pooler
|
||||
|
||||
pay_form = '''<?xml version="1.0"?>
|
||||
<form string="Check payment for buyer">
|
||||
</form>'''
|
||||
pay_fields = {
|
||||
}
|
||||
|
||||
|
||||
pay_form1 = '''<?xml version="1.0"?>
|
||||
<form string="Check payment for seller">
|
||||
</form>'''
|
||||
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:
|
||||
|
||||
@@ -111,15 +111,19 @@ class base_module_record(osv.osv):
|
||||
return obj.module+'.'+obj.name, obj.noupdate
|
||||
|
||||
def _create_record(self, cr, uid, doc, model, data, record_id, noupdate=False):
|
||||
|
||||
data_pool = self.pool.get('ir.model.data')
|
||||
model_pool = self.pool.get(model)
|
||||
|
||||
record = doc.createElement('record')
|
||||
record.setAttribute("id", record_id)
|
||||
record.setAttribute("model", model)
|
||||
record_list = [record]
|
||||
lids = self.pool.get('ir.model.data').search(cr, uid, [('model','=',model)])
|
||||
res = self.pool.get('ir.model.data').read(cr, uid, lids[:1], ['module'])
|
||||
lids = data_pool.search(cr, uid, [('model','=',model)])
|
||||
res = data_pool.read(cr, uid, lids[:1], ['module'])
|
||||
if res:
|
||||
self.depends[res[0]['module']]=True
|
||||
fields = self.pool.get(model).fields_get(cr, uid)
|
||||
fields = model_pool.fields_get(cr, uid)
|
||||
for key,val in data.items():
|
||||
if not (val or (fields[key]['type']=='boolean')):
|
||||
continue
|
||||
@@ -142,9 +146,11 @@ class base_module_record(osv.osv):
|
||||
id,update = self._get_id(cr, uid, fields[key]['relation'], val)
|
||||
noupdate = noupdate or update
|
||||
if not id:
|
||||
relation_pool = self.pool.get(fields[key]['relation'])
|
||||
|
||||
field.setAttribute("model", fields[key]['relation'])
|
||||
fld_nm = self.pool.get(fields[key]['relation'])._rec_name
|
||||
name = self.pool.get(fields[key]['relation']).read(cr, uid, val,[fld_nm])[fld_nm] or False
|
||||
fld_nm = relation_pool._rec_name
|
||||
name = relation_pool.read(cr, uid, val,[fld_nm])[fld_nm] or False
|
||||
field.setAttribute("search", str([(str(fld_nm) ,'=', name)]))
|
||||
else:
|
||||
field.setAttribute("ref", id)
|
||||
@@ -152,10 +158,10 @@ class base_module_record(osv.osv):
|
||||
elif fields[key]['type'] in ('one2many',):
|
||||
for valitem in (val or []):
|
||||
if valitem[0] in (0,1):
|
||||
if key in self.pool.get(model)._columns:
|
||||
fname = self.pool.get(model)._columns[key]._fields_id
|
||||
if key in model_pool._columns:
|
||||
fname = model_pool._columns[key]._fields_id
|
||||
else:
|
||||
fname = self.pool.get(model)._inherit_fields[key][2]._fields_id
|
||||
fname = model_pool._inherit_fields[key][2]._fields_id
|
||||
valitem[2][fname] = record_id
|
||||
newid,update = self._get_id(cr, uid, fields[key]['relation'], valitem[1])
|
||||
if not newid:
|
||||
@@ -190,14 +196,18 @@ class base_module_record(osv.osv):
|
||||
|
||||
def _create_yaml_record(self, cr, uid, model, data, record_id):
|
||||
record={'model': model, 'id': str(record_id)}
|
||||
lids = self.pool.get('ir.model.data').search(cr, uid, [('model','=',model)])
|
||||
res = self.pool.get('ir.model.data').read(cr, uid, lids[:1], ['module'])
|
||||
|
||||
model_pool = self.pool.get(model)
|
||||
data_pool = self.pool.get('ir.model.data')
|
||||
|
||||
lids = data_pool.search(cr, uid, [('model','=',model)])
|
||||
res = data_pool.read(cr, uid, lids[:1], ['module'])
|
||||
attrs={}
|
||||
if res:
|
||||
self.depends[res[0]['module']]=True
|
||||
fields = self.pool.get(model).fields_get(cr, uid)
|
||||
fields = model_pool.fields_get(cr, uid)
|
||||
defaults={}
|
||||
defaults[model] = self.pool.get(model).default_get(cr, uid, data)
|
||||
defaults[model] = model_pool.default_get(cr, uid, data)
|
||||
for key,val in data.items():
|
||||
if ((key in defaults[model]) and (val == defaults[model][key])) and not(fields[key].get('required',False)):
|
||||
continue
|
||||
@@ -210,19 +220,19 @@ class base_module_record(osv.osv):
|
||||
elif fields[key]['type'] in ('integer','float'):
|
||||
attrs[key] = val
|
||||
elif fields[key]['type'] in ('many2one',):
|
||||
if type(val) in (type(''),type(u'')):
|
||||
if type(val) in (type(''), type(u'')):
|
||||
id = val
|
||||
else:
|
||||
id,update = self._get_id(cr, uid, fields[key]['relation'], val)
|
||||
id, update = self._get_id(cr, uid, fields[key]['relation'], val)
|
||||
attrs[key] = str(id)
|
||||
elif fields[key]['type'] in ('one2many',):
|
||||
items=[[]]
|
||||
for valitem in (val or []):
|
||||
if valitem[0] in (0,1):
|
||||
if key in self.pool.get(model)._columns:
|
||||
fname = self.pool.get(model)._columns[key]._fields_id
|
||||
if key in model_pool._columns:
|
||||
fname = model_pool._columns[key]._fields_id
|
||||
else:
|
||||
fname = self.pool.get(model)._inherit_fields[key][2]._fields_id
|
||||
fname = model_pool._inherit_fields[key][2]._fields_id
|
||||
valitem[2][fname] = record_id
|
||||
newid,update = self._get_id(cr, uid, fields[key]['relation'], valitem[1])
|
||||
if not newid:
|
||||
|
||||
@@ -66,7 +66,7 @@ between mails and Open ERP.""",
|
||||
'wizard/crm_phonecall2phonecall.xml',
|
||||
'wizard/phonecall2meeting.xml',
|
||||
'wizard/phonecall2partner_view.xml',
|
||||
'wizard/phonecall2opportunity.xml',
|
||||
'wizard/crm_phonecall_to_opportunity_view.xml',
|
||||
'wizard/crm_opportunity_to_meeting_view.xml',
|
||||
'wizard/crm_opportunity_to_phonecall_view.xml',
|
||||
'crm_wizard.xml',
|
||||
|
||||
@@ -65,7 +65,7 @@ class crm_lead(osv.osv):
|
||||
_columns = {
|
||||
'categ_id': fields.many2one('crm.case.categ', 'Lead Source', domain="[('section_id','=',section_id),('object_id.model', '=', 'crm.opportunity')]"),
|
||||
'type_id': fields.many2one('crm.case.resource.type', 'Lead Type', domain="[('section_id','=',section_id),('object_id.model', '=', 'crm.lead')]"),
|
||||
'partner_name': fields.char("Lead Name", size=64),
|
||||
'partner_name': fields.char("Contact Name", size=64),
|
||||
|
||||
'priority': fields.selection(crm.AVAILABLE_PRIORITIES, 'Priority'),
|
||||
'date_closed': fields.datetime('Closed', readonly=True),
|
||||
@@ -78,6 +78,7 @@ class crm_lead(osv.osv):
|
||||
method=True, type="integer", store=True),
|
||||
'day_close': fields.function(_compute_closeday, string='Days to Close', \
|
||||
method=True, type="integer", store=True),
|
||||
'function_name' : fields.char('Function', size=64),
|
||||
}
|
||||
|
||||
_defaults = {
|
||||
|
||||
@@ -42,7 +42,7 @@
|
||||
<field name="arch" type="xml">
|
||||
<form string="Leads Form">
|
||||
<group colspan="4" col="7">
|
||||
<field name="partner_name" required="1"/>
|
||||
<field name="name" required="1"/>
|
||||
<field name="priority"/>
|
||||
<field name="date_deadline"/>
|
||||
<button
|
||||
@@ -57,7 +57,6 @@
|
||||
<field name="user_id"/>
|
||||
<field name="stage_id" widget="selection" readonly="1" domain="[('object_id.model', '=', 'crm.lead')]"/>
|
||||
<group col="2" colspan="1">
|
||||
|
||||
<button name="stage_previous" string="Previous" states="open,pending" type="object" icon="gtk-go-back"/>
|
||||
<button name="stage_next" string="Next" states="open,pending" type="object" icon="gtk-go-forward"/>
|
||||
</group>
|
||||
@@ -66,10 +65,10 @@
|
||||
<page string="Lead">
|
||||
<group colspan="2" col="4">
|
||||
<separator string="Contact" colspan="4" col="4"/>
|
||||
<field name="name" string="Contact Name" colspan="4"/>
|
||||
<field name="partner_name" string="Contact Name" colspan="4"/>
|
||||
<newline/>
|
||||
<field domain="[('domain', '=', 'contact')]" name="title"/>
|
||||
<field name="function"/>
|
||||
<field name="function_name" />
|
||||
<field name="street" colspan="4"/>
|
||||
<field name="street2" colspan="4"/>
|
||||
<field name="zip"/>
|
||||
@@ -79,14 +78,14 @@
|
||||
</group>
|
||||
<group colspan="2" col="3">
|
||||
<separator string="Communication" colspan="4" col="3"/>
|
||||
<field name="email_from" widget="email"/>
|
||||
<newline/>
|
||||
<field name="phone"/>
|
||||
<newline/>
|
||||
<field name="fax"/>
|
||||
<newline/>
|
||||
<field name="mobile"/>
|
||||
<newline/>
|
||||
<field name="email_from" widget="email"/>
|
||||
<newline/>
|
||||
<separator string="Links" colspan="4" col="3"/>
|
||||
<field name="partner_id"/>
|
||||
<button
|
||||
|
||||
@@ -56,10 +56,11 @@
|
||||
<form string="Opportunities">
|
||||
<group colspan="4" col="7">
|
||||
<field name="name" string="Opportunity"/>
|
||||
<group colspan="2" col="4">
|
||||
<field name="stage_id" readonly="1" on_change="onchange_stage_id(stage_id)" widget="selection" domain="[('object_id.model', '=', 'crm.opportunity')]"/>
|
||||
<button name="stage_previous" string="Previous" states="open,pending" type="object" icon="gtk-go-back"/>
|
||||
<button name="stage_next" string="Next" states="open,pending" type="object" icon="gtk-go-forward"/>
|
||||
<label string="Stage:" align="1.0"/>
|
||||
<group colspan="1" col="4">
|
||||
<field name="stage_id" nolabel="1" on_change="onchange_stage_id(stage_id)" widget="selection" domain="[('object_id.model', '=', 'crm.opportunity')]"/>
|
||||
<button name="stage_previous" states="open,pending" type="object" icon="gtk-go-back" string=""/>
|
||||
<button name="stage_next" states="open,pending" type="object" icon="gtk-go-forward" string=""/>
|
||||
</group>
|
||||
<field name="user_id"/>
|
||||
<button string="Schedule Meeting"
|
||||
|
||||
@@ -42,7 +42,7 @@ class crm_phonecall(osv.osv):
|
||||
'opportunity_id':fields.many2one ('crm.opportunity', 'Opportunity'),
|
||||
}
|
||||
_defaults = {
|
||||
'date': lambda *a: time.strftime('%Y-%m-%d')
|
||||
'date': lambda *a: time.strftime('%Y-%m-%d %H:%M:%S')
|
||||
}
|
||||
crm_phonecall()
|
||||
|
||||
|
||||
@@ -86,7 +86,7 @@
|
||||
icon="gtk-index" type="action"
|
||||
attrs="{'invisible':[('opportunity_id','!=',False)]}" />
|
||||
<label colspan="6" string=""/>
|
||||
<button string="Schedule Call Other"
|
||||
<button string="Schedule Other Call"
|
||||
icon="gtk-redo"
|
||||
name="%(phonecall_to_phonecall_act)d"
|
||||
type="action" />
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
#!/usr/bin/env python
|
||||
# -*- coding: utf-8 -*-
|
||||
##############################################################################
|
||||
#
|
||||
@@ -29,14 +30,8 @@ import os
|
||||
import binascii
|
||||
import time, socket
|
||||
|
||||
email_re = re.compile(r"""
|
||||
([a-zA-Z][\w\.-]*[a-zA-Z0-9] # username part
|
||||
@ # mandatory @ sign
|
||||
[a-zA-Z0-9][\w\.-]* # domain must start with a letter ... Ged> why do we include a 0-9 then?
|
||||
\.
|
||||
[a-z]{2,3} # TLD
|
||||
)
|
||||
""", re.VERBOSE)
|
||||
|
||||
email_re = re.compile(r"([A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,6})")
|
||||
case_re = re.compile(r"\[([0-9]+)\]", re.UNICODE)
|
||||
command_re = re.compile("^Set-([a-z]+) *: *(.+)$", re.I + re.UNICODE)
|
||||
reference_re = re.compile("<.*-tinycrm-(\\d+)@(.*)>", re.UNICODE)
|
||||
@@ -123,7 +118,7 @@ def html2plaintext(html, body_id=None, encoding='utf-8'):
|
||||
html += '\n\n'
|
||||
html += '[%s] %s\n' % (i+1, url)
|
||||
return html
|
||||
|
||||
|
||||
class rpc_proxy(object):
|
||||
def __init__(self, uid, passwd, host='localhost', port=8069, path='object', dbname='terp'):
|
||||
self.rpc = xmlrpclib.ServerProxy('http://%s:%s/xmlrpc/%s' % (host, port, path))
|
||||
@@ -177,11 +172,7 @@ class email_parser(object):
|
||||
'user_id': False,
|
||||
'description': message['body'],
|
||||
}
|
||||
try:
|
||||
data.update(self.partner_get(self._decode_header(msg['From'])))
|
||||
except Exception, e:
|
||||
import netsvc
|
||||
netsvc.Logger().notifyChannel('mailgate', netsvc.LOG_ERROR, "%s" % e)
|
||||
data.update(self.partner_get(self._decode_header(msg['From'])))
|
||||
|
||||
try:
|
||||
id = self.rpc(self.model, 'create', data)
|
||||
@@ -257,7 +248,6 @@ class email_parser(object):
|
||||
message['attachment'] = attachment
|
||||
#end for
|
||||
return message
|
||||
#end def
|
||||
|
||||
def msg_user(self, msg, id):
|
||||
body = self.msg_body_get(msg)
|
||||
@@ -362,7 +352,7 @@ class email_parser(object):
|
||||
if msg.get('Subject', ''):
|
||||
del msg['Subject']
|
||||
msg['Subject'] = '['+str(case_id)+'] '+subject
|
||||
msg['Message-Id'] = '<'+str(time.time())+'-tinycrm-'+str(case_id)+'@'+socket.gethostname()+'>'
|
||||
msg['Message-Id'] = '<'+str(time.time())+'-openerpcrm-'+str(case_id)+'@'+socket.gethostname()+'>'
|
||||
|
||||
emails = self.rpc(self.model, 'emails_get', case_id)
|
||||
priority = emails[3]
|
||||
@@ -385,9 +375,7 @@ class email_parser(object):
|
||||
|
||||
if __name__ == '__main__':
|
||||
import sys, optparse
|
||||
parser = optparse.OptionParser(
|
||||
usage='usage: %prog [options]',
|
||||
version='%prog v1.0')
|
||||
parser = optparse.OptionParser( usage='usage: %prog [options]', version='%prog v1.0')
|
||||
group = optparse.OptionGroup(parser, "Note",
|
||||
"This program parse a mail from standard input and communicate "
|
||||
"with the Open ERP server for case management in the CRM module.")
|
||||
@@ -407,10 +395,6 @@ if __name__ == '__main__':
|
||||
|
||||
msg_txt = email.message_from_file(sys.stdin)
|
||||
|
||||
try :
|
||||
parser.parse(msg_txt)
|
||||
except Exception, e:
|
||||
if getattr(e, 'faultCode', '') and 'Connection unexpectedly closed' in e.faultCode:
|
||||
print e
|
||||
parser.parse(msg_txt)
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
||||
@@ -34,7 +34,7 @@ import crm_opportunity_to_phonecall
|
||||
import crm_phonecall2phonecall
|
||||
import phonecall2partner
|
||||
import phonecall2meeting
|
||||
import phonecall_to_opportunity
|
||||
import crm_phonecall_to_opportunity
|
||||
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
||||
@@ -65,34 +65,35 @@ class crm_lead2opportunity(osv.osv_memory):
|
||||
id2 = data_obj.browse(cr, uid, id2, context=context).res_id
|
||||
if id3:
|
||||
id3 = data_obj.browse(cr, uid, id3, context=context).res_id
|
||||
|
||||
for this in self.browse(cr, uid, ids, context=context):
|
||||
|
||||
lead = lead_obj.browse(cr, uid, record_id, context=context)
|
||||
new_opportunity_id = opp_obj.create(cr, uid, {
|
||||
'name': this.name,
|
||||
'planned_revenue': this.planned_revenue,
|
||||
'probability': this.probability,
|
||||
'partner_id': lead.partner_id and lead.partner_id.id or False ,
|
||||
'section_id': lead.section_id and lead.section_id.id or False,
|
||||
'description': lead.description or False,
|
||||
'date_deadline': lead.date_deadline or False,
|
||||
'partner_address_id': lead.partner_address_id and \
|
||||
lead.partner_address_id.id or False ,
|
||||
'priority': lead.priority,
|
||||
'phone': lead.phone,
|
||||
'email_from': lead.email_from
|
||||
})
|
||||
|
||||
new_opportunity = opp_obj.browse(cr, uid, new_opportunity_id)
|
||||
vals = {
|
||||
'partner_id': this.partner_id and this.partner_id.id or False,
|
||||
}
|
||||
if not lead.opportunity_id:
|
||||
vals.update({'opportunity_id' : new_opportunity.id})
|
||||
|
||||
lead_obj.write(cr, uid, [lead.id], vals)
|
||||
lead_obj.case_close(cr, uid, [lead.id])
|
||||
opp_obj.case_open(cr, uid, [new_opportunity_id])
|
||||
for this in self.browse(cr, uid, ids, context=context):
|
||||
new_opportunity_id = opp_obj.create(cr, uid, {
|
||||
'name': this.name,
|
||||
'planned_revenue': this.planned_revenue,
|
||||
'probability': this.probability,
|
||||
'partner_id': lead.partner_id and lead.partner_id.id or False ,
|
||||
'section_id': lead.section_id and lead.section_id.id or False,
|
||||
'description': lead.description or False,
|
||||
'date_deadline': lead.date_deadline or False,
|
||||
'partner_address_id': lead.partner_address_id and \
|
||||
lead.partner_address_id.id or False ,
|
||||
'priority': lead.priority,
|
||||
'phone': lead.phone,
|
||||
'email_from': lead.email_from
|
||||
})
|
||||
|
||||
new_opportunity = opp_obj.browse(cr, uid, new_opportunity_id)
|
||||
vals = {
|
||||
'partner_id': this.partner_id and this.partner_id.id or False,
|
||||
}
|
||||
if not lead.opportunity_id:
|
||||
vals.update({'opportunity_id' : new_opportunity.id})
|
||||
|
||||
lead_obj.write(cr, uid, [lead.id], vals)
|
||||
lead_obj.case_close(cr, uid, [lead.id])
|
||||
opp_obj.case_open(cr, uid, [new_opportunity_id])
|
||||
|
||||
value = {
|
||||
'name': _('Opportunity'),
|
||||
|
||||
@@ -68,7 +68,6 @@ class crm_opportunity2meeting(osv.osv_memory):
|
||||
if id3:
|
||||
id3 = data_obj.browse(cr, uid, id3, context=context).res_id
|
||||
|
||||
for this in self.browse(cr, uid, ids, context=context):
|
||||
opp = opp_obj.browse(cr, uid, record_id, context=context)
|
||||
context = {
|
||||
'default_opportunity_id': opp.id,
|
||||
|
||||
@@ -23,6 +23,8 @@ from osv import osv, fields
|
||||
from tools.translate import _
|
||||
|
||||
class crm_opportunity2phonecall(osv.osv_memory):
|
||||
"""Converts Opportunity to Phonecall"""
|
||||
|
||||
_name = 'crm.opportunity2phonecall'
|
||||
_description = 'Opportunity to Phonecall'
|
||||
|
||||
@@ -85,8 +87,11 @@ class crm_opportunity2phonecall(osv.osv_memory):
|
||||
result = mod_obj._get_id(cr, uid, 'crm', 'view_crm_case_phonecalls_filter')
|
||||
res = mod_obj.read(cr, uid, result, ['res_id'])
|
||||
|
||||
# Select the view
|
||||
data_obj = self.pool.get('ir.model.data')
|
||||
categ_id = mod_obj._get_id(cr, uid, 'crm', 'categ_phone1')
|
||||
categ_id = data_obj.browse(cr, uid, categ_id, context=context).res_id
|
||||
|
||||
# Select the view
|
||||
id2 = data_obj._get_id(cr, uid, 'crm', 'crm_case_phone_tree_view')
|
||||
id3 = data_obj._get_id(cr, uid, 'crm', 'crm_case_phone_form_view')
|
||||
if id2:
|
||||
@@ -100,7 +105,7 @@ class crm_opportunity2phonecall(osv.osv_memory):
|
||||
'name' : opp.name,
|
||||
'case_id' : opp.id ,
|
||||
'user_id' : this.user_id and this.user_id.id or False,
|
||||
'categ_id' : opp.categ_id and opp.categ_id.id or False,
|
||||
'categ_id' : categ_id,
|
||||
'description' : opp.description or False,
|
||||
'date' : this.date,
|
||||
'section_id' : opp.section_id and opp.section_id.id or False,
|
||||
|
||||
@@ -1,88 +1,131 @@
|
||||
# -*- encoding: utf-8 -*-
|
||||
############################################################################################
|
||||
# -*- coding: utf-8 -*-
|
||||
##############################################################################
|
||||
#
|
||||
# OpenERP, Open Source Management Solution
|
||||
# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>). All Rights Reserved
|
||||
# Copyright (C) 2008-2009 AJM Technologies S.A. (<http://www.ajm.lu). All Rights Reserved
|
||||
# $Id$
|
||||
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
|
||||
#
|
||||
# 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 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
# 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 General Public License for more details.
|
||||
# GNU Affero General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# You should have received a copy of the GNU Affero General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
############################################################################################
|
||||
############################################################################################
|
||||
##############################################################################
|
||||
|
||||
from osv import osv, fields
|
||||
import netsvc
|
||||
import time
|
||||
import tools
|
||||
import mx.DateTime
|
||||
from tools import config
|
||||
from tools.translate import _
|
||||
import tools
|
||||
|
||||
class crm_phonecall2phonecall(osv.osv_memory):
|
||||
""" Converts Phonecall to Phonecall"""
|
||||
|
||||
_name = 'crm.phonecall2phonecall'
|
||||
_description = 'Phonecall To Phonecall'
|
||||
|
||||
def action_cancel(self, cr, uid, ids, context=None):
|
||||
"""
|
||||
Closes Phonecall to Phonecall form
|
||||
@param self: The object pointer
|
||||
@param cr: the current row, from the database cursor,
|
||||
@param uid: the current user’s ID for security checks,
|
||||
@param ids: List of Phonecall to Phonecall's IDs
|
||||
@param context: A standard dictionary for contextual values
|
||||
"""
|
||||
return {'type':'ir.actions.act_window_close'}
|
||||
|
||||
def action_apply(self, cr, uid, ids, context=None):
|
||||
this = self.browse(cr, uid, ids)[0]
|
||||
values={}
|
||||
record_id = context and context.get('record_id', False) or False
|
||||
"""
|
||||
This converts Phonecall to Phonecall and opens Phonecall view
|
||||
@param self: The object pointer
|
||||
@param cr: the current row, from the database cursor,
|
||||
@param uid: the current user’s ID for security checks,
|
||||
@param ids: List of Phonecall to Phonecall IDs
|
||||
@param context: A standard dictionary for contextual values
|
||||
|
||||
@return : Dictionary value for created Opportunity form
|
||||
"""
|
||||
res = {}
|
||||
record_id = context and context.get('active_id', False) or False
|
||||
phonecall_obj = self.pool.get('crm.phonecall')
|
||||
|
||||
if record_id:
|
||||
for case in self.pool.get('crm.phonecall').browse(cr, uid, [record_id], context=context):
|
||||
values['name']=this.name
|
||||
values['user_id']=this.user_id and this.user_id.id
|
||||
values['categ_id']=case.categ_id and case.categ_id.id or False
|
||||
values['section_id']=case.section_id and case.section_id.id
|
||||
values['description']=case.description or ''
|
||||
values['partner_id']=case.partner_id.id
|
||||
values['partner_address_id']=case.partner_address_id.id
|
||||
values['partner_mobile']=case.partner_mobile or False
|
||||
values['priority']=case.priority
|
||||
values['partner_phone']=case.partner_phone or False
|
||||
values['date']=this.date
|
||||
phonecall_proxy = self.pool.get('crm.phonecall')
|
||||
phonecall_id = phonecall_proxy.create(cr, uid, values, context=context)
|
||||
value = {
|
||||
data_obj = self.pool.get('ir.model.data')
|
||||
|
||||
# Get Phonecall views
|
||||
result = data_obj._get_id(cr, uid, 'crm', 'view_crm_case_phonecalls_filter')
|
||||
res = data_obj.read(cr, uid, result, ['res_id'])
|
||||
id2 = data_obj._get_id(cr, uid, 'crm', 'crm_case_phone_form_view')
|
||||
id3 = data_obj._get_id(cr, uid, 'crm', 'crm_case_phone_tree_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
|
||||
|
||||
phonecall = phonecall_obj.browse(cr, uid, record_id, context=context)
|
||||
|
||||
for this in self.browse(cr, uid, ids, context=context):
|
||||
values = {
|
||||
'name': this.name,
|
||||
'user_id': this.user_id and this.user_id.id,
|
||||
'categ_id': phonecall.categ_id and phonecall.categ_id.id or False,
|
||||
'section_id': phonecall.section_id and phonecall.section_id.id,
|
||||
'description': phonecall.description or '',
|
||||
'partner_id': phonecall.partner_id.id,
|
||||
'partner_address_id': phonecall.partner_address_id.id,
|
||||
'partner_mobile': phonecall.partner_mobile or False,
|
||||
'priority': phonecall.priority,
|
||||
'partner_phone': phonecall.partner_phone or False,
|
||||
'date': this.date
|
||||
}
|
||||
phonecall_id = phonecall_obj.create(cr, uid, values, context=context)
|
||||
print phonecall_id
|
||||
res = {
|
||||
'name': _('Phone Call'),
|
||||
'view_type': 'form',
|
||||
'view_mode': 'form',
|
||||
'res_model': 'crm.phonecall',
|
||||
'view_id': False,
|
||||
'views': [(id2, 'form'), (id3, 'tree'), (False, 'calendar'), (False, 'graph')],
|
||||
'type': 'ir.actions.act_window',
|
||||
'res_id': phonecall_id
|
||||
}
|
||||
return value
|
||||
return res
|
||||
|
||||
_columns = {
|
||||
'name' : fields.char('Call summary', size=64, required=True, select=1),
|
||||
'user_id' : fields.many2one('res.users',"Assign To"),
|
||||
'date': fields.datetime('Date'),
|
||||
'section_id':fields.many2one('crm.case.section','Sales Team'),
|
||||
|
||||
}
|
||||
'name' : fields.char('Call summary', size=64, required=True, select=1),
|
||||
'user_id' : fields.many2one('res.users',"Assign To"),
|
||||
'date': fields.datetime('Date'),
|
||||
'section_id':fields.many2one('crm.case.section','Sales Team'),
|
||||
}
|
||||
|
||||
def default_get(self, cr, uid, fields, context=None):
|
||||
record_id = context and context.get('record_id', False) or False
|
||||
res = super(crm_phonecall2phonecall, self).default_get(cr, uid, fields, context=context)
|
||||
"""
|
||||
This function gets default values
|
||||
@param self: The object pointer
|
||||
@param cr: the current row, from the database cursor,
|
||||
@param uid: the current user’s ID for security checks,
|
||||
@param fields: List of fields for default value
|
||||
@param context: A standard dictionary for contextual values
|
||||
|
||||
@return : default values of fields.
|
||||
"""
|
||||
record_id = context and context.get('active_id', False) or False
|
||||
if record_id:
|
||||
phonecall_id = self.pool.get('crm.phonecall').browse(cr, uid, record_id, context=context)
|
||||
res['name']=phonecall_id.name
|
||||
res['user_id']=phonecall_id.user_id and phonecall_id.user_id.id or False
|
||||
res['date']=phonecall_id.date
|
||||
res['section_id']=phonecall_id.section_id and phonecall_id.section_id.id or False
|
||||
phonecall = self.pool.get('crm.phonecall').browse(cr, uid, record_id, context=context)
|
||||
res = {
|
||||
'name': phonecall.name,
|
||||
'user_id': phonecall.user_id and phonecall.user_id.id or False,
|
||||
'date': phonecall.date,
|
||||
'section_id': phonecall.section_id and phonecall.section_id.id or False
|
||||
}
|
||||
return res
|
||||
crm_phonecall2phonecall()
|
||||
|
||||
crm_phonecall2phonecall()
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
||||
@@ -1,23 +1,31 @@
|
||||
<?xml version="1.0"?>
|
||||
<openerp>
|
||||
<data>
|
||||
|
||||
<!-- Phonecall to Phonecall view -->
|
||||
|
||||
<record model="ir.ui.view" id="phonecall_to_phonecall_view">
|
||||
<field name="name">crm.phonecall2phonecall.form</field>
|
||||
<field name="model">crm.phonecall2phonecall</field>
|
||||
<field name="type">form</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Schedule Other Call" col="2">
|
||||
<form string="Schedule Other Call">
|
||||
<field name="name"/>
|
||||
<field name="user_id" />
|
||||
<field name="date" string="Planned Date"/>
|
||||
<field name="section_id"/>
|
||||
<group colspan="2" col="2" >
|
||||
<separator string=" " colspan="4"/>
|
||||
<group colspan="4" col="3" >
|
||||
<label string=" " />
|
||||
<button name="action_cancel" string="_Cancel" icon="gtk-cancel" special="cancel" />
|
||||
<button name="action_apply" type="object" string="_Apply" icon="gtk-apply" />
|
||||
<button name="action_apply" type="object" string="_Schedule" icon="gtk-go-forward" />
|
||||
</group>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<!-- Phonecall to Phonecall action -->
|
||||
|
||||
<record model="ir.actions.act_window" id="phonecall_to_phonecall_act">
|
||||
<field name="name">Schedule Other Call</field>
|
||||
<field name="res_model">crm.phonecall2phonecall</field>
|
||||
@@ -25,7 +33,7 @@
|
||||
<field name="view_mode">form</field>
|
||||
<field name="view_id" ref="phonecall_to_phonecall_view"/>
|
||||
<field name="target">new</field>
|
||||
<field name="context">{'record_id' : active_id}</field>
|
||||
</record>
|
||||
|
||||
</data>
|
||||
</openerp>
|
||||
@@ -0,0 +1,135 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
##############################################################################
|
||||
#
|
||||
# OpenERP, Open Source Management Solution
|
||||
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
|
||||
#
|
||||
# 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 <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
from osv import osv, fields
|
||||
from tools.translate import _
|
||||
|
||||
class crm_phonecall2opportunity(osv.osv_memory):
|
||||
""" Converts Phonecall to Opportunity"""
|
||||
|
||||
_name = 'crm.phonecall2opportunity'
|
||||
_description = 'Phonecall To Opportunity'
|
||||
|
||||
def action_cancel(self, cr, uid, ids, context=None):
|
||||
"""
|
||||
Closes Phonecall to Opportunity form
|
||||
@param self: The object pointer
|
||||
@param cr: the current row, from the database cursor,
|
||||
@param uid: the current user’s ID for security checks,
|
||||
@param ids: List of Phonecall to Opportunity's IDs
|
||||
@param context: A standard dictionary for contextual values
|
||||
"""
|
||||
|
||||
return {'type':'ir.actions.act_window_close'}
|
||||
|
||||
def action_apply(self, cr, uid, ids, context=None):
|
||||
"""
|
||||
This converts Phonecall to Opportunity and opens Phonecall view
|
||||
@param self: The object pointer
|
||||
@param cr: the current row, from the database cursor,
|
||||
@param uid: the current user’s ID for security checks,
|
||||
@param ids: List of Phonecall to Opportunity IDs
|
||||
@param context: A standard dictionary for contextual values
|
||||
|
||||
@return : Dictionary value for created Opportunity form
|
||||
"""
|
||||
record_id = context and context.get('active_id', False) or False
|
||||
if record_id:
|
||||
opp_obj = self.pool.get('crm.opportunity')
|
||||
phonecall_obj = self.pool.get('crm.phonecall')
|
||||
case = phonecall_obj.browse(cr, uid, record_id, context=context)
|
||||
|
||||
if case.state in ['done', 'cancel']:
|
||||
raise osv.except_osv(_("Warning"), _("Closed/Cancelled Phone \
|
||||
Call Could not convert into Opportunity"))
|
||||
else:
|
||||
data_obj = self.pool.get('ir.model.data')
|
||||
result = data_obj._get_id(cr, uid, 'crm', 'view_crm_case_opportunities_filter')
|
||||
res = data_obj.read(cr, uid, result, ['res_id'])
|
||||
id2 = data_obj._get_id(cr, uid, 'crm', 'crm_case_form_view_oppor')
|
||||
id3 = data_obj._get_id(cr, uid, 'crm', 'crm_case_tree_view_oppor')
|
||||
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
|
||||
|
||||
for this in self.browse(cr, uid, ids, context=context):
|
||||
new_opportunity_id = opp_obj.create(cr, uid, {
|
||||
'name': this.name,
|
||||
'planned_revenue': this.planned_revenue,
|
||||
'probability': this.probability,
|
||||
'partner_id': this.partner_id and this.partner_id.id or False,
|
||||
'section_id': case.section_id and case.section_id.id or False,
|
||||
'description': case.description or False,
|
||||
'phonecall_id': case.id,
|
||||
'priority': case.priority,
|
||||
'phone': case.partner_phone or False,
|
||||
})
|
||||
new_opportunity = opp_obj.browse(cr, uid, new_opportunity_id)
|
||||
vals = {
|
||||
'partner_id': this.partner_id.id,
|
||||
'opportunity_id' : new_opportunity_id,
|
||||
}
|
||||
phonecall_obj.write(cr, uid, [case.id], vals)
|
||||
phonecall_obj.case_close(cr, uid, [case.id])
|
||||
opp_obj.case_open(cr, uid, [new_opportunity_id])
|
||||
|
||||
value = {
|
||||
'name': _('Opportunity'),
|
||||
'view_type': 'form',
|
||||
'view_mode': 'form,tree',
|
||||
'res_model': 'crm.opportunity',
|
||||
'res_id': int(new_opportunity_id),
|
||||
'view_id': False,
|
||||
'views': [(id2, 'form'), (id3, 'tree'), (False, 'calendar'), (False, 'graph')],
|
||||
'type': 'ir.actions.act_window',
|
||||
'search_view_id': res['res_id']
|
||||
}
|
||||
return value
|
||||
|
||||
_columns = {
|
||||
'name' : fields.char('Opportunity Summary', size=64, required=True, select=1),
|
||||
'probability': fields.float('Success Probability'),
|
||||
'planned_revenue': fields.float('Expected Revenue'),
|
||||
'partner_id': fields.many2one('res.partner', 'Partner'),
|
||||
}
|
||||
|
||||
def default_get(self, cr, uid, fields, context=None):
|
||||
"""
|
||||
This function gets default values
|
||||
@param self: The object pointer
|
||||
@param cr: the current row, from the database cursor,
|
||||
@param uid: the current user’s ID for security checks,
|
||||
@param fields: List of fields for default value
|
||||
@param context: A standard dictionary for contextual values
|
||||
|
||||
@return : default values of fields.
|
||||
"""
|
||||
record_id = context and context.get('active_id', False) or False
|
||||
if record_id:
|
||||
phonecall = self.pool.get('crm.phonecall').browse(cr, uid, record_id, context=context)
|
||||
res = {
|
||||
'name': phonecall.name,
|
||||
'partner_id': phonecall.partner_id and phonecall.partner_id.id or False
|
||||
}
|
||||
return res
|
||||
|
||||
crm_phonecall2opportunity()
|
||||
+12
-4
@@ -1,24 +1,32 @@
|
||||
<?xml version="1.0"?>
|
||||
<openerp>
|
||||
<data>
|
||||
|
||||
<!-- Phonecall to Opportunity view -->
|
||||
|
||||
<record model="ir.ui.view" id="phonecall2opportunity_view">
|
||||
<field name="name">crm.phonecall2opportunity.form</field>
|
||||
<field name="model">crm.phonecall2opportunity</field>
|
||||
<field name="type">form</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Convert To Opportunity " col="2">
|
||||
<form string="Convert To Opportunity ">
|
||||
<field name="name"/>
|
||||
<field name="partner_id" />
|
||||
<newline/>
|
||||
<field name="planned_revenue"/>
|
||||
<field name="probability"/>
|
||||
<group colspan="2" col="2" >
|
||||
<separator string=" " colspan="4"/>
|
||||
<group colspan="4" col="3" >
|
||||
<label string=" " />
|
||||
<button name="action_cancel" string="_Cancel" icon="gtk-cancel" special="cancel" />
|
||||
<button name="action_apply" type="object" string="_Apply" icon="gtk-apply" />
|
||||
<button name="action_apply" type="object" string="_Convert" icon="gtk-convert" />
|
||||
</group>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<!-- Phonecall to Opportunity action -->
|
||||
|
||||
<record model="ir.actions.act_window" id="phonecall2opportunity_act">
|
||||
<field name="name">Convert To Opportunity</field>
|
||||
<field name="res_model">crm.phonecall2opportunity</field>
|
||||
@@ -26,7 +34,7 @@
|
||||
<field name="view_mode">form</field>
|
||||
<field name="view_id" ref="phonecall2opportunity_view"/>
|
||||
<field name="target">new</field>
|
||||
<field name="context">{'record_id' : active_id}</field>
|
||||
</record>
|
||||
|
||||
</data>
|
||||
</openerp>
|
||||
@@ -1,107 +0,0 @@
|
||||
# -*- encoding: utf-8 -*-
|
||||
############################################################################################
|
||||
#
|
||||
# OpenERP, Open Source Management Solution
|
||||
# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>). All Rights Reserved
|
||||
# Copyright (C) 2008-2009 AJM Technologies S.A. (<http://www.ajm.lu). All Rights Reserved
|
||||
# $Id$
|
||||
#
|
||||
# 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 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 General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
############################################################################################
|
||||
############################################################################################
|
||||
|
||||
from osv import osv, fields
|
||||
import netsvc
|
||||
import time
|
||||
import tools
|
||||
import mx.DateTime
|
||||
from tools import config
|
||||
from tools.translate import _
|
||||
import tools
|
||||
|
||||
class crm_phonecall2opportunity(osv.osv_memory):
|
||||
_name = 'crm.phonecall2opportunity'
|
||||
_description = 'Phonecall To Opportunity'
|
||||
|
||||
def action_cancel(self, cr, uid, ids, context=None):
|
||||
return {'type':'ir.actions.act_window_close'}
|
||||
|
||||
def action_apply(self, cr, uid, ids, context=None):
|
||||
this = self.browse(cr, uid, ids[0], context=context)
|
||||
record_id = context and context.get('record_id', False) or False
|
||||
if record_id:
|
||||
for case in self.pool.get('crm.phonecall').browse(cr, uid, [record_id], context=context):
|
||||
if case.state in ['done', 'cancel']:
|
||||
raise osv.except_osv(_("Warning"),
|
||||
_("Closed/Cancelled Phone Call Could not convert into Opportunity"))
|
||||
else:
|
||||
data_obj = self.pool.get('ir.model.data')
|
||||
result = data_obj._get_id(cr, uid, 'crm', 'view_crm_case_opportunities_filter')
|
||||
res = data_obj.read(cr, uid, result, ['res_id'])
|
||||
id2 = data_obj._get_id(cr, uid, 'crm', 'crm_case_form_view_oppor')
|
||||
id3 = data_obj._get_id(cr, uid, 'crm', 'crm_case_tree_view_oppor')
|
||||
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
|
||||
opportunity_case_obj = self.pool.get('crm.opportunity')
|
||||
phonecall_case_obj = self.pool.get('crm.phonecall')
|
||||
|
||||
new_opportunity_id = opportunity_case_obj.create(cr, uid, {
|
||||
'name': this.name,
|
||||
'planned_revenue': this.planned_revenue,
|
||||
'probability': this.probability,
|
||||
'partner_id': this.partner_id and this.partner_id.id or False,
|
||||
'section_id': case.section_id and case.section_id.id or False,
|
||||
'description': case.description or False,
|
||||
'phonecall_id': case.id,
|
||||
'priority': case.priority,
|
||||
'phone': case.partner_phone or False,
|
||||
})
|
||||
new_opportunity = opportunity_case_obj.browse(cr, uid, new_opportunity_id)
|
||||
vals = {
|
||||
'partner_id': this.partner_id.id,
|
||||
'opportunity_id' : new_opportunity_id,
|
||||
}
|
||||
phonecall_case_obj.write(cr, uid, [case.id], vals)
|
||||
phonecall_case_obj.case_close(cr, uid, [case.id])
|
||||
phonecall_case_obj.case_open(cr, uid, [new_opportunity_id])
|
||||
value = {
|
||||
'name': _('Opportunity'),
|
||||
'view_type': 'form',
|
||||
'view_mode': 'form,tree',
|
||||
'res_model': 'crm.opportunity',
|
||||
'res_id': int(new_opportunity_id),
|
||||
'view_id': False,
|
||||
'views': [(id2,'form'),(id3,'tree'),(False,'calendar'),(False,'graph')],
|
||||
'type': 'ir.actions.act_window',
|
||||
'search_view_id': res['res_id']
|
||||
}
|
||||
return value
|
||||
_columns = {
|
||||
'name' : fields.char('Opportunity Summary', size=64, required=True, select=1),
|
||||
'probability': fields.float('Success Probability'),
|
||||
'planned_revenue': fields.float('Expected Revenue'),
|
||||
'partner_id': fields.many2one('res.partner', 'Partner'),
|
||||
}
|
||||
def default_get(self, cr, uid, fields, context=None):
|
||||
record_id = context and context.get('record_id', False) or False
|
||||
res = super(crm_phonecall2opportunity, self).default_get(cr, uid, fields, context=context)
|
||||
if record_id:
|
||||
phonecall_id = self.pool.get('crm.phonecall').browse(cr, uid, record_id, context=context)
|
||||
res['name']=phonecall_id.name
|
||||
res['partner_id']=phonecall_id.partner_id and phonecall_id.partner_id.id
|
||||
return res
|
||||
crm_phonecall2opportunity()
|
||||
@@ -74,7 +74,7 @@ def _mass_mail_send(self, cr, uid, data, context):
|
||||
|
||||
case = case_pool.browse(cr,uid,data['ids'])[0]
|
||||
case_pool.write(cr, uid, [case.id], {
|
||||
'som': False,
|
||||
#'som': False,
|
||||
'canal_id': False,
|
||||
})
|
||||
emails = [data['form']['to']] + (data['form']['cc'] or '').split(',')
|
||||
|
||||
@@ -30,7 +30,6 @@
|
||||
'init_xml': ['delivery_data.xml'],
|
||||
'update_xml': [
|
||||
'security/ir.model.access.csv',
|
||||
'wizard/delivery_sale_order_view.xml',
|
||||
'delivery_view.xml',
|
||||
'delivery_wizard.xml',
|
||||
'partner_view.xml'
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
<openerp>
|
||||
<data>
|
||||
|
||||
<!-- <wizard id="wizard_deliver_line_add" keyword="client_action_multi" model="sale.order" name="delivery.sale.order" string="Delivery Costs"/>-->
|
||||
<wizard id="wizard_deliver_line_add" keyword="client_action_multi" model="sale.order" name="delivery.sale.order" string="Delivery Costs"/>
|
||||
|
||||
</data>
|
||||
</openerp>
|
||||
|
||||
@@ -19,69 +19,78 @@
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
from osv import fields, osv
|
||||
from tools.translate import _
|
||||
import time
|
||||
import wizard
|
||||
import ir
|
||||
import pooler
|
||||
from tools.translate import _
|
||||
|
||||
class delivery_sale_order(osv.osv_memory):
|
||||
"""
|
||||
Sale order Delivery.
|
||||
"""
|
||||
def _delivery_default(self, cr, uid, context):
|
||||
"""
|
||||
Get Default value for carrier_id field.
|
||||
"""
|
||||
order_obj = self.pool.get('sale.order')
|
||||
order = order_obj.browse(cr, uid, context['active_ids'])[0]
|
||||
if not order.state in ('draft'):
|
||||
raise osv.except_osv(_('Order not in draft state !'), _('The order state have to be draft to add delivery lines.'))
|
||||
carrier_id = order.partner_id.property_delivery_carrier.id
|
||||
return carrier_id
|
||||
from tools.misc import UpdateableStr
|
||||
|
||||
def delivery_set(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: List of delivery set order’s IDs
|
||||
@return: dictionary {}.
|
||||
"""
|
||||
for data in self.read(cr, uid, ids):
|
||||
order_obj = self.pool.get('sale.order')
|
||||
line_obj = self.pool.get('sale.order.line')
|
||||
order_objs = order_obj.browse(cr, uid, context['active_ids'], context)
|
||||
delivery_form = UpdateableStr()
|
||||
|
||||
for order in order_objs:
|
||||
grid_id = self.pool.get('delivery.carrier').grid_get(cr, uid, [data['carrier_id']], order.partner_shipping_id.id)
|
||||
if not grid_id:
|
||||
raise osv.except_osv(_('No grid avaible !'), _('No grid matching for this carrier !'))
|
||||
grid_obj = self.pool.get('delivery.grid')
|
||||
grid = grid_obj.browse(cr, uid, [grid_id])[0]
|
||||
delivery_fields = {
|
||||
'carrier_id' : {'string':'Delivery Method', 'type':'many2one', 'relation': 'delivery.carrier','required':True}
|
||||
}
|
||||
|
||||
taxes = grid.carrier_id.product_id.taxes_id
|
||||
fpos = order.fiscal_position or False
|
||||
taxes_ids = self.pool.get('account.fiscal.position').map_tax(cr, uid, fpos, taxes)
|
||||
line_obj.create(cr, uid, {
|
||||
'order_id': order.id,
|
||||
'name': grid.carrier_id.name,
|
||||
'product_uom_qty': 1,
|
||||
'product_uom': grid.carrier_id.product_id.uom_id.id,
|
||||
'product_id': grid.carrier_id.product_id.id,
|
||||
'price_unit': grid_obj.get_price(cr, uid, grid.id, order, time.strftime('%Y-%m-%d'), context),
|
||||
'tax_id': [(6,0,taxes_ids)],
|
||||
'type': 'make_to_stock'
|
||||
})
|
||||
return {}
|
||||
def _delivery_default(self, cr, uid, data, context):
|
||||
order_obj = pooler.get_pool(cr.dbname).get('sale.order')
|
||||
order = order_obj.browse(cr, uid, data['ids'])[0]
|
||||
delivery_form.string="""<?xml version="1.0"?>
|
||||
<form string="Create deliveries">
|
||||
<separator colspan="4" string="Delivery Method" />
|
||||
<field name="carrier_id" context="{'order_id': %d}"/>
|
||||
</form>
|
||||
""" % (data['id'],)
|
||||
|
||||
_name = "delivery.sale.order"
|
||||
_description = "Delivery sale order"
|
||||
_columns = {
|
||||
'carrier_id':fields.many2one('delivery.carrier', 'Delivery Method', required=True, ondelete='cascade'),
|
||||
}
|
||||
_defaults = {
|
||||
'carrier_id':_delivery_default
|
||||
}
|
||||
|
||||
delivery_sale_order()
|
||||
|
||||
if not order.state in ('draft'):
|
||||
raise wizard.except_wizard(_('Order not in draft state !'), _('The order state have to be draft to add delivery lines.'))
|
||||
|
||||
|
||||
carrier_id = order.partner_id.property_delivery_carrier.id
|
||||
return {'carrier_id': carrier_id}
|
||||
|
||||
def _delivery_set(self, cr, uid, data, context):
|
||||
order_obj = pooler.get_pool(cr.dbname).get('sale.order')
|
||||
line_obj = pooler.get_pool(cr.dbname).get('sale.order.line')
|
||||
order_objs = order_obj.browse(cr, uid, data['ids'], context)
|
||||
|
||||
for order in order_objs:
|
||||
grid_id = pooler.get_pool(cr.dbname).get('delivery.carrier').grid_get(cr, uid, [data['form']['carrier_id']],order.partner_shipping_id.id)
|
||||
if not grid_id:
|
||||
raise wizard.except_wizard(_('No grid avaible !'), _('No grid matching for this carrier !'))
|
||||
grid_obj=pooler.get_pool(cr.dbname).get('delivery.grid')
|
||||
grid = grid_obj.browse(cr, uid, [grid_id])[0]
|
||||
|
||||
taxes = grid.carrier_id.product_id.taxes_id
|
||||
fpos = order.fiscal_position or False
|
||||
taxes_ids = pooler.get_pool(cr.dbname).get('account.fiscal.position').map_tax(cr, uid, fpos, taxes)
|
||||
line_obj.create(cr, uid, {
|
||||
'order_id': order.id,
|
||||
'name': grid.carrier_id.name,
|
||||
'product_uom_qty': 1,
|
||||
'product_uom': grid.carrier_id.product_id.uom_id.id,
|
||||
'product_id': grid.carrier_id.product_id.id,
|
||||
'price_unit': grid_obj.get_price(cr, uid, grid.id, order, time.strftime('%Y-%m-%d'), context),
|
||||
'tax_id': [(6,0,taxes_ids)],
|
||||
'type': 'make_to_stock'
|
||||
})
|
||||
|
||||
return {}
|
||||
|
||||
class make_delivery(wizard.interface):
|
||||
states = {
|
||||
'init' : {
|
||||
'actions' : [_delivery_default],
|
||||
'result' : {'type' : 'form', 'arch' : delivery_form, 'fields' : delivery_fields, 'state' : [('end', 'Cancel', 'gtk-cancel'),('delivery', 'Add Delivery Costs', 'gtk-ok') ]}
|
||||
},
|
||||
'delivery' : {
|
||||
'actions' : [_delivery_set],
|
||||
'result' : {'type' : 'state', 'state' : 'end'}
|
||||
},
|
||||
}
|
||||
make_delivery("delivery.sale.order")
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
||||
|
||||
@@ -1,38 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<openerp>
|
||||
<data>
|
||||
<record id="view_delivery_sale_order" model="ir.ui.view">
|
||||
<field name="name">delivery.sale.order.form</field>
|
||||
<field name="model">delivery.sale.order</field>
|
||||
<field name="type">form</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Create deliveries">
|
||||
<group colspan="4" >
|
||||
<separator colspan="4" string="Delivery Method" />
|
||||
<field name="carrier_id" />
|
||||
</group>
|
||||
<separator string="" colspan="4" />
|
||||
<group colspan="4" col="6">
|
||||
<button icon="gtk-cancel" special="cancel" string="Cancel"/>
|
||||
<button icon="gtk-ok" name="delivery_set" string="Add Delivery" type="object"/>
|
||||
</group>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="action_delivery_sale_order" model="ir.actions.act_window">
|
||||
<field name="name">Delivery Costs</field>
|
||||
<field name="res_model">delivery.sale.order</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_mode">tree,form</field>
|
||||
<field name="view_id" ref="view_delivery_sale_order"/>
|
||||
<field name="target">new</field>
|
||||
</record>
|
||||
|
||||
<act_window id="action_delivery_sale_order_values"
|
||||
key2="client_action_multi" name="Delivery Costs"
|
||||
res_model="delivery.sale.order" src_model="sale.order"
|
||||
view_mode="form" target="new" view_type="form" />
|
||||
|
||||
</data>
|
||||
</openerp>
|
||||
@@ -45,7 +45,7 @@ class ir_action_report_xml(osv.osv):
|
||||
res[data.get('id')] = False
|
||||
return res
|
||||
|
||||
def _model_search(self, cr, uid, obj, name, args):
|
||||
def _model_search(self, cr, uid, obj, name, args, context={}):
|
||||
if not len(args):
|
||||
return []
|
||||
model_id= args[0][2]
|
||||
|
||||
@@ -215,8 +215,8 @@ class document_directory(osv.osv):
|
||||
path.append(duri[0])
|
||||
duri = duri[1:]
|
||||
did = nid[0]
|
||||
|
||||
return (nodes.node_dir(path, nparent,ncontext,self.browse(cr,uid,did, context)), duri)
|
||||
root_node = did and self.browse(cr,uid,did, context) or False
|
||||
return (nodes.node_dir(path, nparent,ncontext, root_node), duri)
|
||||
|
||||
|
||||
nid = self.search(cr,uid,[('parent_id','=',did),('name','=',duri[0]),('type','=','ressource')], context=context)
|
||||
|
||||
+10
-11
@@ -49,18 +49,17 @@ class node_context(object):
|
||||
context """
|
||||
cached_roots = {}
|
||||
|
||||
def __init__(self, cr, uid, context=None):
|
||||
# we don't cache the cr!
|
||||
def __init__(self, cr, uid, context=None):
|
||||
self.dbname = cr.dbname
|
||||
self.uid = uid
|
||||
self.context = context
|
||||
self._dirobj = pooler.get_pool(cr.dbname).get('document.directory')
|
||||
assert self._dirobj
|
||||
self.rootdir = self._dirobj._get_root_directory(cr,uid,context)
|
||||
self.rootdir = False #self._dirobj._get_root_directory(cr,uid,context)
|
||||
|
||||
def get_uri(self, cr, uri):
|
||||
""" Although this fn passes back to doc.dir, it is needed since
|
||||
it is a potential caching point """
|
||||
it is a potential caching point """
|
||||
(ndir, duri) = self._dirobj._locate_child(cr,self.uid, self.rootdir,uri, None, self)
|
||||
while duri:
|
||||
ndir = ndir.child(cr, duri[0])
|
||||
@@ -168,23 +167,23 @@ class node_dir(node_class):
|
||||
our_type = 'collection'
|
||||
def __init__(self,path, parent, context, dirr, dctx=None):
|
||||
super(node_dir,self).__init__(path, parent,context)
|
||||
self.dir_id = dirr.id
|
||||
self.dir_id = dirr and dirr.id or False
|
||||
#todo: more info from dirr
|
||||
self.mimetype = 'application/x-directory'
|
||||
# 'httpd/unix-directory'
|
||||
self.create_date = dirr.create_date
|
||||
self.domain = dirr.domain
|
||||
self.res_model = dirr.ressource_type_id and dirr.ressource_type_id.model or False
|
||||
self.create_date = dirr and dirr.create_date or False
|
||||
self.domain = dirr and dirr.domain or []
|
||||
self.res_model = dirr and dirr.ressource_type_id and dirr.ressource_type_id.model or False
|
||||
# TODO: the write date should be MAX(file.write)..
|
||||
self.write_date = dirr.write_date or dirr.create_date
|
||||
self.write_date = dirr and (dirr.write_date or dirr.create_date) or False
|
||||
self.content_length = 0
|
||||
if dctx:
|
||||
self.dctx.update(dctx)
|
||||
dc2 = self.context.context
|
||||
dc2.update(self.dctx)
|
||||
dc2['dir_id'] = self.dir_id
|
||||
self.displayname = dirr.name
|
||||
if dirr.dctx_ids:
|
||||
self.displayname = dirr and dirr.name or False
|
||||
if dirr and dirr.dctx_ids:
|
||||
for dfld in dirr.dctx_ids:
|
||||
try:
|
||||
self.dctx['dctx_' + dfld.field] = safe_eval(dfld.expr,dc2)
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
##############################################################################
|
||||
#
|
||||
#
|
||||
# OpenERP, Open Source Management Solution
|
||||
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
|
||||
#
|
||||
@@ -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 <http://www.gnu.org/licenses/>.
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
@@ -43,7 +43,7 @@ def _create_duplicate(self, cr, uid, data, context):
|
||||
event_obj=pooler.get_pool(cr.dbname).get('event.event')
|
||||
project_obj = pooler.get_pool(cr.dbname).get('project.project')
|
||||
duplicate_project_id= project_obj.copy(cr, uid,data['form']['project_id'], {'active': True})
|
||||
project_obj.write(cr, uid, [duplicate_project_id], {'name': "copy of " + project_obj.browse(cr, uid, duplicate_project_id, context).name , 'date_start':time.strftime('%Y-%m-%d'),'date_end': event_obj.browse(cr, uid, [data['id']])[0].date_begin[0:10] })
|
||||
project_obj.write(cr, uid, [duplicate_project_id], {'name': "copy of " + project_obj.browse(cr, uid, duplicate_project_id, context).name , 'date_start':time.strftime('%Y-%m-%d'),'date': event_obj.browse(cr, uid, [data['id']])[0].date_begin[0:10] })
|
||||
event_obj.write(cr, uid, [data['id']], {'project_id': duplicate_project_id })
|
||||
return {}
|
||||
|
||||
|
||||
@@ -26,6 +26,4 @@ import wizard
|
||||
import report
|
||||
import company
|
||||
import schedulers
|
||||
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
||||
@@ -69,9 +69,6 @@
|
||||
'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,
|
||||
|
||||
@@ -1,51 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<openerp>
|
||||
<data>
|
||||
|
||||
<!-- Make Procurement -->
|
||||
|
||||
<record id="view_make_procurment_wizard" model="ir.ui.view">
|
||||
<field name="name">Requisition Request</field>
|
||||
<field name="model">make.procurement</field>
|
||||
<field name="type">form</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Requisition Request">
|
||||
<label string="This wizard will plan the procurement for this product. This procurement may generate task, production orders or purchase orders." colspan="4"/>
|
||||
<field name="product_id" on_change="onchange_product_id(product_id)"/>
|
||||
<field name="qty"/>
|
||||
<field name="uom_id"/>
|
||||
<field name="date_planned"/>
|
||||
<field name="warehouse_id" colspan="4"/>
|
||||
<newline/>
|
||||
<group col="2" colspan="4">
|
||||
<button icon='gtk-cancel' special="cancel"
|
||||
string="Cancel" />
|
||||
<button name="make_procurement" string="Ask New Products"
|
||||
colspan="1" type="object" icon="gtk-ok" />
|
||||
</group>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="action_make_procurement" model="ir.actions.act_window">
|
||||
<field name="name">Requisition Request</field>
|
||||
<field name="type">ir.actions.act_window</field>
|
||||
<field name="res_model">make.procurement</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_mode">form</field>
|
||||
<field name="target">new</field>
|
||||
<field name="context">{'record_id' : active_id}</field>
|
||||
</record>
|
||||
|
||||
<record model="ir.values" id="make_procurement_products">
|
||||
<field name="model_id" ref="product.model_product_product" />
|
||||
<field name="object" eval="1" />
|
||||
<field name="name">Requisition Request</field>
|
||||
<field name="key2">client_action_multi</field>
|
||||
<field name="value" eval="'ir.actions.act_window,' + str(ref('action_make_procurement'))" />
|
||||
<field name="key">action</field>
|
||||
<field name="model">product.product</field>
|
||||
</record>
|
||||
|
||||
</data>
|
||||
</openerp>
|
||||
@@ -8,7 +8,7 @@
|
||||
<menuitem action="wiz_mrp_proc1" id="menu_wiz_mrp_proc1" parent="mrp.mrp_Sched_all" type="wizard"/>
|
||||
-->
|
||||
|
||||
<!-- <wizard id="wiz_mrp_proc2" model="mrp.procurement" string="Compute Stock Minimum Rules Only" name="mrp.procurement.orderpoint.compute"/>-->
|
||||
<wizard id="wiz_mrp_proc2" model="mrp.procurement" string="Compute Stock Minimum Rules Only" name="mrp.procurement.orderpoint.compute"/>
|
||||
<!--
|
||||
<menuitem action="wiz_mrp_proc2" id="menu_wiz_mrp_proc2" parent="mrp.mrp_Sched_all" type="wizard"/>
|
||||
-->
|
||||
@@ -24,12 +24,12 @@
|
||||
<field eval="True" name="object"/>
|
||||
</record>
|
||||
|
||||
<!-- <wizard-->
|
||||
<!-- string="Requisition Request"-->
|
||||
<!-- model="product.product"-->
|
||||
<!-- name="product.product.procurement"-->
|
||||
<!-- keyword="client_action_multi"-->
|
||||
<!-- id="product_procurement_wizard"/>-->
|
||||
<wizard
|
||||
string="Requisition Request"
|
||||
model="product.product"
|
||||
name="product.product.procurement"
|
||||
keyword="client_action_multi"
|
||||
id="product_procurement_wizard"/>
|
||||
|
||||
</data>
|
||||
</openerp>
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user