繁体   English   中英

Odoo:销售订单中的创建发票按钮消失了

[英]Odoo: Create Invoice button disappeared in Sales Orders

我继承了 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>

我错过了什么?

你可以试试下面的代码。 替换模块中的以下代码部分并进行测试。

<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>

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM