Example #1
0
from tools.misc import UpdateableStr,UpdateableDict
import time
import operator
from osv import osv, fields
from osv.orm import intersect
import tools.sql
from tools import config
from tools.translate import _
from mx import DateTime
import netsvc

FORM = UpdateableStr()

Fields=UpdateableDict()
Forms=UpdateableStr()
confirm_form=UpdateableStr()
Form_error=UpdateableStr()
Form_error.string='''<form string='Error'>
<label>You must input Job Code and Job Name</label>
</form>'''
confirm_form.string='''<form string="Warning">
    <separator string="Are you sure insert new Sub Job?"/>
    <!--<field name='owner1' invisible="1"/>-->
</form>'''
#confirm_fields={'owner1': {'string': 'Owner', 'type': 'many2one', 'relation': 'res.partner'}}

def _check(self, cr, uid, data, context):
    pool = pooler.get_pool(cr.dbname)
    sale_obj = pool.get('sale.order')
    sale=sale_obj.browse(cr,uid,data['id'],context=context)
    
import psycopg2

import wizard
import pooler
import netsvc
from tools.misc import UpdateableStr, UpdateableDict


_connection_arch = UpdateableStr()

def _test_connection(self,cr,uid,part,context={}):
    lines=pooler.get_pool(cr.dbname).get('olap.fact.database').browse(cr, uid, part['id'],context)
    host = lines.db_host
    port = lines.db_port
    db_name = lines.db_name
    user = lines.db_login
    password = lines.db_password
    type = lines.type
    return_str = "Connection Successful"
    try:	
        if type == 'postgres':
            tdb = psycopg2.connect('host=%s port=%s dbname=%s user=%s password=%s' % (host, port, db_name, user, password))

        elif type == 'mysql':
            import MySQLdb
            tdb = MySQLdb.connect(host = host,port = port, db = db_name, user = user, passwd = password)
                

        elif type == 'oracle':
            import cx_Oracle
            tdb = cx_Oracle.connect(user, password, host)
#    You should have received a copy of the GNU General Public License
#    along with this program.  If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################

import wizard
import pooler
from tools.misc import UpdateableStr

import netsvc
import time

from tools.translate import _
from decimal import Decimal

arch = UpdateableStr()
fields = {}


def _get_journal(self, cr, uid, context):
    pool = pooler.get_pool(cr.dbname)
    obj = pool.get('account.journal')
    c = pool.get('res.users').browse(cr, uid, uid).company_id.id
    ids = obj.search(cr, uid, [('type', '=', 'cash'), ('company_id', '=', c)])
    res = obj.read(cr, uid, ids, ['id', 'name'], context)
    res = [(r['id'], r['name']) for r in res]
    return res


payment_form = """<?xml version="1.0"?>
<form string="Add payment :">
# 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,osv,pooler
from tools.misc import UpdateableStr, UpdateableDict
from tools.translate import _
import netsvc

VAR_FORM = UpdateableStr()
VAR_FIELDS = UpdateableDict()
VAR_FORM.string = u"""<?xml version="1.0"?>
<form string="Incompatible application">
<separator string="The wizard will close immediately" colspan="4"/>
</form>
"""

class wiz_tabs_setup(wizard.interface):

	def _action_idle(self, cr, uid, data, context):
		return { }

	def _action_inits(self, cr, uid, data, context):
		netsvc.Logger().notifyChannel( 'wiz_tabs_setup() called', netsvc.LOG_DEBUG, " Context="+str(context) )
Example #5
0
# 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, osv, pooler
from tools.misc import UpdateableStr, UpdateableDict
from tools.translate import _
import netsvc

VAR_FORM = UpdateableStr()
VAR_FIELDS = UpdateableDict()
VAR_FORM.string = u"""<?xml version="1.0"?>
<form string="Incompatible application">
<separator string="The wizard will close immediately" colspan="4"/>
</form>
"""


class wiz_tabs_setup(wizard.interface):
    def _action_idle(self, cr, uid, data, context):
        return {}

    def _action_inits(self, cr, uid, data, context):
        netsvc.Logger().notifyChannel('wiz_tabs_setup() called',
                                      netsvc.LOG_DEBUG,
#    (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/>.
#
##############################################################################
import pooler
import wizard
import netsvc
from tools.misc import UpdateableStr
_moves_arch = UpdateableStr()
_moves_fields = {}

#reprint_form = '''<?xml version="1.0"?>
#<form title="Paiement du lot">
#   <field name="scan_code" colspan="4"/>
#</form>'''

#reprint_fields = {
#   'scan_code': {'string':u'Code client', 'type':'char', 'required':True},
#   'scan_code': {'string': 'client', 'type': 'many2one', 'relation':'res.partner'},


#}
def start(self, cr, uid, data, context):
    print "ds start" * 10
##############################################################################
import wizard
# import time
# import datetime
import pooler
from tools.translate import _
from tools.misc import UpdateableStr, UpdateableDict

# This code is a dirty hack around the openerp base modules, so that
# a pos print can be carried without interfering with the core ir_actions
# classes. Ideally, the ir.actions.report.postxt should behave like all
# other actions.

_confirm_form = UpdateableStr("""<?xml version="1.0"?>
<form string="%s">
    <label string="%s" colspan="4" />
