以前,odoo 15中的报价日期字段直到我删除了"组";属性。它现在是可见的,但不幸的是,它不允许用户追溯报价日期或创建日期。我尝试过在表单视图中编辑字段,但目前似乎没有任何效果。有人能给我一个建议,让我的报价日期回到最新日期吗?这是报价日期字段的当前代码;组";删除的属性:<field name="date_order" nolabel="1" attrs="{'invisible': [('state', 'in', ['sale', 'done', 'cancel'])]}"/>
以及它所属组的代码:
<group name="order_details">
<field name="validity_date" attrs="{'invisible': [('state', 'in', ['sale', 'done'])]}"/>
<div class="o_td_label" attrs="{'invisible': [('state', 'in', ['sale', 'done', 'cancel'])]}">
<label for="date_order" string="Quotation Date"/>
</div>
<field name="date_order" nolabel="1" attrs="{'invisible': [('state', 'in', ['sale', 'done', 'cancel'])]}"/>
<div class="o_td_label" attrs="{'invisible': [('state', 'in', ['draft', 'sent'])]}">
<label for="date_order" string="Order Date"/>
</div>
<field name="date_order" attrs="{'required': [('state', 'in', ['sale', 'done'])], 'invisible': [('state', 'in', ['draft', 'sent'])]}" nolabel="1"/>
<field name="show_update_pricelist" invisible="1"/>
<label for="pricelist_id" groups="product.group_product_pricelist"/>
<div groups="product.group_product_pricelist" class="o_row">
<field name="pricelist_id" options="{'no_open':True,'no_create': True}"/>
<button name="update_prices" type="object" string=" Update Prices" help="Recompute all prices based on this pricelist" class="btn-link mb-1 px-0" icon="fa-refresh" confirm="This will update all unit prices based on the currently set pricelist." attrs="{'invisible': ['|', ('show_update_pricelist', '=', False), ('state', 'in', ['sale', 'done','cancel'])]}"/>
</div>
<field name="currency_id" invisible="1"/>
<field name="tax_country_id" invisible="1"/>
<field name="payment_term_id" options="{'no_open':True,'no_create': True}"/>
</group>
实际上,删除组后,date_order
将显示在表单中,您可以更改并保存它,但当您确认报价时,日期将更新为今天的日期,下面在action_confirm
中调用的方法可以做到这一点。
def _prepare_confirmation_values(self):
return {
'state': 'sale',
'date_order': fields.Datetime.now()
}
您可以按如下方式覆盖此方法:
from odoo import models
class SaleOrder(models.Model):
_inherit = "sale.order"
def _prepare_confirmation_values(self):
return {
'state': 'sale'
}