bzr revid: hmo@tinyerp.com-20100830130448-k0z1zjl1hz6q1e8b
This commit is contained in:
Harry (OpenERP) 2010-08-30 18:34:48 +05:30
commit 2468ab8e0f
39 changed files with 1681 additions and 828 deletions

View File

@ -48,21 +48,28 @@
'module/module_web_view.xml', 'module/module_web_view.xml',
'module/module_data.xml', 'module/module_data.xml',
'module/module_report.xml', 'module/module_report.xml',
'module/wizard/base_module_import_view.xml',
'module/wizard/base_module_update_view.xml',
'module/wizard/base_language_install_view.xml',
'res/res_request_view.xml', 'res/res_request_view.xml',
'res/res_lang_view.xml', 'res/res_lang_view.xml',
'res/res_log_view.xml', 'res/res_log_view.xml',
'res/partner/partner_report.xml', 'res/partner/partner_report.xml',
'res/partner/partner_view.xml', 'res/partner/partner_view.xml',
'res/partner/partner_wizard.xml',
'res/bank_view.xml', 'res/bank_view.xml',
'res/country_view.xml', 'res/country_view.xml',
'res/res_currency_view.xml', 'res/res_currency_view.xml',
'res/partner/crm_view.xml', 'res/partner/crm_view.xml',
'res/partner/wizard/partner_sms_send_view.xml', 'res/partner/wizard/partner_sms_send_view.xml',
'res/partner/wizard/partner_wizard_spam_view.xml',
'res/partner/wizard/partner_clear_ids_view.xml',
'res/partner/wizard/partner_wizard_ean_check_view.xml',
'res/partner/partner_data.xml', 'res/partner/partner_data.xml',
'res/ir_property_view.xml', 'res/ir_property_view.xml',
'security/base_security.xml', 'security/base_security.xml',
'maintenance/maintenance_view.xml', 'maintenance/maintenance_view.xml',
'security/ir.model.access.csv' 'security/ir.model.access.csv'
], ],

View File

@ -79,7 +79,7 @@
<notebook colspan="4"> <notebook colspan="4">
<page string="Current Activity"> <page string="Current Activity">
<field name="company_id" widget="selection" readonly="0" <field name="company_id" widget="selection" readonly="0"
context="{'user_id': self, 'user_preference': 1}"/> context="{'user_id': self, 'user_preference': 1}" groups="base.group_multi_company"/>
<field name="view" readonly="0"/> <field name="view" readonly="0"/>
<label string="" colspan="2"/> <label string="" colspan="2"/>
<field name="menu_tips" colspan="2" readonly="0"/> <field name="menu_tips" colspan="2" readonly="0"/>
@ -116,14 +116,14 @@
<page string="User"> <page string="User">
<field name="address_id" select="1"/> <field name="address_id" select="1"/>
<field name="user_email" widget="email"/> <field name="user_email" widget="email"/>
<field name="company_id" required="1" context="{'user_id': self, 'user_preference': 1}"/> <field name="company_id" required="1" context="{'user_id': self, 'user_preference': 1}" groups="base.group_multi_company"/>
<field name="action_id" required="True"/> <field name="action_id" required="True"/>
<field domain="[('usage','=','menu')]" name="menu_id" required="True"/> <field domain="[('usage','=','menu')]" name="menu_id" required="True"/>
<field name="context_lang"/> <field name="context_lang"/>
<field name="context_tz"/> <field name="context_tz"/>
<field name="view" readonly="0"/> <field name="view" readonly="0"/>
<field name="menu_tips" colspan="2"/> <field name="menu_tips" colspan="2"/>
<label string="" colspan="2"/> <newline/>
<group colspan="2" col="2"> <group colspan="2" col="2">
<separator string="Signature" colspan="2"/> <separator string="Signature" colspan="2"/>
<field colspan="2" name="signature" nolabel="1"/> <field colspan="2" name="signature" nolabel="1"/>
@ -152,7 +152,7 @@
<field name="name"/> <field name="name"/>
<field name="login"/> <field name="login"/>
<field name="address_id" string="Address" /> <field name="address_id" string="Address" />
<field name="company_id"/> <field name="company_id" groups="base.group_multi_company"/>
</tree> </tree>
</field> </field>
</record> </record>
@ -163,10 +163,10 @@
<field name="type">search</field> <field name="type">search</field>
<field name="arch" type="xml"> <field name="arch" type="xml">
<search string="Users"> <search string="Users">
<field name="name" select="1"/> <field name="name"/>
<field name="login" select="1"/> <field name="login"/>
<field name="address_id" select="1" string="Address"/> <field name="address_id" string="Address"/>
<field name="company_ids" select="1" string="Company"/> <field name="company_ids" string="Company"/>
</search> </search>
</field> </field>
</record> </record>

File diff suppressed because it is too large Load Diff

View File

