Commit 792ef8f2 authored by mga@tinyerp.com's avatar mga@tinyerp.com
Browse files

get the latest development from the trunk server

bzr revid: mga@tinyerp.com-20080829085424-k8ozauensbbt090m
Showing with 258 additions and 168 deletions
+258 -168
......@@ -36,7 +36,8 @@
<record id="lang_en" model="res.lang">
<field name="code">en_US</field>
<field name="name">English</field>
<field name="name">English</field>
<field name="translatable">True</field>
</record>
<record id="ad" model="res.country">
......@@ -1289,26 +1290,11 @@
<field eval="time.strftime('%Y-01-01')" name="name"/>
</record>
<!-- Basic Company -->
<record id="main_company" model="res.company">
<field name="name">Tiny sprl</field>
<field name="partner_id" ref="main_partner"/>
<field name="rml_header1">Free Business Solutions</field>
<field name="rml_footer1">Web: http://tiny.be - Tel: (+32).81.81.37.00 - Bank: CPH 126-2013269-07</field>
<field name="rml_footer2">IBAN: BE74 1262 0132 6907 - SWIFT: GKCCBEBB - VAT: BE0477.472.701</field>
<field name="currency_id" ref="EUR"/>
</record>
<record id="EUR" model="res.currency">
<field name="company_id" ref="main_company"/>
</record>
<record id="USD" model="res.currency">
<field name="name">USD</field>
<field name="code">USD</field>
<field name="rounding">0.01</field>
<field name="accuracy">4</field>
<field name="company_id" ref="main_company"/>
</record>
<record id="rateUSD" model="res.currency.rate">
<field name="rate">1.3785</field>
......@@ -1321,7 +1307,6 @@
<field name="code">VEB</field>
<field name="rounding">2.95</field>
<field name="accuracy">4</field>
<field name="company_id" ref="main_company"/>
</record>
<record id="rateVEB" model="res.currency.rate">
<field name="rate">1.0</field>
......@@ -1334,7 +1319,6 @@
<field name="code">CAD</field>
<field name="rounding">0.01</field>
<field name="accuracy">4</field>
<field name="company_id" ref="main_company"/>
</record>
<record id="rateCAD" model="res.currency.rate">
<field name="rate">1.451</field>
......@@ -1348,7 +1332,6 @@
<field name="code">CHF</field>
<field name="rounding">0.01</field>
<field name="accuracy">4</field>
<field name="company_id" ref="main_company"/>
</record>
<record id="rateCHF" model="res.currency.rate">
<field name="rate">1.644</field>
......@@ -1361,7 +1344,6 @@
<field name="code">BRL</field>
<field name="rounding">0.01</field>
<field name="accuracy">4</field>
<field name="company_id" ref="main_company"/>
</record>
<record id="rateBRL" model="res.currency.rate">
<field name="rate">2.588</field>
......@@ -1374,7 +1356,6 @@
<field name="code">CNY</field>
<field name="rounding">0.01</field>
<field name="accuracy">4</field>
<field name="company_id" ref="main_company"/>
</record>
<record id="rateCNY" model="res.currency.rate">
<field name="rate">10.4311</field>
......@@ -1389,7 +1370,6 @@
<field name="rounding">0.01</field>
<field name="accuracy">4</field>
<field eval="False" name="active"/>
<field name="company_id" ref="main_company"/>
</record>
<record id="CZK" model="res.currency">
......@@ -1398,7 +1378,6 @@
<field name="rounding">0.01</field>
<field name="accuracy">4</field>
<field eval="False" name="active"/>
<field name="company_id" ref="main_company"/>
</record>
<record id="DKK" model="res.currency">
......@@ -1406,7 +1385,6 @@
<field name="code">DKK</field>
<field name="rounding">0.01</field>
<field name="accuracy">4</field>
<field name="company_id" ref="main_company"/>
</record>
<record id="rateDKK" model="res.currency.rate">
<field name="rate">7.4416</field>
......@@ -1421,7 +1399,6 @@
<field name="rounding">0.01</field>
<field name="accuracy">4</field>
<field eval="False" name="active"/>
<field name="company_id" ref="main_company"/>
</record>
<record id="IDR" model="res.currency">
......@@ -1430,7 +1407,6 @@
<field name="rounding">0.01</field>
<field name="accuracy">4</field>
<field eval="False" name="active"/>
<field name="company_id" ref="main_company"/>
</record>
<record id="LVL" model="res.currency">
......@@ -1438,7 +1414,6 @@
<field name="code">LVL</field>
<field name="rounding">0.01</field>
<field name="accuracy">4</field>
<field name="company_id" ref="main_company"/>
</record>
<record id="rateLVL" model="res.currency.rate">
<field name="rate">0.71</field>
......@@ -1452,7 +1427,6 @@
<field name="code">NOK</field>
<field name="rounding">0.01</field>
<field name="accuracy">4</field>
<field name="company_id" ref="main_company"/>
</record>
<record id="rateNOK" model="res.currency.rate">
<field name="rate">7.93</field>
......@@ -1466,7 +1440,6 @@
<field name="code">PAB</field>
<field name="rounding">0.01</field>
<field name="accuracy">4</field>
<field name="company_id" ref="main_company"/>
</record>
<record id="ratePAB" model="res.currency.rate">
<field name="rate">1.3813</field>
......@@ -1489,7 +1462,6 @@
<field name="rounding">0.01</field>
<field name="accuracy">4</field>
<field eval="False" name="active"/>
<field name="company_id" ref="main_company"/>
</record>
<record id="GBP" model="res.currency">
......@@ -1497,7 +1469,6 @@
<field name="code">GBP</field>
<field name="rounding">0.01</field>
<field name="accuracy">4</field>
<field name="company_id" ref="main_company"/>
</record>
<record id="rateGBP" model="res.currency.rate">
<field name="rate">0.675</field>
......@@ -1511,7 +1482,16 @@
<field name="rounding">0.01</field>
<field name="accuracy">4</field>
<field eval="False" name="active"/>
<field name="company_id" ref="main_company"/>
</record>
<!-- Basic Company -->
<record id="main_company" model="res.company">
<field name="name">Tiny sprl</field>
<field name="partner_id" ref="main_partner"/>
<field name="rml_header1">Free Business Solutions</field>
<field name="rml_footer1">Web: http://tiny.be - Tel: (+32).81.81.37.00 - Bank: CPH 126-2013269-07</field>
<field name="rml_footer2">IBAN: BE74 1262 0132 6907 - SWIFT: GKCCBEBB - VAT: BE0477.472.701</field>
<field name="currency_id" ref="EUR"/>
</record>
<assert id="main_company" model="res.company">
......
......@@ -2,10 +2,10 @@
<terp>
<data>
<!--
======================
Languages
======================
-->
======================
Languages
======================
-->
<record id="view_lang" model="ir.ui.view">
<field name="name">Languages</field>
<field name="model">res.lang</field>
......@@ -28,27 +28,26 @@
<menuitem id="next_id_2" name="Interface" parent="base.menu_custom"/><menuitem action="action_lang" id="menu_action_lang" parent="next_id_2"/>
<!--
======================
Groups
======================
-->
======================
Groups
======================
-->
<record id="view_groups_form" model="ir.ui.view">
<field name="name">res.groups.form</field>
<field name="model">res.groups</field>
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Groups">
<notebook>
<page string="Group">
<field colspan="4" name="name" select="1"/>
<field colspan="4" name="users"/>
<field colspan="4" name="comment"/>
<field colspan="4" name="name" select="1"/>
<notebook colspan="4">
<page string="Users">
<field colspan="4" name="users" nolabel="1"/>
</page>
<page string="Menus">
<field colspan="4" name="menu_access"/>
<field colspan="4" name="menu_access" nolabel="1"/>
</page>
<page string="Security">
<field colspan="4" name="model_access">
<page string="Access Rights">
<field colspan="4" name="model_access" nolabel="1">
<form string="Access Controls">
<field colspan="4" name="name" select="1"/>
<field name="model_id" select="1"/>
......@@ -59,7 +58,11 @@
<field name="perm_unlink"/>
</form>
</field>
<field colspan="4" name="rule_groups"/>
</page>
<page string="Rules">
<field colspan="4" name="rule_groups" nolabel="1"/>
</page><page string="Notes">
<field colspan="4" name="comment" nolabel="1"/>
</page>
</notebook>
</form>
......@@ -67,10 +70,10 @@
</record>
<!--
======================
Users
======================
-->
======================
Users
======================
-->
<record id="view_users_form_simple_modif" model="ir.ui.view">
<field name="name">res.users.form.modif</field>
<field name="model">res.users</field>
......@@ -94,12 +97,12 @@
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Users">
<notebook>
<field name="name" select="1"/>
<field name="active" select="1"/>
<field name="login" select="1"/>
<field name="password"/>
<notebook colspan="4">
<page string="User">
<field name="name" select="1"/>
<field name="active" select="1"/>
<field name="login" select="1"/>
<field name="password"/>
<field name="address_id"/>
<field name="company_id" required="1"/>
<field name="action_id" required="True"/>
......@@ -108,9 +111,11 @@
<field name="context_tz"/>
<field colspan="4" name="signature"/>
</page>
<page string="Security">
<field colspan="4" name="groups_id"/>
<field colspan="4" name="roles_id"/>
<page string="Groups">
<field colspan="4" nolabel="1" name="groups_id"/>
</page>
<page string="Roles">
<field colspan="4" nolabel="1" name="roles_id"/>
</page>
</notebook>
</form>
......@@ -129,21 +134,21 @@
</record>
<!--
======================
Company
======================
-->
======================
Company
======================
-->
<record id="view_company_form" model="ir.ui.view">
<field name="name">res.company.form</field>
<field name="model">res.company</field>
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Company">
<notebook>
<field colspan="4" name="name" select="1"/>
<field name="partner_id" select="1"/>
<field name="parent_id" select="1"/>
<notebook colspan="4">
<page string="General Information">
<field colspan="4" name="name" select="1"/>
<field name="partner_id" select="1"/>
<field name="parent_id" select="1"/>
<field name="rml_header1"/>
<field name="rml_footer1"/>
<field name="rml_footer2"/>
......@@ -174,35 +179,27 @@
</field>
</record>
<record id="view_users_configuration_form" model="ir.ui.view">
<field name="name">res.users.confirm.form</field>
<field name="model">res.users</field>
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Configure User">
<notebook colspan="4">
<page string="User Definition">
<separator col="4" colspan="4" string="Define a New User"/>
<field name="name" select="1"/>
<newline/>
<field name="login" select="1"/>
<field name="password"/>
<field colspan="4" name="signature"/>
</page><page string="Access Rights">
<label string="Assign groups to set objects available for this user" colspan="4"/>
<field colspan="4" name="groups_id" nolabel="1"/>
</page>
</notebook>
<separator string="" colspan="4"/>
<label string="" colspan="2"/>
<group col="3" colspan="3">
<button icon='gtk-cancel' special="cancel" name="action_next" type='object' string='Skip &amp; Continue'/>
<button name='action_new' icon='gtk-ok' type='object' string='Add Another User'/>
<button name='action_continue' icon='gtk-ok' type='object' string='Continue'/>
</group>
<separator col="4" colspan="4" string="Define a New User"/>
<field name="name" select="1"/>
<newline/>
<field name="login" select="1"/>
<field name="password" required="1"/>
<field colspan="4" name="signature"/>
<separator string="Assign Groups to Define Access Rights" colspan="4"/>
<field colspan="4" name="groups_id" nolabel="1"/>
<separator string="" colspan="4"/>
<label string="" colspan="1"/>
<group col="3" colspan="2">
<button icon='gtk-cancel' special="cancel" name="action_next" type='object' string='Skip &amp; Continue'/>
<button name='action_new' icon='gtk-ok' type='object' string='Add New User'/>
<button name='action_continue' icon='gtk-go-forward' type='object' string='Add &amp; Continue'/>
</group>
</form>
</field>
</record>
......@@ -217,18 +214,18 @@
<field name="target">new</field>
</record>
<record id="view_confirm_simple_view_form" model="ir.ui.view">
<field name="name">res.users.confirm.simple_view</field>
<field name="model">res.config.view</field>
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Configure simple view">
<separator string="Choose the simple or extended views" colspan="4"/>
<field colspan="2" name="view"/>
<separator string="Choose Your Mode" colspan="4"/>
<field colspan="2" name="view"/>
<label string="Choose the simplified interface if you are testing OpenERP for the first time. Less used options or fields are automatically hidden. You will be able to change this, later, through the Administration menu." colspan="4" align="0.0"/>
<newline/>
<separator string="" colspan="4"/>
<label string="" colspan="2"/>
<label string="" colspan="2"/>
<group colspan="2" col="1">
<button icon="gtk-ok" name="action_set" string="Set" type="object"/>
</group>
......@@ -251,18 +248,20 @@
<record id="config_wizard_step_user" model="ir.module.module.configuration.step">
<field name="name">Create User</field>
<field name="note">Create your different users.
<field name="note">Create your users.
You will be able to assign groups to users. Groups define the access rights of each users on the different objects of the system.
</field>
</field>
<field name="action_id" ref="action_config_user_form"/>
<field name="state">open</field>
<field name="sequence">10</field>
</record>
<record id="config_wizard_simple_view" model="ir.module.module.configuration.step">
<field name="name">Select between the simplified views or the extended views.</field>
<field name="note">Select between the simplified views or the extended views.
If you are testing or using OpenERP for the first time, we suggest you to use the simplified view, which has less features but is easier to understand. You will be able to switch to the extended view later.
<field name="name">Select Your Interface</field>
<field name="note">Choose between the "Simplified Interface" or the extended one.
If you are testing or using OpenERP for the first time, we suggest you to use
the simplified interface, which has less options and fields but is easier to
understand. You will be able to switch to the extended view later.
</field>
<field name="action_id" ref="action_config_simple_view_form"/>
<field name="state">open</field>
......
......@@ -56,7 +56,7 @@ class report_custom(osv.osv):
_columns = {
'name': fields.char('Report Name', size=64, required=True, translate=True),
'type': fields.char('Report Type', size=32, required=True),
'model':fields.char('Model', size=64, required=True),
'model':fields.char('Object', size=64, required=True),
'report_id': fields.integer('Report Ref.', required=True),
'usage': fields.char('Action Usage', size=32),
'multi': fields.boolean('On multiple doc.', help="If set to true, the action will not be displayed on the right toolbar of a form views.")
......@@ -100,7 +100,7 @@ class report_xml(osv.osv):
_columns = {
'name': fields.char('Name', size=64, required=True, translate=True),
'type': fields.char('Report Type', size=32, required=True),
'model': fields.char('Model', size=64, required=True),
'model': fields.char('Object', size=64, required=True),
'report_name': fields.char('Internal Name', size=64, required=True),
'report_xsl': fields.char('XSL path', size=256),
'report_xml': fields.char('XML path', size=256),
......@@ -174,8 +174,8 @@ class act_window(osv.osv):
'view_id': fields.many2one('ir.ui.view', 'View Ref.', ondelete='cascade'),
'domain': fields.char('Domain Value', size=250),
'context': fields.char('Context Value', size=250),
'res_model': fields.char('Model', size=64),
'src_model': fields.char('Source model', size=64),
'res_model': fields.char('Object', size=64),
'src_model': fields.char('Source Object', size=64),
'target': fields.selection([('current','Current Window'),('new','New Window')], 'Target Window'),
'view_type': fields.selection((('tree','Tree'),('form','Form')),string='Type of view'),
'view_mode': fields.char('Mode of view', size=250),
......@@ -372,7 +372,7 @@ class actions_server(osv.osv):
], 'Action State', required=True, size=32, change_default=True),
'code': fields.text('Python Code'),
'sequence': fields.integer('Sequence'),
'model_id': fields.many2one('ir.model', 'Model', required=True),
'model_id': fields.many2one('ir.model', 'Object', required=True),
'trigger_name': fields.char('Trigger Name', size=128),
'trigger_obj_id': fields.reference('Trigger On', selection=model_get, size=128),
'message': fields.text('Message', translate=True),
......
......@@ -38,7 +38,7 @@ class ir_attachment(osv.osv):
'datas_fname': fields.char('Data Filename',size=64),
'description': fields.text('Description'),
# Not required due to the document module !
'res_model': fields.char('Resource Model',size=64, readonly=True),
'res_model': fields.char('Resource Object',size=64, readonly=True),
'res_id': fields.integer('Resource ID', readonly=True),
'link': fields.char('Link', size=256)
}
......
......@@ -68,7 +68,7 @@ class ir_cron(osv.osv, netsvc.Agent):
'numbercall': fields.integer('Number of calls', help='Number of time the function is called,\na negative number indicates that the function will always be called'),
'doall' : fields.boolean('Repeat missed'),
'nextcall' : fields.datetime('Next call date', required=True),
'model': fields.char('Model', size=64),
'model': fields.char('Object', size=64),
'function': fields.char('Function', size=64),
'args': fields.text('Arguments'),
'priority': fields.integer('Priority', help='0=Very Urgent\n10=Not urgent')
......
......@@ -33,8 +33,8 @@ from osv import fields,osv
class ir_default(osv.osv):
_name = 'ir.default'
_columns = {
'field_tbl': fields.char('Model',size=64),
'field_name': fields.char('Model field',size=64),
'field_tbl': fields.char('Object',size=64),
'field_name': fields.char('Object field',size=64),
'value': fields.char('Default Value',size=64),
'uid': fields.many2one('res.users', 'Users'),
'page': fields.char('View',size=64),
......
......@@ -46,7 +46,7 @@ class ir_model(osv.osv):
_description = "Objects"
_rec_name = 'name'
_columns = {
'name': fields.char('Model Name', size=64, translate=True, required=True),
'name': fields.char('Object Name', size=64, translate=True, required=True),
'model': fields.char('Object Name', size=64, required=True, search=1),
'info': fields.text('Information'),
'field_id': fields.one2many('ir.model.fields', 'model_id', 'Fields', required=True),
......@@ -67,7 +67,7 @@ class ir_model(osv.osv):
return True
_constraints = [
(_check_model_name, 'The model name must start with x_ and not contain any special character !', ['model']),
(_check_model_name, 'The Object name must start with x_ and not contain any special character !', ['model']),
]
def unlink(self, cr, user, ids, context=None):
for model in self.browse(cr, user, ids, context):
......@@ -103,8 +103,8 @@ class ir_model_fields(osv.osv):
_columns = {
'name': fields.char('Name', required=True, size=64, select=1),
'model': fields.char('Object Name', size=64, required=True),
'relation': fields.char('Model Relation', size=64),
'model_id': fields.many2one('ir.model', 'Model id', required=True, select=True, ondelete='cascade'),
'relation': fields.char('Object Relation', size=64),
'model_id': fields.many2one('ir.model', 'Object id', required=True, select=True, ondelete='cascade'),
'field_description': fields.char('Field Label', required=True, size=256),
'relate': fields.boolean('Click and Relate'),
......@@ -164,7 +164,7 @@ class ir_model_access(osv.osv):
_name = 'ir.model.access'
_columns = {
'name': fields.char('Name', size=64, required=True),
'model_id': fields.many2one('ir.model', 'Model', required=True),
'model_id': fields.many2one('ir.model', 'Object', required=True),
'group_id': fields.many2one('res.groups', 'Group'),
'perm_read': fields.boolean('Read Access'),
'perm_write': fields.boolean('Write Access'),
......@@ -189,7 +189,7 @@ class ir_model_access(osv.osv):
def check(self, cr, uid, model_name, mode='read',raise_exception=True):
assert mode in ['read','write','create','unlink'], 'Invalid access mode for security'
if uid == 1:
return True # TODO: check security: don't allow xml-rpc request with uid == 1
return True
cr.execute('SELECT MAX(CASE WHEN perm_'+mode+' THEN 1 else 0 END) '
'FROM ir_model_access a '
......@@ -207,7 +207,8 @@ class ir_model_access(osv.osv):
'WHERE a.group_id IS NULL AND m.model = %s', (model_name,))
r= cr.fetchall()
if r[0][0] == None:
return False # by default, the user had no access
return True # Changed waiting final rules
#return False # by default, the user had no access
if not r[0][0]:
if raise_exception:
......@@ -244,7 +245,7 @@ class ir_model_data(osv.osv):
_name = 'ir.model.data'
_columns = {
'name': fields.char('XML Identifier', required=True, size=64),
'model': fields.char('Model', required=True, size=64),
'model': fields.char('Object', required=True, size=64),
'module': fields.char('Module', required=True, size=64),
'res_id': fields.integer('Resource ID'),
'noupdate': fields.boolean('Non Updatable'),
......
......@@ -38,7 +38,7 @@ class report_custom(osv.osv):
_name = 'ir.report.custom'
_columns = {
'name': fields.char('Report Name', size=64, required=True, translate=True),
'model_id': fields.many2one('ir.model','Model', required=True, change_default=True),
'model_id': fields.many2one('ir.model','Object', required=True, change_default=True),
'type': fields.selection([('table','Tabular'),('pie','Pie Chart'),('bar','Bar Chart'),('line','Line Plot')], "Report Type", size=64, required='True'),
'title': fields.char("Report title", size=64, required='True', translate=True),
'print_format': fields.selection((('A4','a4'),('A5','a5')), 'Print format', required=True),
......
......@@ -38,7 +38,7 @@ class ir_rule_group(osv.osv):
_columns = {
'name': fields.char('Name', size=128, select=1),
'model_id': fields.many2one('ir.model', 'Model',select=1, required=True),
'model_id': fields.many2one('ir.model', 'Object',select=1, required=True),
'global': fields.boolean('Global', select=1, help="Make the rule global or it needs to be put on a group or user"),
'rules': fields.one2many('ir.rule', 'rule_group', 'Tests', help="The rule is satisfied if at least one test is True"),
'groups': fields.many2many('res.groups', 'group_rule_group_rel', 'rule_group_id', 'group_id', 'Groups'),
......
......@@ -34,7 +34,7 @@ import tools
TRANSLATION_TYPE = [
('field', 'Field'),
('model', 'Model'),
('model', 'Object'),
('rml', 'RML'),
('selection', 'Selection'),
('view', 'View'),
......
......@@ -60,7 +60,7 @@ class view(osv.osv):
_name = 'ir.ui.view'
_columns = {
'name': fields.char('View Name',size=64, required=True),
'model': fields.char('Model', size=64, required=True),
'model': fields.char('Object', size=64, required=True),
'priority': fields.integer('Priority', required=True),
'type': fields.selection((
('tree','Tree'),
......
......@@ -59,7 +59,7 @@ class ir_values(osv.osv):
_columns = {
'name': fields.char('Name', size=128),
'model': fields.char('Model', size=128),
'model': fields.char('Object', size=128),
'value': fields.text('Value'),
'value_unpickle': fields.function(_value_unpickle, fnct_inv=_value_pickle,
method=True, type='text', string='Value'),
......
......@@ -33,7 +33,7 @@ from osv import fields,osv
class wizard_model_menu(osv.osv_memory):
_name = 'wizard.ir.model.menu.create'
_columns = {
'model_id': fields.many2one('ir.model','Model', required=True),
'model_id': fields.many2one('ir.model','Object', required=True),
'menu_id': fields.many2one('ir.ui.menu', 'Parent Menu', required=True),
'name': fields.char('Menu Name', size=64, required=True),
'view_ids': fields.one2many('wizard.ir.model.menu.create.line', 'wizard_id', 'Views'),
......
......@@ -38,7 +38,7 @@ class workflow(osv.osv):
_log_access = False
_columns = {
'name': fields.char('Name', size=64, required=True),
'osv': fields.char('Resource Model', size=64, required=True,select=True),
'osv': fields.char('Resource Object', size=64, required=True,select=True),
'on_create': fields.boolean('On Create', select=True),
'activities': fields.one2many('workflow.activity', 'wkf_id', 'Activities'),
}
......@@ -145,7 +145,7 @@ class wkf_instance(osv.osv):
'wkf_id': fields.many2one('workflow', 'Workflow', ondelete='restrict', select=True),
'uid': fields.integer('User ID'),
'res_id': fields.integer('Resource ID', select=True),
'res_type': fields.char('Resource Model', size=64, select=True),
'res_type': fields.char('Resource Object', size=64, select=True),
'state': fields.char('State', size=32, select=True),
}
def _auto_init(self, cr, context={}):
......@@ -180,7 +180,7 @@ class wkf_triggers(osv.osv):
_log_access = False
_columns = {
'res_id': fields.integer('Resource ID', size=128),
'model': fields.char('Model', size=128),
'model': fields.char('Object', size=128),
'instance_id': fields.many2one('workflow.instance', 'Destination Instance', ondelete="cascade"),
'workitem_id': fields.many2one('workflow.workitem', 'Workitem', required=True, ondelete="cascade"),
}
......
......@@ -266,23 +266,6 @@ class module(osv.osv):
raise orm.except_orm(_('Error'),
_('You try to remove a module that is installed or will be installed'))
return super(module, self).unlink(cr, uid, ids, context=context)
def state_change(self, cr, uid, ids, newstate, context={}, level=50):
if level<1:
raise Exception, _('Recursion error in modules dependencies !')
demo = True
for module in self.browse(cr, uid, ids):
mdemo = True
for dep in module.dependencies_id:
ids2 = self.search(cr, uid, [('name','=',dep.name)])
mdemo = self.state_change(cr, uid, ids2, newstate, context, level-1,)\
and mdemo
if not module.dependencies_id:
mdemo = module.demo
if module.state == 'uninstalled':
self.write(cr, uid, [module.id], {'state': newstate, 'demo':mdemo})
demo = demo and mdemo
return demo
def state_update(self, cr, uid, ids, newstate, states_to_update, context={}, level=50):
if level<1:
......@@ -478,14 +461,14 @@ class module(osv.osv):
match = re.search('-([a-zA-Z0-9\._-]+)(\.zip)', mod.url, re.I)
version = '0'
if match:
version = match.group(1)
version = match.group(1)
if vercmp(mod.installed_version or '0', version) >= 0:
continue
res.append(mod.url)
if not download:
continue
zipfile = urllib.urlopen(mod.url).read()
fname = addons.get_module_path(mod.name+'.zip')
fname = addons.get_module_path(mod.name+'.zip')
try:
fp = file(fname, 'wb')
fp.write(zipfile)
......@@ -533,6 +516,15 @@ class module(osv.osv):
p_id = c_id
categs = categs[1:]
self.write(cr, uid, [id], {'category_id': p_id})
def action_install(self,cr,uid,ids,context=None):
self.write(cr , uid, ids ,{'state' : 'to install'})
self.download(cr, uid, ids, context=context)
for id in ids:
cr.execute("select m.id as id from ir_module_module_dependency d inner join ir_module_module m on (m.name=d.name) where d.module_id=%d and m.state='uninstalled'",(id,))
dep_ids = map(lambda x:x[0],cr.fetchall())
if len(dep_ids):
self.action_install(cr,uid,dep_ids,context=context)
module()
class module_dependency(osv.osv):
......@@ -595,7 +587,7 @@ class module_configuration(osv.osv_memory):
item = item_obj.browse(cr, uid, item_ids[0], context=context)
return item.note
else:
return "Your database is now fully configured.\n\nClick 'Continue' and enyoy your OpenERP experience..."
return "Your database is now fully configured.\n\nClick 'Continue' and enjoy your OpenERP experience..."
return False
def _get_action(self, cr, uid, context={}):
......@@ -608,15 +600,20 @@ class module_configuration(osv.osv_memory):
return item.id
return False
def _progress_get(self,cr,uid, context={}):
total = self.pool.get('ir.module.module.configuration.step').search_count(cr, uid, [], context)
todo = self.pool.get('ir.module.module.configuration.step').search_count(cr, uid, [('state','<>','open')], context)
return max(5.0,round(todo*100/total))
_columns = {
'name': fields.text('Next Wizard',readonly=True),
'progress': fields.float('Configuration Progress', readonly=True),
'item_id':fields.many2one('ir.module.module.configuration.step', 'Next Configuration Wizard',invisible=True, readonly=True),
}
_defaults={
'progress': _progress_get,
'item_id':_get_action,
'name':_get_action_name,
}
def button_skip(self,cr,uid,ids,context=None):
item_obj = self.pool.get('ir.module.module.configuration.step')
......
......@@ -104,7 +104,7 @@
<field name="model">ir.module.module</field>
<field name="type">tree</field>
<field name="arch" type="xml">
<tree colors="blue:state=='to upgrade' or state=='to install';grey:state=='uninstalled' or state=='uninstallable'" string="Modules">
<tree colors="blue:state=='to upgrade' or state=='to install';red:state=='uninstalled';grey:state=='uninstallable'" string="Modules">
<field name="name"/>
<field name="shortdesc"/>
<field name="author"/>
......@@ -224,23 +224,24 @@
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Next Configuration Step">
<image name="gtk-dialog-info"/>
<group>
<separator string="Next Configuration Step" colspan="4"/>
<field name="name" nolabel="1" colspan="4" width="500"/>
<separator colspan="4" string=""/>
<label string="" colspan="2"/>
<group colspan="2" col="2">
<button icon="gtk-cancel" special="cancel" string="Skip Step"/>
<button icon="gtk-go-forward" name="button_continue" string="Continue" type="object"/>
</group>
</group>
<image name="gtk-dialog-info"/>
<group>
<separator string="Next Configuration Step" colspan="4"/>
<field name="name" nolabel="1" colspan="4" width="500"/>
<field name="progress" widget="progressbar"/>
<separator colspan="4" string=""/>
<label string="" colspan="2"/>
<group colspan="2" col="2">
<button icon="gtk-cancel" special="cancel" string="Skip Step"/>
<button icon="gtk-go-forward" name="button_continue" string="Continue" type="object"/>
</group>
</group>
</form>
</field>
</record>
<record id="action_config_wizard_form" model="ir.actions.act_window">
<field name="name">Main Configuration Window</field>
<field name="name">Configuration Wizard</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">ir.module.module.configuration.wizard</field>
<field name="view_type">form</field>
......
......@@ -65,6 +65,39 @@
<field name="wiz_name">module.lang.import</field>
</record>
<menuitem action="wizard_lang_import" id="menu_wizard_lang_import" parent="base.menu_translation" type="wizard"/>
<record id="wizard_lang_import" model="ir.actions.wizard">
<field name="name">Import language</field>
<field name="wiz_name">module.lang.import</field>
</record>
<menuitem action="wizard_lang_import" id="menu_wizard_lang_import" parent="base.menu_translation" type="wizard"/>
<record id="wizard_update_translations" model="ir.ui.view">
<field name="name">Update Translations</field>
<field name="model">wizard.module.update_translations</field>
<field name="type">form</field>
<field name="arch" type="xml">
<form col="3" string="Update Translations">
<image name="gtk-dialog-info"/>
<group col="2" fill="0" height="500">
<field name="lang" width="300"/>
</group>
<group col="2" colspan="3" fill="0">
<button icon="gtk-cancel" name="act_cancel" special="cancel" string="Cancel" type="object"/>
<button icon="gtk-ok" name="act_update" string="Update" type="object"/>
</group>
</form>
</field>
</record>
<record id="action_wizard_update_translations" model="ir.actions.act_window">
<field name="name">Update Translations</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">wizard.module.update_translations</field>
<field name="view_type">form</field>
<field name="view_mode">form</field>
<field name="target">new</field>
</record>
<menuitem action="action_wizard_update_translations" id="menu_wizard_update_translations" parent="base.menu_translation"/>
</data>
</terp>
......@@ -35,6 +35,7 @@ import add_new
import wizard_export_lang
import wizard_import_lang
import wizard_module_import
import wizard_update_translations
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
# -*- encoding: utf-8 -*-
##############################################################################
#
# Copyright (c) 2004-2008 TINY SPRL. (http://tiny.be) All Rights Reserved.
#
# $Id$
#
# WARNING: This program as such is intended to be used by professional
# programmers who take the whole responsability of assessing all potential
# consequences resulting from its eventual inadequacies and bugs
# End users who are looking for a ready-to-use solution with commercial
# garantees and support are strongly adviced to contract a Free Software
# Service Company
#
# This program is Free Software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#
##############################################################################
from osv import osv, fields
import tools
import pooler
import StringIO
class update_translations(osv.osv_memory):
def _get_languages(self, cr, uid, context):
lang_obj=pooler.get_pool(cr.dbname).get('res.lang')
ids=lang_obj.search(cr, uid, ['&', ('active', '=', True), ('translatable', '=', True),])
langs=lang_obj.browse(cr, uid, ids)
return [(lang.code, lang.name) for lang in langs]
def _get_lang_name(self, cr, uid, lang_code):
lang_obj=pooler.get_pool(cr.dbname).get('res.lang')
ids=lang_obj.search(cr, uid, [('code', '=', lang_code)])
if not ids:
raise osv.orm_except('Bad lang')
lang = lang_obj.browse(cr, uid, ids[0])
return lang.name
def act_cancel(self, cr, uid, ids, context=None):
return {'type': 'ir.actions.act_window_close'}
def act_update(self, cr, uid, ids, context=None):
this = self.browse(cr, uid, ids)[0]
lang_name = self._get_lang_name(cr, uid, this.lang)
buf=StringIO.StringIO()
tools.trans_export(this.lang, ['all'], buf, 'csv', dbname=cr.dbname)
tools.trans_load_data(cr.dbname, buf, 'csv', this.lang, lang_name=lang_name)
buf.close()
return {'type': 'ir.actions.act_window_close'}
_name = 'wizard.module.update_translations'
_columns = {
'lang': fields.selection(_get_languages, 'Language', required=True),
}
update_translations()
......@@ -122,10 +122,10 @@ def _partner_title_get(self, cr, uid, context={}):
def _lang_get(self, cr, uid, context={}):
obj = self.pool.get('res.lang')
ids = obj.search(cr, uid, [])
ids = obj.search(cr, uid, [], context=context)
res = obj.read(cr, uid, ids, ['code', 'name'], context)
res = [(r['code'], r['name']) for r in res]
return res + [(False, '')]
return [(r['code'], r['name']) for r in res]
class res_partner(osv.osv):
_description='Partner'
......@@ -138,7 +138,7 @@ class res_partner(osv.osv):
'parent_id': fields.many2one('res.partner','Main Company', select=2),
'child_ids': fields.one2many('res.partner', 'parent_id', 'Partner Ref.'),
'ref': fields.char('Code', size=64),
'lang': fields.selection(_lang_get, 'Language', size=5),
'lang': fields.selection(_lang_get, 'Language', size=5, help="If the selected language is loaded in the system, all documents related to this partner will be printed in this language. If not, it will be english."),
'user_id': fields.many2one('res.users', 'Dedicated Salesman', help='The internal user that is in charge of communicating with this partner if any.'),
'responsible': fields.many2one('res.users', 'Users'),
'vat': fields.char('VAT',size=32 ,help="Value Added Tax number"),
......@@ -152,9 +152,12 @@ class res_partner(osv.osv):
'credit_limit': fields.float(string='Credit Limit'),
'ean13': fields.char('EAN13', size=13),
'active': fields.boolean('Active'),
'customer': fields.boolean('Customer'),
'supplier': fields.boolean('Supplier'),
}
_defaults = {
'active': lambda *a: 1,
'customer': lambda *a: 1,
}
_sql_constraints = [
('name_uniq', 'unique (name)', 'The name of the partner must be unique !')
......@@ -259,10 +262,18 @@ class res_partner(osv.osv):
# update the current partner
cr.execute("update res_partner set ref=%d where id=%d", (nextref, ids[0]))
return True
def view_header_get(self, cr, uid, view_id, view_type, context):
res = super(res_partner, self).view_header_get(cr, uid, view_id, view_type, context)
if res: return res
if (not context.get('category_id', False)):
return False
return _('Partners: ')+self.pool.get('res.partner.category').browse(cr, uid, context['category_id'], context).name
res_partner()
class res_partner_address(osv.osv):
_description ='Partner Contact'
_description ='Partner Addresses'
_name = 'res.partner.address'
_order = 'id'
_columns = {
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment