Remove safe_eval
We convert all the fields that were storing python code into PYSON. We add a pyson attribute on field tag to store PYSON value. issue4416 review6971002
This commit is contained in:
@@ -6,7 +6,8 @@ this repository contains the full copyright notices and license terms. -->
|
||||
<record model="ir.action.act_window" id="act_purchase_form2">
|
||||
<field name="name">Purchases</field>
|
||||
<field name="res_model">purchase.purchase</field>
|
||||
<field name="domain">[('party', 'in', Eval('active_ids'))]</field>
|
||||
<field name="domain"
|
||||
eval="[('party', 'in', Eval('active_ids'))]" pyson="1"/>
|
||||
</record>
|
||||
<record model="ir.action.keyword"
|
||||
id="act_open_purchase_keyword1">
|
||||
|
||||
@@ -67,6 +67,13 @@ class Template:
|
||||
else:
|
||||
self.purchase_uom = self.default_uom
|
||||
|
||||
@classmethod
|
||||
def view_attributes(cls):
|
||||
return super(Template, cls).view_attributes() + [
|
||||
('//page[@id="suppliers"]', 'states', {
|
||||
'invisible': ~Eval('purchasable'),
|
||||
})]
|
||||
|
||||
@classmethod
|
||||
def write(cls, *args):
|
||||
actions = iter(args)
|
||||
|
||||
@@ -590,6 +590,10 @@ class Purchase(Workflow, ModelSQL, ModelView, TaxableMixin):
|
||||
domain = [domain, ('party', operator, names[1])]
|
||||
return domain
|
||||
|
||||
@classmethod
|
||||
def view_attributes(cls):
|
||||
return [('//field[@name="comment"]', 'spell', Eval('party_lang'))]
|
||||
|
||||
@classmethod
|
||||
def copy(cls, purchases, default=None):
|
||||
if default is None:
|
||||
@@ -1271,6 +1275,11 @@ class PurchaseLine(ModelSQL, ModelView):
|
||||
{'purchase': self.purchase.rec_name})
|
||||
return [invoice_line]
|
||||
|
||||
@classmethod
|
||||
def view_attributes(cls):
|
||||
return [('//field[@name="note"]|//field[@name="description"]',
|
||||
'spell', Eval('_parent_purchase', {}).get('party_lang'))]
|
||||
|
||||
@classmethod
|
||||
def copy(cls, lines, default=None):
|
||||
if default is None:
|
||||
|
||||
+24
-11
@@ -69,7 +69,9 @@ this repository contains the full copyright notices and license terms. -->
|
||||
<record model="ir.action.act_window" id="act_shipment_form">
|
||||
<field name="name">Shipments</field>
|
||||
<field name="res_model">stock.shipment.in</field>
|
||||
<field name="domain">[('moves.purchase', 'in', Eval('active_ids'))]</field>
|
||||
<field name="domain"
|
||||
eval="[('moves.purchase', 'in', Eval('active_ids'))]"
|
||||
pyson="1"/>
|
||||
</record>
|
||||
<record model="ir.action.keyword"
|
||||
id="act_open_shipment_keyword1">
|
||||
@@ -80,7 +82,9 @@ this repository contains the full copyright notices and license terms. -->
|
||||
<record model="ir.action.act_window" id="act_return_form">
|
||||
<field name="name">Returns</field>
|
||||
<field name="res_model">stock.shipment.in.return</field>
|
||||
<field name="domain">[('moves.purchase', 'in', Eval('active_ids'))]</field>
|
||||
<field name="domain"
|
||||
eval="[('moves.purchase', 'in', Eval('active_ids'))]"
|
||||
pyson="1"/>
|
||||
</record>
|
||||
<record model="ir.action.keyword"
|
||||
id="act_open_shipment_return_keyword1">
|
||||
@@ -91,7 +95,9 @@ this repository contains the full copyright notices and license terms. -->
|
||||
<record model="ir.action.act_window" id="act_invoice_form">
|
||||
<field name="name">Invoices</field>
|
||||
<field name="res_model">account.invoice</field>
|
||||
<field name="domain">[('lines.origin.purchase.id', 'in', Eval('active_ids'), 'purchase.line')]</field>
|
||||
<field name="domain"
|
||||
eval="[('lines.origin.purchase.id', 'in', Eval('active_ids'), 'purchase.line')]"
|
||||
pyson="1"/>
|
||||
</record>
|
||||
<record model="ir.action.keyword"
|
||||
id="act_open_invoice_keyword1">
|
||||
@@ -131,28 +137,28 @@ this repository contains the full copyright notices and license terms. -->
|
||||
id="act_purchase_form_domain_draft">
|
||||
<field name="name">Draft</field>
|
||||
<field name="sequence" eval="10"/>
|
||||
<field name="domain">[('state', '=', 'draft')]</field>
|
||||
<field name="domain" eval="[('state', '=', 'draft')]" pyson="1"/>
|
||||
<field name="act_window" ref="act_purchase_form"/>
|
||||
</record>
|
||||
<record model="ir.action.act_window.domain"
|
||||
id="act_purchase_form_domain_quotation">
|
||||
<field name="name">Quotation</field>
|
||||
<field name="sequence" eval="20"/>
|
||||
<field name="domain">[('state', '=', 'quotation')]</field>
|
||||
<field name="domain" eval="[('state', '=', 'quotation')]" pyson="1"/>
|
||||
<field name="act_window" ref="act_purchase_form"/>
|
||||
</record>
|
||||
<record model="ir.action.act_window.domain"
|
||||
id="act_purchase_form_domain_confirmed">
|
||||
<field name="name">Confirmed</field>
|
||||
<field name="sequence" eval="30"/>
|
||||
<field name="domain">[('state', '=', 'confirmed')]</field>
|
||||
<field name="domain" eval="[('state', '=', 'confirmed')]" pyson="1"/>
|
||||
<field name="act_window" ref="act_purchase_form"/>
|
||||
</record>
|
||||
<record model="ir.action.act_window.domain"
|
||||
id="act_purchase_form_domain_processing">
|
||||
<field name="name">Processing</field>
|
||||
<field name="sequence" eval="40"/>
|
||||
<field name="domain">[('state', '=', 'processing')]</field>
|
||||
<field name="domain" eval="[('state', '=', 'processing')]" pyson="1"/>
|
||||
<field name="act_window" ref="act_purchase_form"/>
|
||||
</record>
|
||||
<record model="ir.action.act_window.domain"
|
||||
@@ -172,7 +178,8 @@ this repository contains the full copyright notices and license terms. -->
|
||||
<record model="ir.action.act_window" id="act_purchase_invoice_relate">
|
||||
<field name="name">Purchases</field>
|
||||
<field name="res_model">purchase.purchase</field>
|
||||
<field name="domain">[('invoices', 'in', Eval('active_ids'))]</field>
|
||||
<field name="domain"
|
||||
eval="[('invoices', 'in', Eval('active_ids'))]" pyson="1"/>
|
||||
</record>
|
||||
<record model="ir.action.act_window.view"
|
||||
id="act_purchase_invoice_relate_view1">
|
||||
@@ -385,7 +392,9 @@ this repository contains the full copyright notices and license terms. -->
|
||||
<field name="global_p" eval="True"/>
|
||||
</record>
|
||||
<record model="ir.rule" id="rule_product_supplier">
|
||||
<field name="domain">[('company', '=', user.company.id if user.company else None)]</field>
|
||||
<field name="domain"
|
||||
eval="[('company', '=', Eval('user', {}).get('company', None))]"
|
||||
pyson="1"/>
|
||||
<field name="rule_group" ref="rule_group_product_supplier"/>
|
||||
</record>
|
||||
|
||||
@@ -425,7 +434,9 @@ this repository contains the full copyright notices and license terms. -->
|
||||
id="act_product_supplier_price_form">
|
||||
<field name="name">Prices</field>
|
||||
<field name="res_model">purchase.product_supplier.price</field>
|
||||
<field name="domain">[('product_supplier', 'in', Eval('active_ids'))]</field>
|
||||
<field name="domain"
|
||||
eval="[('product_supplier', 'in', Eval('active_ids'))]"
|
||||
pyson="1"/>
|
||||
</record>
|
||||
<record model="ir.action.keyword"
|
||||
id="act_product_supplier_price_form_keyword1">
|
||||
@@ -482,7 +493,9 @@ this repository contains the full copyright notices and license terms. -->
|
||||
<field name="global_p" eval="True"/>
|
||||
</record>
|
||||
<record model="ir.rule" id="rule_purchase1">
|
||||
<field name="domain">[('company', '=', user.company.id if user.company else None)]</field>
|
||||
<field name="domain"
|
||||
eval="[('company', '=', Eval('user', {}).get('company', None))]"
|
||||
pyson="1"/>
|
||||
<field name="rule_group" ref="rule_group_purchase"/>
|
||||
</record>
|
||||
|
||||
|
||||
@@ -64,7 +64,7 @@ this repository contains the full copyright notices and license terms. -->
|
||||
<label name="invoice_method"/>
|
||||
<field name="invoice_method"/>
|
||||
<separator name="comment" colspan="4"/>
|
||||
<field name="comment" colspan="4" spell="Eval('party_lang')"/>
|
||||
<field name="comment" colspan="4"/>
|
||||
</page>
|
||||
<page string="Invoices" id="invoices">
|
||||
<field name="invoices" colspan="4"/>
|
||||
|
||||
@@ -15,8 +15,7 @@ this repository contains the full copyright notices and license terms. -->
|
||||
view_ids="purchase.product_view_list_purchase_line"/>
|
||||
<newline/>
|
||||
<label name="description"/>
|
||||
<field name="description" colspan="3" yexpand="0"
|
||||
spell="Get(Eval('_parent_purchase', {}), 'party_lang')"/>
|
||||
<field name="description" colspan="3" yexpand="0"/>
|
||||
<label name="quantity"/>
|
||||
<field name="quantity"/>
|
||||
<label name="unit"/>
|
||||
@@ -33,8 +32,7 @@ this repository contains the full copyright notices and license terms. -->
|
||||
</page>
|
||||
<page string="Notes" id="notes">
|
||||
<separator name="note" colspan="4"/>
|
||||
<field name="note" colspan="4"
|
||||
spell="Get(Eval('_parent_purchase', {}), 'party_lang')"/>
|
||||
<field name="note" colspan="4"/>
|
||||
</page>
|
||||
</notebook>
|
||||
</form>
|
||||
|
||||
@@ -9,9 +9,7 @@ this repository contains the full copyright notices and license terms. -->
|
||||
<field name="purchasable"/>
|
||||
</xpath>
|
||||
<xpath expr="/form/notebook/page[@id='general']" position="after">
|
||||
<page string="Suppliers"
|
||||
states="{'invisible': Not(Bool(Eval('purchasable')))}"
|
||||
id="suppliers">
|
||||
<page string="Suppliers" id="suppliers">
|
||||
<label name="purchasable"/>
|
||||
<field name="purchasable"/>
|
||||
<label name="purchase_uom"/>
|
||||
|
||||
Reference in New Issue
Block a user