@ -756,6 +756,21 @@ class ir_actions_todo(osv.osv):
'restart': lambda *a: 'always', 'restart': lambda *a: 'always',
} }
_order="sequence,id" _order="sequence,id"
def action_launch(self, cr, uid, ids, context=None):
""" Launch Action of Wizard"""
if context is None:
context = {}
wizard_id = ids and ids[0] or False
wizard = self.browse(cr, uid, wizard_id, context=context)
res = self.pool.get('ir.actions.act_window').read(cr, uid, wizard.action_id.id, ['name', 'view_type', 'view_mode', 'res_model', 'context', 'views', 'type'], context=context)
res.update({'target':'new', 'nodestroy': True})
return res
def action_open(self, cr, uid, ids, context=None):
""" Sets configuration wizard in TODO state"""
return self.write(cr, uid, ids, {'state': 'open'}, context=context)
ir_actions_todo() ir_actions_todo()
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -68,7 +68,7 @@ class ir_model(osv.osv):
'model': fields.char('Object', size=64, required=True, select=1), 'model': fields.char('Object', size=64, required=True, select=1),
'info': fields.text('Information'), 'info': fields.text('Information'),
'field_id': fields.one2many('ir.model.fields', 'model_id', 'Fields', required=True), 'field_id': fields.one2many('ir.model.fields', 'model_id', 'Fields', required=True),
'state': fields.selection([('manual','Custom Object'),('base','Base Object')],'Manually Created',readonly=True), 'state': fields.selection([('manual','Custom Object'),('base','Base Object')],'Type',readonly=True),
'access_ids': fields.one2many('ir.model.access', 'model_id', 'Access'), 'access_ids': fields.one2many('ir.model.access', 'model_id', 'Access'),
'osv_memory': fields.function(_is_osv_memory, method=True, string='In-memory model', type='boolean', 'osv_memory': fields.function(_is_osv_memory, method=True, string='In-memory model', type='boolean',
fnct_search=_search_osv_memory, fnct_search=_search_osv_memory,
@ -256,7 +256,7 @@ class ir_model_fields(osv.osv):
'select_level': fields.selection([('0','Not Searchable'),('1','Always Searchable'),('2','Advanced Search')],'Searchable', required=True), 'select_level': fields.selection([('0','Not Searchable'),('1','Always Searchable'),('2','Advanced Search')],'Searchable', required=True),
'translate': fields.boolean('Translate'), 'translate': fields.boolean('Translate'),
'size': fields.integer('Size'), 'size': fields.integer('Size'),
'state': fields.selection([('manual','Custom Field'),('base','Base Field')],'Manually Created', required=True, readonly=True, select=1), 'state': fields.selection([('manual','Custom Field'),('base','Base Field')],'Type', required=True, readonly=True, select=1),
'on_delete': fields.selection([('cascade','Cascade'),('set null','Set NULL')], 'On delete', help='On delete property for many2one fields'), 'on_delete': fields.selection([('cascade','Cascade'),('set null','Set NULL')], 'On delete', help='On delete property for many2one fields'),
'domain': fields.char('Domain', size=256), 'domain': fields.char('Domain', size=256),
'groups': fields.many2many('res.groups', 'ir_model_fields_group_rel', 'field_id', 'group_id', 'Groups'), 'groups': fields.many2many('res.groups', 'ir_model_fields_group_rel', 'field_id', 'group_id', 'Groups'),

View File

@ -27,8 +27,8 @@ import pooler
class ir_sequence_type(osv.osv): class ir_sequence_type(osv.osv):
_name = 'ir.sequence.type' _name = 'ir.sequence.type'
_columns = { _columns = {
'name': fields.char('Sequence Name',size=64, required=True), 'name': fields.char('Name',size=64, required=True),
'code': fields.char('Sequence Code',size=32, required=True), 'code': fields.char('Code',size=32, required=True),
} }
ir_sequence_type() ir_sequence_type()
@ -39,13 +39,13 @@ def _code_get(self, cr, uid, context={}):
class ir_sequence(osv.osv): class ir_sequence(osv.osv):
_name = 'ir.sequence' _name = 'ir.sequence'
_columns = { _columns = {
'name': fields.char('Sequence Name',size=64, required=True), 'name': fields.char('Name',size=64, required=True),
'code': fields.selection(_code_get, 'Sequence Code',size=64, required=True), 'code': fields.selection(_code_get, 'Code',size=64, required=True),
'active': fields.boolean('Active'), 'active': fields.boolean('Active'),
'prefix': fields.char('Prefix',size=64), 'prefix': fields.char('Prefix',size=64, help="Prefix value of the record for the sequence"),
'suffix': fields.char('Suffix',size=64), 'suffix': fields.char('Suffix',size=64, help="Suffix value of the record for the sequence"),
'number_next': fields.integer('Next Number', required=True), 'number_next': fields.integer('Next Number', required=True, help="Next number of this sequence"),
'number_increment': fields.integer('Increment Number', required=True), 'number_increment': fields.integer('Increment Number', required=True, help="The next number of the sequence will be incremented by this number"),
'padding' : fields.integer('Number padding', required=True, help="OpenERP will automatically adds some '0' on the left of the 'Next Number' to get the required padding size."), 'padding' : fields.integer('Number padding', required=True, help="OpenERP will automatically adds some '0' on the left of the 'Next Number' to get the required padding size."),
'company_id': fields.many2one('res.company', 'Company'), 'company_id': fields.many2one('res.company', 'Company'),
} }

View File

@ -69,7 +69,7 @@ class view(osv.osv):
'inherit_id': fields.many2one('ir.ui.view', 'Inherited View', ondelete='cascade'), 'inherit_id': fields.many2one('ir.ui.view', 'Inherited View', ondelete='cascade'),
'field_parent': fields.char('Child Field',size=64), 'field_parent': fields.char('Child Field',size=64),
'xml_id': fields.function(osv.osv.get_xml_id, type='char', size=128, string="XML ID", 'xml_id': fields.function(osv.osv.get_xml_id, type='char', size=128, string="XML ID",
method=True), method=True, help="ID of the view defined in xml file"),
} }
_defaults = { _defaults = {
'arch': '<?xml version="1.0"?>\n<tree string="My view">\n\t<field name="name"/>\n</tree>', 'arch': '<?xml version="1.0"?>\n<tree string="My view">\n\t<field name="name"/>\n</tree>',

View File

@ -23,18 +23,19 @@ from osv import fields,osv
class wizard_model_menu(osv.osv_memory): class wizard_model_menu(osv.osv_memory):
_name = 'wizard.ir.model.menu.create' _name = 'wizard.ir.model.menu.create'
_columns = { _columns = {
'model_id': fields.many2one('ir.model','Object', required=True),
'menu_id': fields.many2one('ir.ui.menu', 'Parent Menu', required=True), 'menu_id': fields.many2one('ir.ui.menu', 'Parent Menu', required=True),
'name': fields.char('Menu Name', size=64, required=True), 'name': fields.char('Menu Name', size=64, required=True),
} }
_defaults = {
'model_id': lambda self,cr,uid,ctx: ctx.get('model_id', False) def menu_create(self, cr, uid, ids, context=None):
} if not context:
def menu_create(self, cr, uid, ids, context={}): context = {}
model_pool = self.pool.get('ir.model')
for menu in self.browse(cr, uid, ids, context): for menu in self.browse(cr, uid, ids, context):
model = model_pool.browse(cr, uid, context.get('model_id'), context=context)
val = { val = {
'name': menu.name, 'name': menu.name,
'res_model': menu.model_id.model, 'res_model': model.model,
'view_type': 'form', 'view_type': 'form',
'view_mode': 'tree,form' 'view_mode': 'tree,form'
} }

View File

@ -8,14 +8,14 @@
<field name="type">form</field> <field name="type">form</field>
<field name="arch" type="xml"> <field name="arch" type="xml">
<form string="Create Menu"> <form string="Create Menu">
<separator colspan="4" string="Create Menu"/>
<field name="name"/> <field name="name"/>
<field name="menu_id" domain="[('parent_id','&lt;&gt;',False)]"/> <field name="menu_id" domain="[('parent_id','&lt;&gt;',False)]"/>
<field name="model_id"/>
<separator colspan="4" string=""/> <separator colspan="4" string=""/>
<label colspan="2" string=""/> <label colspan="2" string=""/>
<group col="2" colspan="2"> <group col="2" colspan="2">
<button special="cancel" string="Cancel" icon="gtk-cancel"/> <button special="cancel" string="_Close" icon="gtk-cancel"/>
<button name="menu_create" string="Create Menu" type="object" icon="gtk-ok"/> <button name="menu_create" string="Create _Menu" type="object" icon="gtk-ok"/>
</group> </group>
</form> </form>
</field> </field>

View File

@ -146,11 +146,17 @@ class wkf_transition(osv.osv):
_columns = { _columns = {
'trigger_model': fields.char('Trigger Object', size=128), 'trigger_model': fields.char('Trigger Object', size=128),
'trigger_expr_id': fields.char('Trigger Expression', size=128), 'trigger_expr_id': fields.char('Trigger Expression', size=128),
'signal': fields.char('Signal (button Name)', size=64), 'signal': fields.char('Signal (button Name)', size=64,
'role_id': fields.many2one('res.roles', 'Role Required'), help="When the operation of transition comes from a button pressed in the client form, "\
'condition': fields.char('Condition', required=True, size=128), "signal tests the name of the pressed button. If signal is NULL, no button is necessary to validate this transition."),
'act_from': fields.many2one('workflow.activity', 'Source Activity', required=True, select=True, ondelete='cascade'), 'role_id': fields.many2one('res.roles', 'Role Required',
'act_to': fields.many2one('workflow.activity', 'Destination Activity', required=True, select=True, ondelete='cascade'), help="The role that a user must have to validate this transition."),
'condition': fields.char('Condition', required=True, size=128,
help="Expression to be satisfied if we want the transition done."),
'act_from': fields.many2one('workflow.activity', 'Source Activity', required=True, select=True, ondelete='cascade',
help="Source activity. When this activity is over, the condition is tested to determine if we can start the ACT_TO activity."),
'act_to': fields.many2one('workflow.activity', 'Destination Activity', required=True, select=True, ondelete='cascade',
help="The destination activity."),
'wkf_id': fields.related('act_from','wkf_id', type='many2one', relation='workflow', string='Workflow', select=True), 'wkf_id': fields.related('act_from','wkf_id', type='many2one', relation='workflow', string='Workflow', select=True),
} }
_defaults = { _defaults = {

View File

@ -15,8 +15,8 @@
<field name="type">form</field> <field name="type">form</field>
<field name="arch" type="xml"> <field name="arch" type="xml">
<form string="Workflow"> <form string="Workflow">
<field name="name" select="1"/> <field name="name"/>
<field name="osv" select="1"/> <field name="osv"/>
<field name="on_create"/> <field name="on_create"/>
<separator colspan="4" string="Activities"/> <separator colspan="4" string="Activities"/>
<field colspan="4" name="activities" nolabel="1"/> <field colspan="4" name="activities" nolabel="1"/>
@ -24,6 +24,18 @@
</field> </field>
</record> </record>
<record id="view_workflow_search" model="ir.ui.view">
<field name="name">workflow.search</field>
<field name="model">workflow</field>
<field name="type">search</field>
<field name="arch" type="xml">
<search string="Workflow">
<field name="name"/>
<field name="osv"/>
</search>
</field>
</record>
<record id="view_workflow_diagram" model="ir.ui.view"> <record id="view_workflow_diagram" model="ir.ui.view">
<field name="name">workflow.diagram</field> <field name="name">workflow.diagram</field>
<field name="model">workflow</field> <field name="model">workflow</field>
@ -80,40 +92,56 @@
<field name="type">form</field> <field name="type">form</field>
<field name="arch" type="xml"> <field name="arch" type="xml">
<form string="Activity"> <form string="Activity">
<field colspan="4" name="name" select="1"/> <field name="name"/>
<field name="wkf_id" select="1"/> <field name="wkf_id"/>
<field name="kind" select="1"/> <group colspan="4" col="7">
<field name="action_id" select="1" colspan="4"/> <field name="kind" colspan="4"/>
<field name="action" select="1" colspan="4" attrs="{'readonly':[('kind','=','dummy')]}"/> <field name="flow_start"/>
<field name="subflow_id" attrs="{'readonly':[('kind','&lt;&gt;','subflow')]}"/> <field name="flow_stop"/>
<field name="signal_send"/> </group>
<newline/> <notebook colspan="4">
<field name="flow_start"/> <page string="Properties">
<field name="flow_stop"/> <group colspan="4" col="6">
<field name="split_mode"/> <group colspan="1" col="2">
<field name="join_mode"/> <separator string="Subflow" colspan="2"/>
<separator colspan="4" string="Outgoing transitions"/> <field name="subflow_id" attrs="{'readonly':[('kind','&lt;&gt;','subflow')]}"/>
<field colspan="4" name="out_transitions" nolabel="1"> <field name="signal_send"/>
<tree string="Transitions"> </group>
<field name="act_to"/> <group colspan="1" col="2">
<field name="signal"/> <separator string="Conditions" colspan="2"/>
<field name="role_id"/> <field name="split_mode"/>
<field name="condition"/> <field name="join_mode"/>
<field name="trigger_model"/> </group>
<field name="trigger_expr_id"/> <group colspan="1" col="2">
</tree> <separator string="Actions" colspan="2"/>
</field> <field name="action_id"/>
<separator colspan="4" string="Incoming transitions"/> <field name="action" attrs="{'readonly':[('kind','=','dummy')]}"/>
<field colspan="4" name="in_transitions" nolabel="1"> </group>
<tree string="Transitions"> </group>
<field name="act_from"/> </page>
<field name="signal"/> <page string="Transitions">
<field name="role_id"/> <group colspan="4" col="4">
<field name="condition"/> <group col="2" colspan="2">
<field name="trigger_model"/> <field name="in_transitions" nolabel="1" height="400">
<field name="trigger_expr_id"/> <tree string="Incoming Transitions">
</tree> <field name="act_from"/>
</field> <field name="signal"/>
<field name="condition"/>
</tree>
</field>
</group>
<group col="2" colspan="2">
<field name="out_transitions" nolabel="1" height="400">
<tree string="Outgoing Transitions">
<field name="act_to"/>
<field name="signal"/>
<field name="condition"/>
</tree>
</field>
</group>
</group>
</page>
</notebook>
</form> </form>
</field> </field>
</record> </record>
@ -126,19 +154,33 @@
<field name="name"/> <field name="name"/>
<field name="wkf_id"/> <field name="wkf_id"/>
<field name="kind"/> <field name="kind"/>
<field name="action"/>
<field name="action_id"/>
<field name="flow_start"/> <field name="flow_start"/>
<field name="flow_stop"/> <field name="flow_stop"/>
</tree> </tree>
</field> </field>
</record> </record>
<record id="view_workflow_activity_search" model="ir.ui.view">
<field name="name">workflow.activity.search</field>
<field name="model">workflow.activity</field>
<field name="type">search</field>
<field name="arch" type="xml">
<search string="Workflow Activity">
<field name="name"/>
<field name="wkf_id"/>
<field name="kind"/>
<field name="action_id"/>
<field name="action"/>
</search>
</field>
</record>
<record id="action_workflow_activity_form" model="ir.actions.act_window"> <record id="action_workflow_activity_form" model="ir.actions.act_window">
<field name="name">Activities</field> <field name="name">Activities</field>
<field name="res_model">workflow.activity</field> <field name="res_model">workflow.activity</field>
<field name="view_type">form</field> <field name="view_type">form</field>
<field name="view_id" ref="view_workflow_activity_tree"/> <field name="view_id" ref="view_workflow_activity_tree"/>
<field name="search_view_id" ref="view_workflow_activity_search"/>
</record> </record>
<menuitem action="action_workflow_activity_form" id="menu_workflow_activity" parent="base.menu_workflow_root"/> <menuitem action="action_workflow_activity_form" id="menu_workflow_activity" parent="base.menu_workflow_root"/>
@ -155,8 +197,8 @@
<field name="type">form</field> <field name="type">form</field>
<field name="arch" type="xml"> <field name="arch" type="xml">
<form string="Transition"> <form string="Transition">
<field name="act_from" select="1"/> <field name="act_from"/>
<field name="act_to" select="1"/> <field name="act_to"/>
<field colspan="4" name="condition"/> <field colspan="4" name="condition"/>
<field name="signal"/> <field name="signal"/>
<field name="role_id"/> <field name="role_id"/>
@ -174,22 +216,32 @@
<field name="act_from"/> <field name="act_from"/>
<field name="act_to"/> <field name="act_to"/>
<field name="signal"/> <field name="signal"/>
<field name="role_id"/>
<field name="condition"/> <field name="condition"/>
<field name="trigger_model"/>
<field name="trigger_expr_id"/>
</tree> </tree>
</field> </field>
</record> </record>
<record id="view_workflow_transition_search" model="ir.ui.view">
<field name="name">workflow.transition.search</field>
<field name="model">workflow.transition</field>
<field name="type">search</field>
<field name="arch" type="xml">
<search string="Transition">
<field name="act_from"/>
<field name="act_to"/>
<field name="condition"/>
</search>
</field>
</record>
<record id="action_workflow_transition_form" model="ir.actions.act_window"> <record id="action_workflow_transition_form" model="ir.actions.act_window">
<field name="name">Transitions</field> <field name="name">Transitions</field>
<field name="res_model">workflow.transition</field> <field name="res_model">workflow.transition</field>
<field name="view_type">form</field> <field name="view_type">form</field>
<field name="view_id" ref="view_workflow_transition_tree"/> <field name="view_id" ref="view_workflow_transition_tree"/>
</record> <field name="search_view_id" ref="view_workflow_transition_search"/>
<menuitem action="action_workflow_transition_form" id="menu_workflow_transition" parent="base.menu_workflow_root"/> </record>
<menuitem action="action_workflow_transition_form" id="menu_workflow_transition" parent="base.menu_workflow_root"/>
<!-- <!--
================================ ================================
@ -203,11 +255,11 @@
<field name="type">form</field> <field name="type">form</field>
<field name="arch" type="xml"> <field name="arch" type="xml">
<form string="Workflow Instances"> <form string="Workflow Instances">
<field name="wkf_id" select="1"/> <field name="wkf_id" readonly="1"/>
<field name="uid" select="2"/> <field name="uid" readonly="1"/>
<field name="res_id" select="1"/> <field name="res_id" readonly="1"/>
<field name="res_type" select="1"/> <field name="res_type" readonly="1"/>
<field name="state" select="2"/> <field name="state" readonly="1"/>
</form> </form>
</field> </field>
</record> </record>
@ -225,12 +277,27 @@
</tree> </tree>
</field> </field>
</record> </record>
<record id="view_workflow_instance_search" model="ir.ui.view">
<field name="name">workflow.instance.search</field>
<field name="model">workflow.instance</field>
<field name="type">search</field>
<field name="arch" type="xml">
<search string="Workflow Instances">
<field name="wkf_id"/>
<field name="uid"/>
<field name="res_id"/>
<field name="res_type"/>
<field name="state"/>
</search>
</field>
</record>
<record id="action_workflow_instance_form" model="ir.actions.act_window"> <record id="action_workflow_instance_form" model="ir.actions.act_window">
<field name="name">Instances</field> <field name="name">Instances</field>
<field name="res_model">workflow.instance</field> <field name="res_model">workflow.instance</field>
<field name="view_type">form</field> <field name="view_type">form</field>
<field name="view_id" ref="view_workflow_instance_tree"/> <field name="view_id" ref="view_workflow_instance_tree"/>
<field name="search_view_id" ref="view_workflow_instance_search"/>
</record> </record>
<menuitem action="action_workflow_instance_form" id="menu_workflow_instance" parent="base.menu_low_workflow"/> <menuitem action="action_workflow_instance_form" id="menu_workflow_instance" parent="base.menu_low_workflow"/>
@ -246,10 +313,10 @@
<field name="type">form</field> <field name="type">form</field>
<field name="arch" type="xml"> <field name="arch" type="xml">
<form string="Workflow Workitems"> <form string="Workflow Workitems">
<field name="act_id" select="1"/> <field name="act_id" readonly="1"/>
<field name="subflow_id" select="1"/> <field name="subflow_id" readonly="1"/>
<field name="inst_id" select="1"/> <field name="inst_id" readonly="1"/>
<field name="state" select="2"/> <field name="state" readonly="1"/>
</form> </form>
</field> </field>
</record> </record>
@ -266,12 +333,26 @@
</tree> </tree>
</field> </field>
</record> </record>
<record id="view_workflow_workitem_search" model="ir.ui.view">
<field name="name">workflow.workitem.search</field>
<field name="model">workflow.workitem</field>
<field name="type">search</field>
<field name="arch" type="xml">
<search string="Workflow Workitems">
<field name="act_id"/>
<field name="subflow_id"/>
<field name="inst_id"/>
<field name="state"/>
</search>
</field>
</record>
<record id="action_workflow_workitem_form" model="ir.actions.act_window"> <record id="action_workflow_workitem_form" model="ir.actions.act_window">
<field name="name">Workitems</field> <field name="name">Workitems</field>
<field name="res_model">workflow.workitem</field> <field name="res_model">workflow.workitem</field>
<field name="view_type">form</field> <field name="view_type">form</field>
<field name="view_id" ref="view_workflow_workitem_tree"/> <field name="view_id" ref="view_workflow_workitem_tree"/>
<field name="search_view_id" ref="view_workflow_workitem_search"/>
</record> </record>
<menuitem action="action_workflow_workitem_form" id="menu_workflow_workitem" parent="base.menu_low_workflow"/> <menuitem action="action_workflow_workitem_form" id="menu_workflow_workitem" parent="base.menu_low_workflow"/>

View File

@ -23,10 +23,10 @@
<field name="arch" type="xml"> <field name="arch" type="xml">
<form string="Maintenance Contract"> <form string="Maintenance Contract">
<separator string="Information" colspan="4"/> <separator string="Information" colspan="4"/>
<field name="name" select="1" /> <field name="name"/>
<field name="state" /> <newline/>
<field name="date_start" select="1"/> <field name="date_start"/>
<field name="date_stop" select="1"/> <field name="date_stop"/>
<separator string="Covered Modules" colspan="4"/> <separator string="Covered Modules" colspan="4"/>
<field name="module_ids" nolabel="1" colspan="4"> <field name="module_ids" nolabel="1" colspan="4">
<tree string="Covered Modules"> <tree string="Covered Modules">
@ -34,16 +34,43 @@
<field name="version" /> <field name="version" />
</tree> </tree>
</field> </field>
<field name="state" colspan="4"/>
</form> </form>
</field> </field>
</record> </record>
<record id="maintenance_contract_search_view" model="ir.ui.view">
<field name="name">maintenance.contract.search</field>
<field name="model">maintenance.contract</field>
<field name="type">search</field>
<field name="arch" type="xml">
<search string="Maintenance Contract">
<field name="name"/>
<field name="date_start"/>
<field name="date_stop"/>
</search>
</field>
</record>
<record id="maintenance_contract_view_calendar" model="ir.ui.view">
<field name="name">maintenance.contract.calendar</field>
<field name="model">maintenance.contract</field>
<field name="type">calendar</field>
<field name="arch" type="xml">
<calendar string="Maintenance Contract" date_start="date_start" color="state">
<field name="name"/>
<field name="state"/>
</calendar>
</field>
</record>
<record id="action_maintenance_contract_form" model="ir.actions.act_window"> <record id="action_maintenance_contract_form" model="ir.actions.act_window">
<field name="name">Your Maintenance Contracts</field> <field name="name">Maintenance Contracts</field>
<field name="type">ir.actions.act_window</field> <field name="type">ir.actions.act_window</field>
<field name="res_model">maintenance.contract</field> <field name="res_model">maintenance.contract</field>
<field name="view_type">form</field> <field name="view_type">form</field>
<field name="view_mode">tree,form</field> <field name="view_mode">tree,form,calendar</field>
<field name="search_view_id" ref="maintenance_contract_search_view"/>
</record> </record>
<menuitem <menuitem
@ -79,7 +106,7 @@
</group> </group>
</group> </group>
<group colspan="4"> <group colspan="4">
<button type="object" string="_Cancel" icon="gtk-cancel" special="cancel" states="draft"/> <button type="object" string="_Close" icon="gtk-cancel" special="cancel" states="draft"/>
<button type="object" string="_Validate" icon="gtk-apply" name="action_validate" states="draft"/> <button type="object" string="_Validate" icon="gtk-apply" name="action_validate" states="draft"/>
<button type="object" string="_Close" icon="gtk-close" special="cancel" states="validated,unvalidated"/> <button type="object" string="_Close" icon="gtk-close" special="cancel" states="validated,unvalidated"/>
</group> </group>

View File

@ -90,19 +90,26 @@
<field name="name" select="1"/> <field name="name" select="1"/>
<field name="certificate" /> <field name="certificate" />
<field colspan="4" name="shortdesc" select="2"/> <field colspan="4" name="shortdesc" select="2"/>
<field name="category_id"/>
<field name="demo" readonly="1"/>
<notebook colspan="4"> <notebook colspan="4">
<page string="Module"> <page string="Module">
<field colspan="4" name="description" select="2"/> <group colspan="4" col="4">
<field name="installed_version"/> <group colspan="2" col="2">
<field name="latest_version"/> <separator string="Author" colspan="2"/>
<field name="author" select="2"/> <field name="author" select="2"/>
<field name="website" select="2" widget="url"/> <field name="license"/>
<field name="maintainer" attrs="{'invisible': [('maintainer', '=', False)]}"/> <field name="website" select="2" widget="url" string="Author Website"/>
<field name="url" widget="url"/> </group>
<field name="contributors" widget="char" attrs="{'invisible': [('contributors', '=', False)]}"/> <group colspan="2" col="2">
<field name="published_version"/> <separator string="Version" colspan="2"/>
<field name="license"/> <field name="installed_version"/>
<field name="demo" readonly="1"/> <field name="latest_version"/>
<field name="published_version"/>
</group>
</group>
<separator string="Description" colspan="4"/>
<field colspan="4" name="description" select="2" nolabel="1"/>
<newline/> <newline/>
<field name="state" readonly="1" select="1"/> <field name="state" readonly="1" select="1"/>
<group col="6" colspan="2"> <group col="6" colspan="2">

View File

@ -1,30 +1,11 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<openerp> <openerp>
<data> <data>
<record id="wizard_base_module_import" model="ir.actions.wizard">
<field name="name">Import module</field>
<field name="wiz_name">base.module.import</field>
</record>
<menuitem action="wizard_base_module_import" id="menu_wizard_module_import" parent="menu_management" type="wizard"/>
<record id="wizard_update" model="ir.actions.wizard">
<field name="name">Update Modules List</field>
<field name="wiz_name">module.module.update</field>
</record>
<menuitem action="wizard_update" icon="STOCK_CONVERT" id="menu_module_update" parent="menu_management" type="wizard"/>
<wizard id="wizard_upgrade" model="ir.module.module" name="module.upgrade" string="Apply Scheduled Upgrades"/> <wizard id="wizard_upgrade" model="ir.module.module" name="module.upgrade" string="Apply Scheduled Upgrades"/>
<menuitem action="wizard_upgrade" id="menu_wizard_upgrade" parent="menu_management" type="wizard"/> <menuitem action="wizard_upgrade" id="menu_wizard_upgrade" parent="menu_management" type="wizard"/>
<record id="wizard_lang_install" model="ir.actions.wizard">
<field name="name">Load an Official Translation</field>
<field name="wiz_name">module.lang.install</field>
</record>
<menuitem action="wizard_lang_install" id="menu_wizard_lang_install" parent="menu_translation" type="wizard"/>
<record id="wizard_lang_export" model="ir.ui.view"> <record id="wizard_lang_export" model="ir.ui.view">
<field name="name">Export a Translation File</field> <field name="name">Export a Translation File</field>
<field name="model">wizard.module.lang.export</field> <field name="model">wizard.module.lang.export</field>
@ -33,11 +14,11 @@
<form col="3" string="Export language"> <form col="3" string="Export language">
<notebook> <notebook>
<page string="Export Data"> <page string="Export Data">
<group col="2" fill="0" states="choose"> <group col="2" colspan="4" fill="0" states="choose">
<separator colspan="2" string="Export translation file"/> <separator colspan="2" string="Export translation file"/>
<field name="lang" width="300"/> <field name="lang" required="1"/>
<field name="format" required="1"/> <field name="format" required="1"/>
<field height="200" name="modules" width="500"/> <field height="200" name="modules" nolabel="1" colspan="4"/>
<field invisible="1" name="state"/> <field invisible="1" name="state"/>
</group> </group>
<group col="1" fill="0" states="get"> <group col="1" fill="0" states="get">
@ -56,7 +37,7 @@
</notebook> </notebook>
<group col="2" colspan="3" fill="0"> <group col="2" colspan="3" fill="0">
<button icon="gtk-cancel" name="act_cancel" special="cancel" states="choose" string="Cancel" type="object"/> <button icon="gtk-cancel" name="act_cancel" special="cancel" states="choose" string="Close" type="object"/>
<button icon="gtk-ok" name="act_getfile" states="choose" string="Get file" type="object"/> <button icon="gtk-ok" name="act_getfile" states="choose" string="Get file" type="object"/>
<button icon="gtk-close" name="act_destroy" special="cancel" states="get" string="Close" type="object"/> <button icon="gtk-close" name="act_destroy" special="cancel" states="get" string="Close" type="object"/>
</group> </group>
@ -86,14 +67,11 @@
<field name="type">form</field> <field name="type">form</field>
<field name="arch" type="xml"> <field name="arch" type="xml">
<form col="3" string="Update Translations"> <form col="3" string="Update Translations">
<image name="gtk-dialog-info"/> <field name="lang"/>
<group col="2" fill="0" height="500">
<field name="lang" width="300"/>
</group>
<label align="0.0" colspan="4" string="This wizard will detect new terms in the application so that you can update them manually."/> <label align="0.0" colspan="4" string="This wizard will detect new terms in the application so that you can update them manually."/>
<separator colspan="4"/> <separator colspan="4"/>
<group col="2" colspan="4" fill="0"> <group col="2" colspan="4" fill="0">
<button icon="gtk-cancel" name="act_cancel" special="cancel" string="Cancel" type="object"/> <button icon="gtk-cancel" name="act_cancel" special="cancel" string="Close" type="object"/>
<button icon="gtk-ok" name="act_update" string="Update" type="object"/> <button icon="gtk-ok" name="act_update" string="Update" type="object"/>
</group> </group>
</form> </form>

View File

@ -1,6 +1,6 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
############################################################################## ##############################################################################
# #
# OpenERP, Open Source Management Solution # OpenERP, Open Source Management Solution
# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>). # Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>).
# #
@ -15,19 +15,20 @@
# GNU Affero General Public License for more details. # GNU Affero General Public License for more details.
# #
# You should have received a copy of the GNU Affero 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/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
# #
############################################################################## ##############################################################################
import wizard_update_module
import wizard_module_upgrade import wizard_module_upgrade
import wizard_configuration import wizard_configuration
import wizard_module_lang_install
import add_new import add_new
import wizard_export_lang import wizard_export_lang
import wizard_import_lang import wizard_import_lang
import wizard_module_import
import wizard_update_translations import wizard_update_translations
import base_module_import
import base_module_update
import base_language_install
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -0,0 +1,69 @@
# -*- 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 tools
import pooler
from osv import osv, fields
class base_language_install(osv.osv_memory):
""" Install Language"""
_name = "base.language.install"
_description = "Install Language"
_columns = {
'lang': fields.selection(tools.scan_languages(),'Language'),
}
def lang_install(self, cr, uid, ids, context):
language_obj = self.browse(cr, uid, ids)[0]
lang = language_obj.lang
if lang:
modobj = self.pool.get('ir.module.module')
mids = modobj.search(cr, uid, [('state', '=', 'installed')])
modobj.update_translations(cr, uid, mids, lang)
data_obj = self.pool.get('ir.model.data')
id2 = data_obj._get_id(cr, uid, 'base', 'view_base_language_install_msg')
if id2:
id2 = data_obj.browse(cr, uid, id2, context=context).res_id
return {
'view_type': 'form',
'view_mode': 'form',
'res_model': 'base.module.import.msg',
'views': [(id2, 'form')],
'view_id': False,
'type': 'ir.actions.act_window',
'target': 'new',
}
base_language_install()
class base_language_install_msg(osv.osv_memory):
""" Install Language"""
_name = "base.language.install.msg"
_description = "Install Language"
base_language_install_msg()
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -0,0 +1,66 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<record id="view_base_language_install" model="ir.ui.view">
<field name="name">Install Language</field>
<field name="model">base.language.install</field>
<field name="type">form</field>
<field name="arch" type="xml">
<form string="System Upgrade">
<group colspan="2" col="4">
<separator string="System Upgrade" colspan="6"/>
<newline/>
<label align="0.0" string="Choose a language to install:" colspan="4"/>
<field name="lang" colspan="4"/>
<label align="0.0" string="Note that this operation may take a few minutes." colspan="4"/>
<separator string="" colspan="6"/>
<button special="cancel" string="Close" icon="gtk-cancel"/>
<button name="lang_install" string="Start installation" type="object" icon="gtk-ok"/>
</group>
</form>
</field>
</record>
<record id="action_view_base_language_install" model="ir.actions.act_window">
<field name="name">Install Language</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">base.language.install</field>
<field name="view_type">form</field>
<field name="view_mode">form</field>
<field name="target">new</field>
</record>
<menuitem
name="Load an Official Translation"
action="action_view_base_language_install"
id="menu_view_base_language_install"
parent="menu_translation"/>
<record id="view_base_language_install_msg" model="ir.ui.view">
<field name="name">Install Language Message</field>
<field name="model">base.module.import.msg</field>
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Language file loaded.">
<group colspan="2" col="4">
<separator string="Installation Done" colspan="4"/>
<label align="0.0" string="The selected language has been successfully installed.\nYou must change the preferences of the user and open a new menu to view changes." colspan="4"/>
<separator string="" colspan="4"/>
<button special="cancel" string="OK" icon="gtk-ok"/>
</group>
</form>
</field>
</record>
<record id="action_view_base_language_install_msg" model="ir.actions.act_window">
<field name="name">Install Language Message</field>
<field name="res_model">base.module.import.msg</field>
<field name="view_type">form</field>
<field name="view_mode">form</field>
<field name="view_id" ref="view_base_language_install"/>
<field name="target">new</field>
</record>
</data>
</openerp>

View File

@ -0,0 +1,116 @@
# -*- 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 pooler
import os
import tools
import zipfile
from StringIO import StringIO
import base64
from tools.translate import _
from osv import osv, fields
class base_module_import(osv.osv_memory):
""" Import Module """
_name = "base.module.import"
_description = "Import Module"
_columns = {
'module_file': fields.binary('Module .ZIP file', required=True),
}
def importzip(self, cr, uid, ids, context):
module_obj= self.pool.get('ir.module.module')
active_ids = context and context.get('active_ids', False)
data = self.browse(cr, uid, ids , context=context)[0]
module_data = data.module_file
val =base64.decodestring(module_data)
fp = StringIO()
fp.write(val)
fdata = zipfile.ZipFile(fp, 'r')
fname = fdata.namelist()[0]
module_name = os.path.split(fname)[0]
ad = tools.config['addons_path']
fname = os.path.join(ad,module_name+'.zip')
try:
fp = file(fname, 'wb')
fp.write(val)
fp.close()
except IOError, e:
raise osv.except_osv(_('Error !'), _('Can not create the module file: %s !') % (fname,) )
module_obj.update_list(cr, uid,{'module_name': module_name,})
data_obj = self.pool.get('ir.model.data')
id2 = data_obj._get_id(cr, uid, 'base', 'view_base_module_import_msg')
if id2:
id2 = data_obj.browse(cr, uid, id2, context=context).res_id
module_name = module_obj.browse(cr, uid, ids, context=context)
return {
'domain': str([('name', '=', module_name)]),
'name': 'Message',
'view_type': 'form',
'view_mode': 'form',
'res_model': 'base.module.import.msg',
'views': [(id2, 'form')],
'view_id': False,
'type': 'ir.actions.act_window',
'target': 'new',
}
base_module_import()
class base_module_import_msg(osv.osv_memory):
""" message """
_name = "base.module.import.msg"
_description = "Message"
def action_module_open(self, cr, uid, ids, context):
module_obj = self.pool.get('base.module.import')
data = module_obj.browse(cr, uid, ids , context=context)[0]
module_data = data.module_file
val =base64.decodestring(module_data)
fp = StringIO()
fp.write(val)
fdata = zipfile.ZipFile(fp, 'r')
fname = fdata.namelist()[0]
module_name = os.path.split(fname)[0]
return {
'domain': str([('name', '=', module_name)]),
'name': 'Module List',
'view_type': 'form',
'view_mode': 'tree,form',
'res_model': 'ir.module.module',
'type': 'ir.actions.act_window',
}
base_module_import_msg()
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -0,0 +1,66 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<record id="view_base_module_import" model="ir.ui.view">
<field name="name">Module Import</field>
<field name="model">base.module.import</field>
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Module import">
<separator string="Module Import" colspan="4"/>
<label string="Please give your module .ZIP file to import." colspan="4"/>
<field name="module_file"/>
<separator string="" colspan="4" />
<newline/>
<group colspan="6" >
<button special="cancel" string="Close" icon="gtk-cancel"/>
<button name="importzip" string="Import module" type="object" icon="gtk-ok"/>
</group>
</form>
</field>
</record>
<record id="action_view_base_module_import" model="ir.actions.act_window">
<field name="name">Module Import</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">base.module.import</field>
<field name="view_type">form</field>
<field name="view_mode">form</field>
<field name="target">new</field>
</record>
<menuitem
name="Import Module"
action="action_view_base_module_import"
id="menu_view_base_module_import"
parent="menu_management"
sequence="1"/>
<record id="view_base_module_import_msg" model="ir.ui.view">
<field name="name">Module Import Message</field>
<field name="model">base.module.import.msg</field>
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Message">
<label string="Module successfully imported !"/>
<separator string="" colspan="4"/>
<newline/>
<group>
<button name="action_module_open" string="Close" type="object" icon="gtk-cancel"/>
</group>
</form>
</field>
</record>
<record id="action_view_base_module_import_msg" model="ir.actions.act_window">
<field name="name">Module Import Message</field>
<field name="res_model">base.module.import.msg</field>
<field name="view_type">form</field>
<field name="view_mode">form</field>
<field name="view_id" ref="view_base_module_import"/>
<field name="target">new</field>
</record>
</data>
</openerp>

View File

@ -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 netsvc
import pooler
from osv import osv, fields
class base_module_update(osv.osv_memory):
""" Update Module """
_name = "base.module.update"
_description = "Update Module"
def update_module(self, cr, uid, ids, context):
"""
Update Module
@param cr: the current row, from the database cursor.
@param uid: the current users ID for security checks.
@param ids: the ID or list of IDs
@param context: A standard dictionary
"""
data_obj = self.pool.get('ir.model.data')
id2 = data_obj._get_id(cr, uid, 'base', 'view_base_module_update_open')
if id2:
id2 = data_obj.browse(cr, uid, id2, context=context).res_id
return {
'view_type': 'form',
'view_mode': 'form',
'res_model': 'base.module.update.open',
'views': [(id2, 'form')],
'view_id': False,
'type': 'ir.actions.act_window',
'target': 'new',
}
base_module_update()
class base_module_update_open(osv.osv_memory):
""" Update Module Open """
_name = "base.module.update.open"
_description = "Update Module Open"
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 users 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.
"""
module_obj = self.pool.get('ir.module.module')
update, add = module_obj.update_list(cr, uid,)
return {'update': update, 'add': add}
_columns = {
'update': fields.integer('Number of modules updated', readonly=True),
'add': fields.integer('Number of modules added', readonly=True),
}
def action_module_open(self, cr, uid, ids, context):
"""
Update Module List Open
@param cr: the current row, from the database cursor.
@param uid: the current users ID for security checks.
@param ids: the ID or list of IDs
@param context: A standard dictionary
"""
res = {
'domain': str([]),
'name': 'Module List',
'view_type': 'form',
'view_mode': 'tree,form',
'res_model': 'ir.module.module',
'view_id': False,
'type': 'ir.actions.act_window',
}
view_obj = self.pool.get('ir.ui.view')
search_view_id = view_obj.search(cr, uid, [('name','=','ir.module.module.list.select')], context=context)
if search_view_id:
res.update({'search_view_id' : search_view_id[0]})
return res
base_module_update_open()
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -0,0 +1,68 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<record id="view_base_module_update" model="ir.ui.view">
<field name="name">Module Update</field>
<field name="model">base.module.update</field>
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Scan for new modules">
<label string="This function will check for new modules in the 'addons' path" colspan="4" align="0.0"/>
<separator string="" colspan="4" />
<newline/>
<group colspan="6" >
<button special="cancel" string="Close" icon="gtk-cancel"/>
<button name="update_module" string="Check new modules" type="object" icon="gtk-ok"/>
</group>
</form>
</field>
</record>
<record id="action_view_base_module_update" model="ir.actions.act_window">
<field name="name">Module Update</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">base.module.update</field>
<field name="view_type">form</field>
<field name="view_mode">form</field>
<field name="target">new</field>
</record>
<menuitem
name=" Update Modules List"
action="action_view_base_module_update"
id="menu_view_base_module_update"
parent="menu_management"
sequence="2"
icon="STOCK_CONVERT"/>
<record id="view_base_module_update_open" model="ir.ui.view">
<field name="name">Update ModuleList</field>
<field name="model">base.module.update.open</field>
<field name="type">form</field>
<field name="arch" type="xml">
<form string="New modules">
<field name="update" colspan="4"/>
<field name="add" colspan="4"/>
<separator string="" colspan="4" />
<newline/>
<group colspan="6" >
<button special="cancel" string="Close" icon="gtk-cancel"/>
<button name="action_module_open" string="OK" type="object" icon="gtk-ok"/>
</group>
</form>
</field>
</record>
<record id="action_view_base_module_update_open" model="ir.actions.act_window">
<field name="name">Update ModuleList</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">base.module.update.open</field>
<field name="view_type">form</field>
<field name="view_mode">form</field>
<field name="view_id" ref="view_base_module_update"/>
<field name="target">new</field>
</record>
</data>
</openerp>

View File

@ -27,18 +27,23 @@ from tempfile import TemporaryFile
view_form="""<?xml version="1.0"?> view_form="""<?xml version="1.0"?>
<form string="Import language"> <form string="Import language">
<image name="gtk-dialog-info" colspan="2"/> <notebook colspan="4">
<group colspan="2" col="4"> <page string="Import Data">
<separator string="Import New Language" colspan="4"/> <group colspan="2" col="4">
<field name="name" width="200"/> <separator string="Import New Language" colspan="4"/>
<field name="code"/> <field name="name" width="200"/>
<field name="data" colspan="4"/> <field name="code"/>
<label string="You have to import a .CSV file which is encoded in UTF-8.\n <field name="data" colspan="4"/>
Please check that the first line of your file is one of the following:" colspan="4" align="0.0"/> </group>
<label string="type,name,res_id,src,value" colspan="4"/> </page>
<label string="module,type,name,res_id,src,value" colspan="4"/> <page string="Help">
<label string="You can also import .po files." colspan="4" align="0.0"/> <label string="You have to import a .CSV file which is encoded in UTF-8.\n
</group> Please check that the first line of your file is one of the following:" colspan="4" align="0.0"/>
<label string="type,name,res_id,src,value" colspan="4"/>
<label string="module,type,name,res_id,src,value" colspan="4"/>
<label string="You can also import .po files." colspan="4" align="0.0"/>
</page>
</notebook>
</form>""" </form>"""
fields_form={ fields_form={
@ -69,7 +74,7 @@ class wizard_import_lang(wizard.interface):
'actions': [], 'actions': [],
'result': {'type': 'form', 'arch': view_form, 'fields': fields_form, 'result': {'type': 'form', 'arch': view_form, 'fields': fields_form,
'state':[ 'state':[
('end', 'Cancel', 'gtk-cancel'), ('end', 'Close', 'gtk-cancel'),
('finish', 'Ok', 'gtk-ok', True) ('finish', 'Ok', 'gtk-ok', True)
] ]
} }

View File

@ -1,118 +0,0 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2009 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
import os
import tools
import zipfile
from StringIO import StringIO
import base64
from tools.translate import _
finish_form ='''<?xml version="1.0"?>
<form string="Module import">
<label string="Module successfully imported !" colspan="4"/>
</form>
'''
ask_form ='''<?xml version="1.0"?>
<form string="Module import">
<separator string="Module Import" colspan="4"/>
<label string="Please give your module .ZIP file to import." colspan="4"/>
<field name="module_file"/>
</form>
'''
ask_fields = {
'module_file': {'string': 'Module .ZIP file', 'type': 'binary', 'required': True},
}
class move_module_wizard(wizard.interface):
def importzip(self, cr, uid, data, context):
module_obj=pooler.get_pool(cr.dbname).get('ir.module.module')
module_data = data['form']['module_file']
val =base64.decodestring(module_data)
fp = StringIO()
fp.write(val)
fdata = zipfile.ZipFile(fp, 'r')
fname = fdata.namelist()[0]
module_name = os.path.split(fname)[0]
ad = tools.config['addons_path']
fname = os.path.join(ad,module_name+'.zip')
try:
fp = file(fname, 'wb')
fp.write(val)
fp.close()
except IOError, e:
raise wizard.except_wizard(_('Error !'), _('Can not create the module file: %s !') % (fname,) )
pooler.get_pool(cr.dbname).get('ir.module.module').update_list(cr, uid)
return {'module_name': module_name}
def _action_module_open(self, cr, uid, data, context):
return {
'domain': str([('name', '=', data['form']['module_name'])]),
'name': 'Module List',
'view_type': 'form',
'view_mode': 'tree,form',
'res_model': 'ir.module.module',
'view_id': False,
'type': 'ir.actions.act_window'
}
states = {
'init': {
'actions': [],
'result': {
'type': 'form',
'arch': ask_form,
'fields': ask_fields,
'state': [
('end', 'Cancel', 'gtk-cancel'),
('import', 'Import module', 'gtk-ok', True)
]
}
},
'import': {
'actions': [importzip],
'result': {
'type':'form',
'arch':finish_form,
'fields':{},
'state':[('open_window','Close')]
}
},
'open_window': {
'actions': [],
'result': {'type': 'action', 'action': _action_module_open, 'state':'end'}
},
}
move_module_wizard('base.module.import')
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -1,84 +0,0 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2009 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 tools
import pooler
view_form_end = """<?xml version="1.0"?>
<form string="Language file loaded.">
<image name="gtk-dialog-info" colspan="2"/>
<group colspan="2" col="4">
<separator string="Installation Done" colspan="4"/>
<label align="0.0" string="The selected language has been successfully installed.\nYou must change the preferences of the user and open a new menu to view changes." colspan="4"/>
</group>
</form>"""
view_form = """<?xml version="1.0"?>
<form string="System Upgrade">
<image name="gtk-dialog-info" colspan="2"/>
<group colspan="2" col="4">
<separator string="System Upgrade" colspan="4"/>
<label align="0.0" string="Choose a language to install:" colspan="4"/>
<field name="lang" colspan="4" required="1"/>
<label align="0.0" string="Note that this operation may take a few minutes." colspan="4"/>
</group>
</form>"""
class wizard_lang_install(wizard.interface):
def _lang_install(self, cr, uid, data, context):
lang = data['form']['lang']
if lang:
modobj = pooler.get_pool(cr.dbname).get('ir.module.module')
mids = modobj.search(cr, uid, [('state', '=', 'installed')])
modobj.update_translations(cr, uid, mids, lang)
return {}
fields_form = {
'lang': {'string':'Language', 'type':'selection', 'selection':tools.scan_languages(),
},
}
states = {
'init': {
'actions': [],
'result': {'type': 'form', 'arch': view_form, 'fields': fields_form,
'state': [
('end', 'Cancel', 'gtk-cancel'),
('start', 'Start installation', 'gtk-ok', True)
]
}
},
'start': {
'actions': [_lang_install],
'result': {'type': 'form', 'arch': view_form_end, 'fields': {},
'state': [
('end', 'Ok', 'gtk-ok', True)
]
}
},
}
wizard_lang_install('module.lang.install')
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -1,96 +0,0 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2009 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
class wizard_update_module(wizard.interface):
arch = '''<?xml version="1.0"?>
<form string="Scan for new modules">
<label string="This function will check for new modules in the 'addons' path" colspan="4" align="0.0"/>
</form>'''
fields = {
}
arch_module = '''<?xml version="1.0"?>
<form string="New modules">
<field name="update" colspan="4"/>
<field name="add" colspan="4"/>
</form>'''
fields_module = {
'update': {'type': 'integer', 'string': 'Number of modules updated', 'readonly': True},
'add': {'type': 'integer', 'string': 'Number of modules added', 'readonly': True},
}
def _update_module(self, cr, uid, data, context):
update, add = pooler.get_pool(cr.dbname).get('ir.module.module').update_list(cr, uid)
return {'update': update, 'add': add}
def _action_module_open(self, cr, uid, data, context):
res = {
'domain': str([]),
'name': 'Module List',
'view_type': 'form',
'view_mode': 'tree,form',
'res_model': 'ir.module.module',
'view_id': False,
'type': 'ir.actions.act_window'
}
search_view_id = pooler.get_pool(cr.dbname).get('ir.ui.view').search(cr, uid, [('name','=','ir.module.module.list.select')], context=context)
if search_view_id:
res.update({'search_view_id' : search_view_id[0]})
return res
states = {
'init': {
'actions': [],
'result': {'type': 'form', 'arch': arch, 'fields': fields,
'state': [
('end', 'Cancel', 'gtk-cancel'),
('update', 'Check new modules', 'gtk-ok', True)
]
}
},
'update': {
'actions': [_update_module],
'result': {'type': 'form', 'arch': arch_module, 'fields': fields_module,
'state': [
('open_window', 'Ok', 'gtk-ok', True)
]
}
},
'open_window': {
'actions': [],
'result': {'type': 'action', 'action': _action_module_open, 'state':'end'}
}
}
wizard_update_module('module.module.update')
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -28,6 +28,7 @@
<separator colspan="4" string="Property"/> <separator colspan="4" string="Property"/>
<field name="name" select="1"/> <field name="name" select="1"/>
<field name="company_id" select="1" groups="base.group_multi_company"/> <field name="company_id" select="1" groups="base.group_multi_company"/>
<separator colspan="4" string="Field Information"/>
<field colspan="4" name="fields_id" select="1"/> <field colspan="4" name="fields_id" select="1"/>
<field colspan="4" name="type"/> <field colspan="4" name="type"/>
<group colspan="4" attrs="{'invisible' : [('type', 'not in', ('integer', 'integer_big', 'boolean'))]}"> <group colspan="4" attrs="{'invisible' : [('type', 'not in', ('integer', 'integer_big', 'boolean'))]}">
@ -48,6 +49,7 @@
<group colspan="4" attrs="{'invisible' : [('type', '!=', 'binary')]}"> <group colspan="4" attrs="{'invisible' : [('type', '!=', 'binary')]}">
<field colspan="4" name="value_binary" /> <field colspan="4" name="value_binary" />
</group> </group>
<separator colspan="4" string="Resource"/>
<field colspan="4" name="res_id" groups="base.group_extended"/> <field colspan="4" name="res_id" groups="base.group_extended"/>
</form> </form>
</field> </field>

View File

@ -1,7 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<wizard id="res_partner_mass_mailing_wizard" model="res.partner" name="res.partner.spam_send" string="Mass Mailing"/>
</data>
</openerp>

View File

@ -19,10 +19,10 @@
# #
############################################################################## ##############################################################################
import wizard_spam
import wizard_clear_ids
import wizard_ean_check
import partner_sms_send import partner_sms_send
import partner_wizard_spam
import partner_clear_ids
import partner_wizard_ean_check
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -1,8 +1,8 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
############################################################################## ##############################################################################
# #
# OpenERP, Open Source Management Solution # OpenERP, Open Source Management Solution
# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>). # Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
# #
# This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as # it under the terms of the GNU Affero General Public License as
@ -15,26 +15,38 @@
# GNU Affero General Public License for more details. # GNU Affero General Public License for more details.
# #
# You should have received a copy of the GNU Affero 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/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
# #
############################################################################## ##############################################################################
import wizard
import netsvc import netsvc
from osv import fields, osv
class wizard_clear_ids(wizard.interface): class partner_clear_ids(osv.osv_memory):
def _clear_ids(self, cr, uid, data, context): """ Clear IDs """
service = netsvc.LocalService("object_proxy")
service.execute(cr.dbname, uid, 'res.partner', 'write', data['ids'], {'ref': False}) _name = "partner.clear.ids"
return {} _description = "Clear IDs"
states = { def clear_ids(self, cr, uid, ids, context):
'init': { """
'actions': [_clear_ids], Clear Ids
'result': {'type':'state', 'state':'end'}
} @param cr: the current row, from the database cursor.
} @param uid: the current users ID for security checks.
wizard_clear_ids('res.partner.clear_ids') @param ids: the ID or list of IDs
@param context: A standard dictionary
"""
partner_pool = self.pool.get('res.partner')
active_ids = context and context.get('active_ids', [])
res = {}
for partner in partner_pool.browse(cr, uid, active_ids, context=context):
if active_ids in partner:
res.update({'ref': False})
return res
partner_clear_ids()
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -0,0 +1,32 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<record id="view_partner_clear_ids" model="ir.ui.view">
<field name="name">Clear IDs</field>
<field name="model">partner.clear.ids</field>
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Clear Ids">
<label string="Want to Clear Ids ? "/>
<separator string="" colspan="6" />
<label string="" colspan="2"/>
<group>
<button special="cancel" string="Cancel" icon="gtk-cancel" />
<button name="clear_ids" string="Clear IDs" type="object" icon="gtk-ok"/>
</group>
</form>
</field>
</record>
<record id="action_view_partner_clear_ids" model="ir.actions.act_window">
<field name="name">Clear IDs</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">partner.clear.ids</field>
<field name="view_type">form</field>
<field name="view_mode">form</field>
<field name="target">new</field>
</record>
</data>
</openerp>

View File

@ -0,0 +1,77 @@
# -*- 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 math
from osv import osv
from tools.misc import UpdateableStr
import pooler
class partner_wizard_ean_check(osv.osv_memory):
""" Ean check """
_name = "partner.wizard.ean.check"
_description = "Ean Check"
def is_pair(x):
return not x%2
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 = sum + int(string[i])
else:
sum = sum + 3*int(string[i])
return str(int(math.ceil(sum/10.0)*10-sum))
def default_get(self, cr, fields, context):
partner_table = self.pool.get('res.partner')
ids = context.get('active_ids')
partners = partner_table.browse(cr, uid, 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" />' % partner['ean13']);
key = get_ean_key(partner['ean13'][:12])
_check_arch_lst.append('<label string=""/>')
if len(partner['ean13'])==12:
_check_arch_lst.append('<label string="" />');
else:
_check_arch_lst.append('<label string="%s" />' % partner['ean13'][12])
_check_arch_lst.append('<label string="%s" />' % key)
_check_arch_lst.append('</form>')
_check_arch.string = '\n'.join(_check_arch_lst)
def update_ean(self, cr, uid, ids, context):
partner_table = self.pool.get('res.partner')
ids = context.get('active_ids')
partners = partner_table.browse(cr, uid, ids)
for partner in partners:
partner_table.write(cr, uid, ids, {
'ean13': "%s%s" % (partner['ean13'][:12], get_ean_key(partner['ean13'][:12]))
})
return {}
partner_wizard_ean_check()

View File

@ -0,0 +1,32 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<record id="view_partner_wizard_ean_check" model="ir.ui.view">
<field name="name">Ean check</field>
<field name="model">partner.wizard.ean.check</field>
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Ean check">
<separator string="" colspan="4"/>
<label string="Want to check Ean ? "/>
<separator string="" colspan="6" />
<label string="" colspan="2"/>
<group>
<button special="cancel" string="Ignore" icon="gtk-cancel" />
<button name="update_ean" string="Correct EAN13" type="object" icon="gtk-ok"/>
</group>
</form>
</field>
</record>
<record id="action_view_partner_wizard_ean_check" model="ir.actions.act_window">
<field name="name">Ean check</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">partner.wizard.ean.check</field>
<field name="view_type">form</field>
<field name="view_mode">form</field>
<field name="target">new</field>
</record>
</data>
</openerp>

View File

@ -0,0 +1,72 @@
# -*- 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 netsvc
import tools
from osv import fields, osv
class partner_wizard_spam(osv.osv_memory):
""" Mass Mailing """
_name = "partner.wizard.spam"
_description = "Mass Mailing"
_columns = {
'email_from': fields.char("Sender's email", size=256, required=True),
'subject': fields.char('Subject', size=256,required=True),
'text': fields.text('Message',required=True),
}
def mass_mail_send(self, cr, uid, ids, context):
"""
Send Email
@param cr: the current row, from the database cursor.
@param uid: the current users ID for security checks.
@param ids: the ID or list of IDs
@param context: A standard dictionary
"""
nbr = 0
partner_pool = self.pool.get('res.partner')
data = self.browse(cr, uid, ids, context=context)
event_pool = self.pool.get('res.partner.event')
active_ids = context and context.get('active_ids', [])
partners = partner_pool.browse(cr, uid, active_ids, context)
for partner in partners:
for adr in partner.address:
if adr.email:
name = adr.name or partner.name
to = '%s <%s>' % (name, adr.email)
#TODO: add some tests to check for invalid email addresses
#CHECKME: maybe we should use res.partner/email_send
tools.email_send(data.email_from, [to], data.subject, data.text,subtype='html')
nbr += 1
event_pool.create(cr, uid,
{'name': 'Email sent through mass mailing',
'partner_id': partner.id,
'description': data.text })
#TODO: log number of message sent
return {'email_sent': nbr}
partner_wizard_spam()
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -0,0 +1,34 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<record id="view_partner_mass_mail" model="ir.ui.view">
<field name="name">Mass Mailing</field>
<field name="model">partner.wizard.spam</field>
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Mass Mailing" col="4">
<field name="email_from"/>
<newline/>
<field name="subject"/>
<newline/>
<field name="text" widget="text_tag"/>
<newline/>
<separator string="" colspan="6"/>
<group colspan="6" col="4" >
<button special="cancel" string="Cancel" icon="gtk-cancel" />
<button name="mass_mail_send" string="Send Email" type="object" icon="gtk-go-forward"/>
</group>
</form>
</field>
</record>
<act_window name="Mass Mailing"
res_model="partner.wizard.spam"
src_model="res.partner"
view_mode="form"
target="new"
key2="client_action_multi"
id="action_partner_mass_mail"/>
</data>
</openerp>

View File

@ -1,98 +0,0 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2009 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 math
from osv import osv
from tools.misc import UpdateableStr
import pooler
def _is_pair(x):
return not x%2
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" />' % partner['ean13']);
key=_get_ean_key(partner['ean13'][:12])
_check_arch_lst.append('<label string=""/>')
if len(partner['ean13'])==12:
_check_arch_lst.append('<label string="" />');
else:
_check_arch_lst.append('<label string="%s" />' % partner['ean13'][12])
_check_arch_lst.append('<label string="%s" />' % key)
_check_arch_lst.append('</form>')
_check_arch.string = '\n'.join(_check_arch_lst)
return {}
def _update_ean(self, cr, uid, data, context):
partner_table = pooler.get_pool(cr.dbname).get('res.partner')
partners = partner_table.browse(cr, uid, data['ids'])
for partner in partners:
partner_table.write(cr, uid, data['ids'], {
'ean13': "%s%s" % (partner['ean13'][:12], _get_ean_key(partner['ean13'][:12]))
})
return {}
class wiz_ean_check(wizard.interface):
states = {
'init': {
'actions': [_check_key],
'result': {
'type': 'form',
'arch': _check_arch,
'fields': _check_fields,
'state': (('end', 'Ignore'), ('correct', 'Correct EAN13'))
}
},
'correct' : {
'actions': [_update_ean],
'result': {
'type': 'state',
'state': 'end'
}
}
}
wiz_ean_check('res.partner.ean13')
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -1,75 +0,0 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2009 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 tools
email_send_form = '''<?xml version="1.0"?>
<form string="Mass Mailing">
<field name="from"/>
<newline/>
<field name="subject"/>
<newline/>
<field name="text"/>
</form>'''
email_send_fields = {
'from': {'string':"Sender's email", 'type':'char', 'size':64, 'required':True},
'subject': {'string':'Subject', 'type':'char', 'size':64, 'required':True},
'text': {'string':'Message', 'type':'text_tag', 'required':True}
}
# this sends an email to ALL the addresses of the selected partners.
def _mass_mail_send(self, cr, uid, data, context):
nbr = 0
partners = pooler.get_pool(cr.dbname).get('res.partner').browse(cr, uid, data['ids'], context)
for partner in partners:
for adr in partner.address:
if adr.email:
name = adr.name or partner.name
to = '%s <%s>' % (name, adr.email)
#TODO: add some tests to check for invalid email addresses
#CHECKME: maybe we should use res.partner/email_send
tools.email_send(data['form']['from'], [to], data['form']['subject'], data['form']['text'],subtype='html')
nbr += 1
pooler.get_pool(cr.dbname).get('res.partner.event').create(cr, uid,
{'name': 'Email sent through mass mailing',
'partner_id': partner.id,
'description': data['form']['text'], })
#TODO: log number of message sent
return {'email_sent': nbr}
class part_email(wizard.interface):
states = {
'init': {
'actions': [],
'result': {'type': 'form', 'arch': email_send_form, 'fields': email_send_fields, 'state':[('end','Cancel'), ('send','Send Email')]}
},
'send': {
'actions': [_mass_mail_send],
'result': {'type': 'state', 'state':'end'}
}
}
part_email('res.partner.spam_send')
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -72,7 +72,7 @@ class res_config_configurable(osv.osv_memory):
config_logo = _get_image config_logo = _get_image
) )
def _next_action(self, cr, uid): def _next_action(self, cr, uid, context=None):
todos = self.pool.get('ir.actions.todo') todos = self.pool.get('ir.actions.todo')
self.logger.notifyChannel('actions', netsvc.LOG_INFO, self.logger.notifyChannel('actions', netsvc.LOG_INFO,
'getting next %s' % todos) 'getting next %s' % todos)
@ -92,7 +92,7 @@ class res_config_configurable(osv.osv_memory):
return self._next_action(cr, uid) return self._next_action(cr, uid)
return None return None
def _set_previous_todo(self, cr, uid, state): def _set_previous_todo(self, cr, uid, state, context=None):
""" lookup the previous (which is still the next at this point) """ lookup the previous (which is still the next at this point)
ir.actions.todo, set it to whatever state was provided. ir.actions.todo, set it to whatever state was provided.
@ -101,10 +101,12 @@ class res_config_configurable(osv.osv_memory):
`ValueError`: if no state is provided `ValueError`: if no state is provided
anything ir_actions_todo.write can throw anything ir_actions_todo.write can throw
""" """
if context is None:
context = {}
# this is ultra brittle, but apart from storing the todo id # this is ultra brittle, but apart from storing the todo id
# into the res.config view, I'm not sure how to get the # into the res.config view, I'm not sure how to get the
# "previous" todo # "previous" todo
previous_todo = self._next_action(cr, uid) previous_todo = self._next_action(cr, uid, context=context)
if not previous_todo: if not previous_todo:
raise LookupError(_("Couldn't find previous ir.actions.todo")) raise LookupError(_("Couldn't find previous ir.actions.todo"))
if not state: if not state:
@ -112,7 +114,7 @@ class res_config_configurable(osv.osv_memory):
"nothingness")) "nothingness"))
previous_todo.write({'state':state}) previous_todo.write({'state':state})
def _next(self, cr, uid): def _next(self, cr, uid, context=None):
self.logger.notifyChannel('actions', netsvc.LOG_INFO, self.logger.notifyChannel('actions', netsvc.LOG_INFO,
'getting next operation') 'getting next operation')
next = self._next_action(cr, uid) next = self._next_action(cr, uid)
@ -139,7 +141,6 @@ class res_config_configurable(osv.osv_memory):
.read(cr, uid, current_user_menu.id) .read(cr, uid, current_user_menu.id)
def start(self, cr, uid, ids, context=None): def start(self, cr, uid, ids, context=None):
print 'Start'
ids2 = self.pool.get('ir.actions.todo').search(cr, uid, [], context=context) ids2 = self.pool.get('ir.actions.todo').search(cr, uid, [], context=context)
for todo in self.pool.get('ir.actions.todo').browse(cr, uid, ids2, context=context): for todo in self.pool.get('ir.actions.todo').browse(cr, uid, ids2, context=context):
if (todo.restart=='always') or (todo.restart=='onskip' and (todo.state in ('skip','cancel'))): if (todo.restart=='always') or (todo.restart=='onskip' and (todo.state in ('skip','cancel'))):
@ -150,7 +151,7 @@ class res_config_configurable(osv.osv_memory):
""" Returns the next todo action to execute (using the default """ Returns the next todo action to execute (using the default
sort order) sort order)
""" """
return self._next(cr, uid) return self._next(cr, uid, context=context)
def execute(self, cr, uid, ids, context=None): def execute(self, cr, uid, ids, context=None):
""" Method called when the user clicks on the ``Next`` button. """ Method called when the user clicks on the ``Next`` button.
@ -185,7 +186,10 @@ class res_config_configurable(osv.osv_memory):
an action dictionary -- executes the action provided by calling an action dictionary -- executes the action provided by calling
``next``. ``next``.
""" """
self._set_previous_todo(cr, uid, state='done') try:
self._set_previous_todo(cr, uid, state='done', context=context)
except Exception, e:
raise osv.except_osv(_('Error'), e.message)
next = self.execute(cr, uid, ids, context=None) next = self.execute(cr, uid, ids, context=None)
if next: return next if next: return next
return self.next(cr, uid, ids, context=context) return self.next(cr, uid, ids, context=context)
@ -198,7 +202,10 @@ class res_config_configurable(osv.osv_memory):
an action dictionary -- executes the action provided by calling an action dictionary -- executes the action provided by calling
``next``. ``next``.
""" """
self._set_previous_todo(cr, uid, state='skip') try:
self._set_previous_todo(cr, uid, state='skip', context=context)
except Exception, e:
raise osv.except_osv(_('Error'), e.message)
next = self.cancel(cr, uid, ids, context=None) next = self.cancel(cr, uid, ids, context=None)
if next: return next if next: return next
return self.next(cr, uid, ids, context=context) return self.next(cr, uid, ids, context=context)
@ -214,7 +221,10 @@ class res_config_configurable(osv.osv_memory):
an action dictionary -- executes the action provided by calling an action dictionary -- executes the action provided by calling
``next``. ``next``.
""" """
self._set_previous_todo(cr, uid, state='cancel') try:
self._set_previous_todo(cr, uid, state='cancel', context=context)
except Exception, e:
raise osv.except_osv(_('Error'), e.message)
next = self.cancel(cr, uid, ids, context=None) next = self.cancel(cr, uid, ids, context=None)
if next: return next if next: return next
return self.next(cr, uid, ids, context=context) return self.next(cr, uid, ids, context=context)

View File

@ -13,6 +13,8 @@
<field name="direction"/> <field name="direction"/>
<field name="translatable"/> <field name="translatable"/>
<field name="active"/> <field name="active"/>
<button name="%(base.action_wizard_update_translations)d"
string="Update Terms" type="action" icon="gtk-ok" help="Update Languague Terms"/>
</tree> </tree>
</field> </field>
</record> </record>
@ -98,13 +100,27 @@
</form> </form>
</field> </field>
</record> </record>
<record id="res_lang_search" model="ir.ui.view">
<field name="name">res.lang.search</field>
<field name="model">res.lang</field>
<field name="type">search</field>
<field name="arch" type="xml">
<search string="Languages">
<field name="name"/>
<field name="code"/>
<field name="iso_code"/>
<field name="direction"/>
</search>
</field>
</record>
<record id="res_lang_act_window" model="ir.actions.act_window"> <record id="res_lang_act_window" model="ir.actions.act_window">
<field name="name">Languages</field> <field name="name">Languages</field>
<field name="res_model">res.lang</field> <field name="res_model">res.lang</field>
<field name="view_type">form</field> <field name="view_type">form</field>
<field name="context">{'active_test': False}</field> <field name="context">{'active_test': False}</field>
<field name="search_view_id" ref="res_lang_search"/>
</record> </record>
<menuitem action="res_lang_act_window" id="menu_res_lang_act_window" parent="base.menu_translation_app"/> <menuitem action="res_lang_act_window" id="menu_res_lang_act_window" parent="menu_translation"/>
</data> </data>
</openerp> </openerp>

View File

@ -23,56 +23,68 @@
<field name="type">form</field> <field name="type">form</field>
<field name="arch" type="xml"> <field name="arch" type="xml">
<form string="Requests"> <form string="Requests">
<field name="act_from" select="1"/> <group colspan="4" col="6">
<field name="act_to" select="1"/> <field name="name" colspan="4"/>
<field colspan="4" name="name" select="1"/> <field name="create_date" string="Request Date"/>
<newline/>
<field name="act_from"/>
<field name="priority"/>
<field name="active"/>
</group>
<notebook colspan="4"> <notebook colspan="4">
<page string="Request"> <page string="Request">
<field name="act_to"/>
<field name="trigger_date"/>
<separator colspan="4" string="Description"/> <separator colspan="4" string="Description"/>
<newline/> <newline/>
<field colspan="4" name="body" select="2"/> <field colspan="4" name="body" nolabel="1"/>
<field name="trigger_date" select="2"/> <group col="5" colspan="4">
<group col="2" colspan="2"> <field name="state"/>
<button name="request_close" states="waiting,draft,active" string="End of Request" type="object"/>
<button name="request_send" states="draft,active" string="Send" type="object"/> <button name="request_send" states="draft,active" string="Send" type="object"/>
<button name="request_reply" states="waiting" string="Reply" type="object"/> <button name="request_reply" states="waiting" string="Reply" type="object"/>
</group> </group>
</page>
<separator colspan="4" string="References"/> <page string="References" groups="base.group_extended">
<field name="ref_partner_id"/> <field name="ref_partner_id"/>
<field name="priority" select="2"/>
<field colspan="4" name="ref_doc1"/> <field colspan="4" name="ref_doc1"/>
<field colspan="4" name="ref_doc2"/> <field colspan="4" name="ref_doc2"/>
<separator colspan="4" string="Status"/>
<field name="state"/>
<group col="3" colspan="2">
<field name="active" select="2"/>
<button name="request_close" states="waiting,draft,active" string="End of Request" type="object"/>
</group>
</page> </page>
<page string="History"> <page string="History" groups="base.group_extended">
<field colspan="4" name="history" nolabel="1" widget="one2many_list"/> <field colspan="4" name="history" nolabel="1" widget="one2many_list"/>
</page> </page>
</notebook> </notebook>
</form> </form>
</field> </field>
</record> </record>
<record id="res_request_search_view" model="ir.ui.view">
<field name="name">res.request.search</field>
<field name="model">res.request</field>
<field name="type">search</field>
<field name="arch" type="xml">
<search string="Requests">
<group colspan="4" col="10">
<field name="act_from"/>
<field name="act_to"/>
<field name="name"/>
<field name="state"/>
</group>
<newline/>
<group expand="0" string="Group By" colspan="4">
<filter string="State" icon="terp-stock_effects-object-colorize" domain="[]" context="{'group_by':'state'}"/>
</group>
</search>
</field>
</record>
<record id="res_request-act" model="ir.actions.act_window"> <record id="res_request-act" model="ir.actions.act_window">
<field name="name">My Requests</field> <field name="name">Requests</field>
<field name="type">ir.actions.act_window</field> <field name="type">ir.actions.act_window</field>
<field name="res_model">res.request</field> <field name="res_model">res.request</field>
<field name="view_id" eval="False"/> <field name="view_id" eval="False"/>
<field name="search_view_id" ref="res_request_search_view"/>
</record> </record>
<menuitem id="next_id_12" name="Requests" parent="base.next_id_4"/> <menuitem id="next_id_12" name="Requests" parent="base.next_id_4"/>
<menuitem action="res_request-act" id="menu_res_request_act" parent="next_id_12"/> <menuitem action="res_request-act" id="menu_res_request_act" parent="next_id_12" sequence="1"/>
<record id="res_request-closed" model="ir.actions.act_window">
<field name="name">My Closed Requests</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">res.request</field>
<field name="domain">[('active','=',False)]</field>
<field name="view_id" eval="False"/>
</record>
<menuitem action="res_request-closed" id="next_id_12_close" parent="menu_res_request_act"/>
<record id="res_request_link-view" model="ir.ui.view"> <record id="res_request_link-view" model="ir.ui.view">
<field name="name">res.request.link.form</field> <field name="name">res.request.link.form</field>
@ -80,8 +92,8 @@
<field name="type">form</field> <field name="type">form</field>
<field name="arch" type="xml"> <field name="arch" type="xml">
<form string="Request Link"> <form string="Request Link">
<field name="name" select="1"/> <field name="name"/>
<field name="object" select="1"/> <field name="object"/>
<field name="priority"/> <field name="priority"/>
</form> </form>
</field> </field>
@ -97,15 +109,27 @@
</tree> </tree>
</field> </field>
</record> </record>
<record id="res_request_link_search_view" model="ir.ui.view">
<field name="name">res.request.link.search</field>
<field name="model">res.request.link</field>
<field name="type">search</field>
<field name="arch" type="xml">
<search string="Request Link">
<field name="name"/>
<field name="object"/>
</search>
</field>
</record>
<record id="res_request_link-act" model="ir.actions.act_window"> <record id="res_request_link-act" model="ir.actions.act_window">
<field name="name">Accepted Links in Requests</field> <field name="name">References Link</field>
<field name="type">ir.actions.act_window</field> <field name="type">ir.actions.act_window</field>
<field name="res_model">res.request.link</field> <field name="res_model">res.request.link</field>
<field name="view_type">form</field> <field name="view_type">form</field>
<field name="view_id" eval="False"/> <field name="view_id" eval="False"/>
<field name="search_view_id" ref="res_request_link_search_view"/>
</record> </record>
<menuitem action="res_request_link-act" id="menu_res_request_link_act" parent="base.next_id_12"/> <menuitem action="res_request_link-act" id="menu_res_request_link_act" parent="base.next_id_12" sequence="4"/>
<record id="res_request_history_tree-view" model="ir.ui.view"> <record id="res_request_history_tree-view" model="ir.ui.view">