</form>
""" % (_("Merge Invoices"), _("Do you really want to merge the invoices?")))

# 2go
_select_fields = UpdateableDict({
    'pos_action_ids': {
        'type': 'many2many',
        'string': _('Labels'),
        'required': True,
        'relation': 'ir.actions.report.postxt',
        'domain': []
    },
    'copies': {
        'type':
        'integer',
Example #8
0
def _get_ean_key(string):
    if not string or string == '':
        return '0'
    if len(string) != 12:
        return '0'
    sum = 0
    for i in range(12):
        if _is_pair(i):
            sum += int(string[i])
        else:
            sum += 3 * int(string[i])
    return str(int(math.ceil(sum / 10.0) * 10 - sum))


#FIXME: this is not concurrency safe !!!!
_check_arch = UpdateableStr()
_check_fields = {}


def _check_key(self, cr, uid, data, context):
    partner_table = pooler.get_pool(cr.dbname).get('res.partner')
    partners = partner_table.browse(cr, uid, data['ids'])
    _check_arch_lst = [
        '<?xml version="1.0"?>', '<form string="Check EAN13">',
        '<label string=""/>', '<label string=""/>',
        '<label string="Original" />', '<label string="Computed" />'
    ]
    for partner in partners:
        if partner['ean13'] and len(partner['ean13']) > 11 and len(
                partner['ean13']) < 14:
            _check_arch_lst.append('<label colspan="2" string="%s" />' %
#    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
from tools.misc import UpdateableStr
from osv import osv
from tools.translate import _

FORM = UpdateableStr()

parameter_fields = {
    'segment_id': {
        'string': 'Segment',
        'type': 'many2one',
        'relation': 'dm.campaign.proposition.segment',
        'required': True
    },
    'action_id': {
        'string': 'Action',
        'type': 'many2one',
        'relation': 'dm.offer.step.transition.trigger',
        'required': True,
        'domain': [('type', '=', 'as')]
    },
comp_type_form = '''<?xml version="1.0"?>
    <form string="Select Component Type">
        <field name="compnent_type_id"/>
    </form>'''

comp_type_fields = {
    'compnent_type_id': {
        'string': 'Component Type',
        'type': 'many2one',
        'relation': 'etl.component.type',
        'required': True
    }
}

COMP_FORM = UpdateableStr()
FIELDS = UpdateableDict()


def _add_component(self, cr, uid, data, context):
    pool = pooler.get_pool(cr.dbname)
    job_obj = pool.get('etl.job')
    comp_obj = pool.get('etl.component')
    val = data['form']
    val['type_id'] = val['compnent_type_id']
    del val['compnent_type_id']
    for job in job_obj.browse(cr, uid, data['ids'], context):
        val['job_id'] = job.id
        comp_id = comp_obj.create(cr, uid, data['form'])
    return {}
dossier_fields = {
    'dossier_id': {
        'string': 'Dossier',
        'type': 'many2one',
        'relation': 'huissier.dossier',
        'required': True
    },
}


def _get_value(self, uid, datas, *args, **kwargs):
    return {'partner_id': False}


_lot_arch = UpdateableStr()
_lot_fields = {
    'partner_id': {
        'string': 'Acheteur',
        'relation': 'res.partner',
        'type': 'many2one',
        'required': True
    }
}


def _to_xml(s):
    return s.replace('&', '&amp;').replace('<', '&lt;').replace('>', '&gt;')


_all_lots = []
Example #12
0
##############################################################################
import wizard
# import time
# import datetime
import pooler
from tools.translate import _
from tools.misc import UpdateableStr, UpdateableDict

# This code is a dirty hack around the openerp base modules, so that
# a pos print can be carried without interfering with the core ir_actions
# classes. Ideally, the ir.actions.report.postxt should behave like all
# other actions.

_confirm_form = UpdateableStr("""<?xml version="1.0"?>
<form string="%s">
    <label string="%s" colspan="4" />
