Custom paper formate for Qweb report odoo

Tags

, ,


<report
    id="lukasz_orders_report_qweb"
    string="Drukuj Zgloszenie"
    model="lukasz.orders"
    report_type="qweb-pdf"
    name="your_module_name.lukasz_orders_report"
    file="your_module_name.lukasz_orders_report"
 />

<record id="paperformat_lowmargin" model="report.paperformat">
    <field name="name">European A4 low margin</field>
    <field name="default" eval="True" />
    <field name="format">A4</field>
    <field name="page_height">0</field>
    <field name="page_width">0</field>
    <field name="orientation">Portrait</field>
    <field name="margin_top">4</field>
    <field name="margin_bottom">4</field>
    <field name="margin_left">4</field>
    <field name="margin_right">4</field>
    <field name="header_line" eval="False" />
    <field name="header_spacing">0</field>
    <field name="dpi">90</field>
</record>

<record id="your_module_name.lukasz_orders_report_qweb" model="ir.actions.report.xml">
    <field name="paperformat_id" ref="your_module_name.paperformat_lowmargin" />
</record>

Odoo validate invoice from code

Tags


inv_obj = self.pool.get('account.invoice')
inv_obj.button_compute(cr, uid, [invoice_id], context=context, set_total=True)
inv_obj.action_date_assign(cr, uid, invoice_id, context=context)
inv_obj.action_move_create(cr, uid, invoice_id, context=context)
inv_obj.action_number(cr, uid, invoice_id, context=context)
inv_obj.invoice_validate(cr, uid, invoice_id, context=context)

odoo group based readonly

Tags

, ,


<record id="view_hr_holidays_inherit_form_mgr" model="ir.ui.view">
 <field name="name">view_hr_mgr_emp_form_mgr</field>
 <field name="model">hr.holidays</field>
 <field name="inherit_id" ref="view_hr_holidays_inherit_form"/>
 <field name="groups_id" eval="[(6, 0, [ref('base.group_hr_manager')])]"/>
 <field name="arch" type="xml">
 <xpath expr="//field[@name='employee_id']" position="attributes">
 <attribute name="readonly">0</attribute>
 </xpath>
 </field>
 </record>

Extract email from text- python

Tags


>>> import re
>>> line = "why people don't know what regex are? let me know ananthu@epillars.com.lol"
>>> match = re.search(r'[\w\.-]+@[\w\.-]+', line)
>>> match.group(0)
'ananthu@epillars.com.lol'

If you have several email addresses use findall:

>>> line = "why people don't know what regex are? let me know 321dsasdsa@dasdsa.com.lol   dssdadsa dadaads@dsdds.com"
>>> match = re.findall(r'[\w\.-]+@[\w\.-]+', line)
>>> match
['321dsasdsa@dasdsa.com.lol', 'dadaads@dsdds.com']