so there I have account_move_custom :
class AccountMoveLineCustom(models.Model):
_inherit = 'account.move.line'
fp_final_invoice_id = fields.Many2one(
comodel_name='fp.final.invoice.line')
production_id = fields.Many2one('fp.final.invoice', related='fp_final_invoice_id.production_id', string="Nomor SPK")
and for the view account_move_custom:
?xml version="1.0" encoding="utf-8"?>
odoo>
record model="ir.ui.view" id="flexypack_account_form">
field name="name">flexypack.account.form field name="model">account.move field name="inherit_id" ref="account.view_move_form"/>
field name="arch" type="xml">
data>
xpath expr="//page[@id='invoice_tab']" position="before">
field name="return_sale_id" invisible="1"/>
page id="sales_out_invoice_line_ids_tab" string="Return Invoice Lines" attrs="{'invisible': ['|', ('type', '!=', 'out_refund'), ('return_sale_id', '=', False)]}">
field name="sales_out_invoice_line_ids">
tree string="Journal Items" default_order="sequence, date desc, move_name desc, id">
field name="sequence" widget="handle"/>
field name="move_name" invisible="1"/>
field name="product_id" optional="show" domain="['|', ('company_id', '=', False), ('company_id', '=', parent.company_id)]"/>
field name="name" widget="section_and_note_text" attrs="{'required': [('parent.type', 'not in', ('in_invoice', 'in_refund','in_receipt'))]}"/>
field name="account_id" groups="account.group_account_user" domain="[('deprecated', '=', False), ('user_type_id.type', 'not in', ('receivable', 'payable')), ('company_id', '=', parent.company_id)]" attrs="{'required': [('display_type', '=', False)]}"/>
field name="analytic_account_id" domain="['|', ('company_id', '=', False), ('company_id', '=', parent.company_id)]" groups="analytic.group_analytic_accounting" optional="show"/>
field name="analytic_tag_ids" domain="['|', ('company_id', '=', False), ('company_id', '=', parent.company_id)]" groups="analytic.group_analytic_tags" optional="show" widget="many2many_tags"/>
field name="quantity"/>
field name="product_uom_id" string="UoM" groups="uom.group_uom" optional="show"/>
field name="price_unit" string="Pricee" readonly="0"/>
field name="discount" string="Disc.%" groups="base.group_no_one" optional="show"/>
field name="tax_ids" widget="many2many_tags" domain="[('type_tax_use', '=?', parent.invoice_filter_type_domain), ('company_id', '=', parent.company_id)]" context="{'append_type_to_tax_name': not parent.invoice_filter_type_domain}" options="{'no_create': True}" optional="show"/>
field name="price_subtotal" string="Subtotal" groups="account.group_show_line_subtotals_tax_excluded"/>
field name="price_total" string="Total" groups="account.group_show_line_subtotals_tax_included"/>
/tree>
/field>
/page>
/xpath>
And also there's final_invoice:
class FinalInvoiceLine(models.Model):
_name = "fp.final.invoice.line"
_description = "Final Invoice Line"
name = fields.Char("Label")
final_invoice_id = fields.Many2one("fp.final.invoice")
delivery_id = fields.Many2one(related="final_invoice_id.delivery_id")
main_invoice_id = fields.Many2one(related="final_invoice_id.main_invoice_id")
invoice_ids = fields.Many2many(
"account.move", related="final_invoice_id.invoice_ids"
)
state = fields.Selection(related="final_invoice_id.state")
invoice_id = fields.Many2one("account.move", related="invoice_line_id.move_id")
invoice_line_id = fields.Many2one("account.move.line")
stock_move_id = fields.Many2one(
"stock.move", string="Stock Move", domain="[('picking_id', '=', delivery_id)]"
)
product_id = fields.Many2one("product.product", "Product")
brand_id = fields.Many2one(related="stock_move_id.mrp_design_brand")
variant_id = fields.Many2one(related="stock_move_id.mrp_design_variant")
production_id = fields.Many2one(related="stock_move_id.created_production_id", string="Nomor SPK")
quantity = fields.Integer("Quantity")
currency_id = fields.Many2one(related="final_invoice_id.currency_id")
product_uom_id = fields.Many2one(related="invoice_line_id.product_uom_id")
price_unit = fields.Float(string="Unit Price", digits="Product Price")
discount = fields.Float(string="Discount (%)", digits="Discount", default=0.0)
tax_ids = fields.Many2many(related="invoice_line_id.tax_ids")
price_subtotal = fields.Monetary(
string="Subtotal",
store=True,
compute="compute_price_subtotal",
currency_field="currency_id",
)
I tried add 'production_id' field into after 'product_id' field, the modul can upgraded, but 'production_id' field won't show.
I already try:
xpath expr="//field[@name='invoice_line_ids']/tree/field[@name='product_id']" position="after"
field name="production_id"
/xpath
it's work. But
there's in acc_move_custom.py:
odoo>
record model="ir.ui.view" id="flexypack_account_form">
field name="name">flexypack.account.form</field
field name="model">account.move</field
field name="inherit_id" ref="account.view_move_form"/>
field name="arch" type="xml">
data>
xpath expr="//field[@name='ref']" position="after">
field name="is_sales_document" invisible="1"/>
field name="paid_all_approval_approved" invisible="1"/>
field name="is_claimed_for_sale_id" invisible="1"/>
field name="is_referral_reward"/>
field name="production_ids" />
field name="production_names" />
!-- <field name="production_id" /> -->
field name="extra"/>
/xpath>
xpath expr="//page[@id='invoice_tab']" position="before">
field name="return_sale_id" invisible="1"/>
page id="sales_out_invoice_line_ids_tab" string="Return Invoice Lines" attrs="{'invisible': ['|', ('type', '!=', 'out_refund'), ('return_sale_id', '=', False)]}">
field name="sales_out_invoice_line_ids">
tree string="Journal Items" default_order="sequence, date desc, move_name desc, id">
field name="sequence" widget="handle"/>
field name="move_name" invisible="1"/>
field name="product_id" optional="show" domain="['|', ('company_id', '=', False), ('company_id', '=', parent.company_id)]"/>
/tree>
/field>
/page>
/xpath>
xpath expr="//field[@name='invoice_line_ids']/tree/field[@name='product_id']" position="after">
field name="production_id" string="No SPK"/>
field name="production_ids" />
field name="production_names" />
/xpath>
in this:
class AccountMove(models.Model):
_inherit = 'account.move'
notes = fields.Text(string='Notes')
production_ids = fields.One2many(string='Manufacturing Orders', comodel_name='mrp.production',related='sale_id.mrp_production_ids')
class AccountMoveLineCustom(models.Model):
_inherit = 'account.move.line'
brand_id = fields.Many2one(comodel_name="partner.brand", string="Brand")
variant_id = fields.Many2one(comodel_name="res.partner.brand.variant", string="Variant")
order_lines = fields.Many2many('sale.order.line', 'sale_order_line_invoice_rel', 'invoice_line_id', 'order_line_id', string='Order Lines', copy=False)
acc_move_id = fields.Many2one('account.move')
mrp_prod_ids = fields.Many2one('mrp.production'
production_ids = fields.Char(string='Manufacturing Orders',related='mrp_prod_ids.name')
stock_move_id = fields.Many2one("stock.move", string="Stock Move", domain="[('picking_id', '=', delivery_id)]")
production_id = fields.Many2one(related="stock_move_id.created_production_id", string="Nomor SPK")
fp_final_invoice_id = fields.Many2one('fp.final.invoice.line')
production_names = fields.Many2one('fp_final_invoice_id.production_id', string="Nomor SPK", store=True)
# @api.depends('fp_final_invoice_id')
# def _compute_production_id(self):
# for line in self:
# if line.fp_final_invoice_id:
# line.production_id = line.fp_final_invoice_id.production_id
# else:
# line.production_id = False
# production_ids = fields.One2many(string='Manufacturing Orders', comodel_name='mrp.production',
# related='sale_id.mrp_production_ids')/\
I already tried to show the data of 'production_id', 'production_names', and 'production_ids', in <xpath expr="//field[@name='ref']" position="after"> it's show, but when I add <xpath expr="//field[@name='invoice_line_ids']/tree/field[@name='product_id']" position="after">. But the data won't show.