Site Tools


Hotfix release available: 2025-05-14b "Librarian". upgrade now! [56.2] (what's this?)
Hotfix release available: 2025-05-14a "Librarian". upgrade now! [56.1] (what's this?)
New release available: 2025-05-14 "Librarian". upgrade now! [56] (what's this?)
Hotfix release available: 2024-02-06b "Kaos". upgrade now! [55.2] (what's this?)
Hotfix release available: 2024-02-06a "Kaos". upgrade now! [55.1] (what's this?)
New release available: 2024-02-06 "Kaos". upgrade now! [55] (what's this?)
Hotfix release available: 2023-04-04b "Jack Jackrum". upgrade now! [54.2] (what's this?)
Hotfix release available: 2023-04-04a "Jack Jackrum". upgrade now! [54.1] (what's this?)
New release available: 2023-04-04 "Jack Jackrum". upgrade now! [54] (what's this?)
Hotfix release available: 2022-07-31b "Igor". upgrade now! [53.1] (what's this?)
Hotfix release available: 2022-07-31a "Igor". upgrade now! [53] (what's this?)
New release available: 2022-07-31 "Igor". upgrade now! [52.2] (what's this?)
New release candidate 2 available: rc2022-06-26 "Igor". upgrade now! [52.1] (what's this?)
New release candidate available: 2022-06-26 "Igor". upgrade now! [52] (what's this?)
Hotfix release available: 2020-07-29a "Hogfather". upgrade now! [51.4] (what's this?)
it:openerp:general

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
it:openerp:general [2025/12/03 17:00]
47.128.42.150 old revision restored (2025/10/27 22:57)
it:openerp:general [2025/12/03 17:52] (current)
47.128.49.18 old revision restored (2025/10/27 15:55)
Line 8: Line 8:
  
 ====== OpenERP Entwicklung ====== ====== OpenERP Entwicklung ======
-[[openerp:pitfalls]] 
  
 ===== Standardmäßig extended view für admin setzen ===== ===== Standardmäßig extended view für admin setzen =====
Line 384: Line 383:
 </code> </code>
  
 +
 +===== Objekt-ID per XML-ID holen =====
 +<code python>
 +xml_id = "message_new_allocation"
 +try:
 +  _, id = self.pool.get('ir.model.data').get_object_reference(cr, uid, module_name, xml_id),
 +except:
 +  id = None
 +</code>
 +
 +@Miki: wo ist die get_object Methode???
 +===== menue.xml =====
 +<code xml>
 +<openerp>
 + <data>
 +        <record model="ir.actions.act_window" id="ACTION_ID">
 +            <field name="name">Label of the window</field>
 +            <field name="res_model">cp_base.the_cool_entity</field>
 +            <field name="view_mode">tree,form,graph</field>
 +        </record>
 + <record model="ir.actions.server" id="ACTION_ID">
 +            <field name="name">Label</field>
 +            <field name="model_id" search="[('name', '=', 'cp_base.irgendwas')]" />
 +            <field name="type">ir.actions.server</field>
 +            <field name="state">code</field>
 +            <field name="code">
 +            #method must have params(self, cr, uid, *args)
 +            obj.a_cool_method()
 +            
 +            </field>
 +        </record>
 +
 +
 +        <menuitem name="Label" icon="terp-project" parent="base.menu_administration" id="menu1"/>
 +        <menuitem name="SubmenuLabel" parent="menu1" id="menu2" action="ACTION_ID" type="server"/>
 +        
 + </data>
 +</openerp>
 +</code>
 +
 +===== view.xml =====
 +<code xml>
 +<openerp>
 +    <data>
 +        <record id="view_payment_tree" model="ir.ui.view">
 +            <field name="name">cp_cash.payment.tree</field>
 +            <field name="model">cp_cash.payment</field>
 +            <field name="type">tree</field>
 +            <field name="arch" type="xml">
 +                <tree string="Payment">
 + <field name="pay_date" />
 +                    <field name="income" />
 +                    <field name="amount" />
 +                    <field name="name" />
 + <field name="invoice_date" />
 + <field name="due_date" />
 +               <field name="recurring_monthly" />
 +               <field name="recurring_until" />
 +               <field name="partner_id" />
 +               <field name="company_id" />
 +                </tree>
 +            </field>
 +        </record>
 +        <record id="view_payment_search" model="ir.ui.view">
 +        <field name="name">cp_cash.payment.search</field>
 +        <field name="model">cp_cash.payment</field>
 +        <field name="type">search</field>
 +        <field name="arch" type="xml">
 +        <search string="Search">
 +        <filter string="Recurring Monthly" domain="[('recurring_monthly', '=', True)]" help="Recurring Monthly True" icon="terp-project"/>
 +        </search>
 +        </field>
 +        </record>
 +
 +        <record id="view_payment_form" model="ir.ui.view">
 +            <field name="name">cp_cash.payment.form</field>
 +            <field name="model">cp_cash.payment</field>
 +            <field name="type">form</field>
 +            <field name="arch" type="xml">
 +                <form string="Payment">
 +                <field name="name"/>
 +                <field name="partner_id"/>
 +                <field name="recurring_monthly"/>
 +                <field name="recurring_until"/>
 +                <group colspan="4" col="6">
 +                <separator string="Amounts and Dates" colspan="6"/>
 +                <group colspan="6" col="4">
 +                 <field name="income"/>
 +                 <field name="amount"/>
 +                <field name="pay_date"/>
 +                </group>
 +                <separator string="Invoice Details" colspan="6"/>
 +                 <group colspan="4" col="6">
 +                 <field name="invoice_date"/>
 +                  <field name="due_date"/>
 +                </group>
 +                </group>
 +                <separator string="Notes" colspan="4"/>
 +                <field name="notes" colspan="4" nolabel="1"/>
 +                </form>
 +            </field>
 +        </record>
 +        
 +        <record model="ir.ui.view" id="view_payments_line_graph">
 +    <field name="name">payments.line.graph</field>
 +    <field name="model">cp_cash.payment</field>
 +    <field name="type">graph</field>
 +    <field name="arch" type="xml">
 +          <graph string="Payments">
 +               <field name="pay_date" group="1" />
 +               <field name="amount" operator="+" />
 +         </graph>
 +     </field>
 + </record>
 +    </data>
 +</openerp>
 +</code>
 +
 +===== Action-Button und Methode aus Model =====
 +
 +**Methode in Model**:
 +<code python>
 +def assign_task_to_me(self, cr, uid, ids, *args):
 +   
 +======    ...
 +       return True #or raise Exception
 +</code>
 +
 +**View XML**:
 +<code xml>
 +<button name="assign_task_to_me" string="Assign task to me" type="object" icon="gtk-execute" />
 +</code>
 +===== Kontextbezogenes Editieren =====
 +<code xml>
 +<field name="works" colspan="4" nolabel="1" mode="tree,form" context="{'default_date': date_current + time.strftime(' %%H:%%M:%%S')}">
 +</code>
 +
 +===== SQL Constraints in Python-Klassen =====
 +<code python>
 +     _sql_constraints = [
 +         ('type_value', "CHECK( (holiday_type='employee' AND employee_id IS NOT NULL) or (holiday_type='category' AND category_id IS NOT NULL))", "You have to select an employee or
 +         ('date_check', "CHECK ( number_of_days_temp > 0 )", "The number of days must be greater than 0 !"),
 +         ('date_check2', "CHECK ( (type='add') OR (date_from < date_to))", "The start date must be before the end date !")
 +     ]
 +
 +
 +</code>
 +
 +===== Tree Farben =====
 +<code xml>
 +<tree colors="red:state in ('refuse');blue:state in ('draft');black:state in ('confirm','validate','validate1')" string="Leaves" >
 +</code>
  
  
  
  
it/openerp/general.1764781225.txt.gz · Last modified: 2025/12/03 17:00 by 47.128.42.150