我继承了sale.order视图,删除了一些我不需要的字段,并添加了我自己的字段,但是现在当我确认报价时,“创建发票”按钮不再显示,因为它以前是使用原始模块,这是我的代码
class SalesOrderInherit(models.Model):
_inherit = 'sale.order'
product_ids = fields.One2many("product.sale.line", "sale_id", string="Products", required=False, )
total_amount = fields.Float(string='Total', store=True, readonly=True,)
class ProductSaleLine(models.Model):
_name = 'product.sale.line'
_description = 'Product Sale Line'
sale_id = fields.Many2one('sale.order', string='Offer ID', )
product_id = fields.Many2one('custom.product', string="Product", required=True, )
qty = fields.Integer(string='Ordered Quantity', required=True, )
brand_id = fields.Many2one('custom.brand', related='product_id.brand_id', required=True, )
country_id = fields.Many2one('custom.country', related='product_id.country_id', required=True, )
sell_price = fields.Float('Price', related='product_id.sell_price', required=True, )
price_subtotal = fields.Float(string='Subtotal', readonly=True, store=True)
<field name="order_line" position="replace">
<field name="product_ids"/>
</field>
<field name="amount_total" position="replace">
<field name="total_amount" nolabel="1" class="oe_subtotal_footer_separator"/>
</field>
<xpath expr="//page[@name='other_information']" position="attributes">
<attribute name="invisible">1</attribute>
</xpath>
<xpath expr="//page[2]" position="attributes">
<attribute name="invisible">1</attribute>
</xpath>
<xpath expr="//field[@name='note']" position="attributes">
<attribute name="invisible">1</attribute>
</xpath>
<xpath expr="//field[@name='validity_date']" position="attributes">
<attribute name="invisible">1</attribute>
</xpath>
<xpath expr="//field[@name='partner_invoice_id']" position="attributes">
<attribute name="invisible">1</attribute>
</xpath>
<xpath expr="//field[@name='partner_shipping_id']" position="attributes">
<attribute name="invisible">1</attribute>
</xpath>
<xpath expr="//field[@name='partner_invoice_id']" position="attributes">
<attribute name="invisible">1</attribute>
</xpath>
<xpath expr="//field[@name='sale_order_template_id']" position="attributes">
<attribute name="invisible">1</attribute>
</xpath>
<xpath expr="//field[@name='amount_tax']" position="attributes">
<attribute name="invisible">1</attribute>
</xpath>
<xpath expr="//field[@name='amount_untaxed']" position="attributes">
<attribute name="invisible">1</attribute>
</xpath>
我想念什么?
答案 0 :(得分:0)
您可以尝试以下代码。在模块中替换下面的代码部分并进行测试。
<xpath expr="//notebook/page[1]" position="replace">
<field name="order_line">
<field name="product_ids" mode="tree">
<tree editable="bottom">
<control>
<create string="Add a product"/>
</control>
<field name="product_id"/>
<field name="brand_id"/>
<field name="country_id"/>
<field name="sell_price"/>
<field name="qty"/>
<field name="price_subtotal"/>
<field name="sale_id" invisible="1"/>
</tree>
</field>
</field>
</xpath>