1 year ago

#373742

test-img

Wing Kuan

Odoo 13 Invoice Line Does Not Copy Exact from Sales Order Line

I am currently working with Odoo 13 and I installed Sales_Order_Line_Number from Odoo Store and edited the python code to have the sequence number skipping Sections and Notes.

from odoo import models, api, fields


class SaleOrderLine(models.Model):

    _inherit = 'sale.order.line'

    number = fields.Integer(
        compute='_compute_get_number',
        store=True,
    )

    @api.depends('sequence', 'order_id')
    def _compute_get_number(self):
        for order in self.mapped('order_id'):
            number = 1
            for line in order.order_line:
                if not line.display_type:
                    line.number = number
                    number += 1

However, when I create custom fields to bring the sequence number to Delivery Order and Invoice, the sequence number is different from the one in Sales Order. For example:

SO:

  • Im Section
  • Im Note
    1. I am product

Invoice & DO:

    1. I am product

What I want in Invoice & DO is..

    1. I am product

Can anyone helps me with this? FYI, I created custom fields as below for Invoice & DO. Custom Fields Created:

  1. Model: Stock Move, Related Field: sale_line_id.number
  2. Model: Product Moves (Stock Move Line), Related Field: move_id.x_number
  3. Model: Journal Item, Related Field: sale_line_ids.number
  4. Model: Journal Entry, Related Field: line_ids.x_number

python

odoo

field

odoo-13

0 Answers

Your Answer

Accepted video resources