</form>
""" % (_("Fusioner Les Factures"), _("Voulez vous fusionner les factures?")))

# 2go
_select_fields = UpdateableDict({
    'pos_action_ids': {
        'type': 'many2many',
        'string': _('Labels'),
        'required': True,
        'relation': 'ir.actions.report.postxt',
        'domain': []
    },
    'copies': {
        'type':
        'integer',
import psycopg2

import wizard
import pooler
import netsvc
from tools.misc import UpdateableStr, UpdateableDict

_connection_arch = UpdateableStr()


def _test_connection(self, cr, uid, part, context={}):
    lines = pooler.get_pool(cr.dbname).get('olap.fact.database').browse(
        cr, uid, part['id'], context)
    host = lines.db_host
    port = lines.db_port
    db_name = lines.db_name
    user = lines.db_login
    password = lines.db_password
    type = lines.type
    return_str = "Connection Successful"
    try:
        if type == 'postgres':
            tdb = psycopg2.connect(
                'host=%s port=%s dbname=%s user=%s password=%s' %
                (host, port, db_name, user, password))

        elif type == 'mysql':
            import MySQLdb
            tdb = MySQLdb.connect(host=host,
                                  port=port,
                                  db=db_name,
Example #14
0
    <field name="server_date"/>
    <separator string="Work done in the last period" colspan="4" />
    <field name="account_id" colspan="2" attrs="{'readonly':[('project_id','!=',False)],'required':[('project_id','==',False)]}"/>
    <field name="project_id" attrs="{'readonly':[('account_id','!=',False)],'required':[('account_id','==',False)]}" domain="[('members','in',[uid]), ('state','=','open')]" />
    <field name="tasks_account" domain="[('project_id.analytic_account_id', '=', account_id),('state','=','open'),%s]" attrs="{'readonly':[('project_id','!=',False)],'required':[('project_id','==',False)]}"/>
    <field name="tasks_project" domain="[('project_id', '=', project_id),('state','=','open'),%s]" attrs="{'readonly':[('account_id','!=',False)],'required':[('account_id','==',False)]}"/>
    <field name="info" colspan="4"/>
    <field name="date" colspan="2"/>
    <label string="(Keep empty for current time)" colspan="2"/>
    <field name="analytic_amount"/>
    <field name="hours_no_work" widget="float_time"/>
    <separator string="Next Task" colspan="4" />
    <field name="tasks_project_next" domain="[('project_id.members', 'in', [uid]),('project_id.state','=','open'),('state','in',['draft','open'])]" colspan="4"/>
</form>'''

so_form = UpdateableStr()

so_fields = {
    'name': {
        'string': "Employee's name",
        'type': 'char',
        'required': True,
        'readonly': True
    },
    'state': {
        'string': "Current state",
        'type': 'char',
        'required': True,
        'readonly': True
    },
    'account_id': {