Skip ke Konten
Menu
Pertanyaan ini telah diberikan tanda
2 Replies
784 Tampilan

i tried to import product , but the income and expense field is filled from primary company not the company i import

Note: the account both have a same code and name only the company is different

Avatar
Buang
Jawaban Terbai

Hi Arun,

I also encountered this problem and I solved it by following these steps:

1/ Step 1: Add the company_code field to the res.company model.

class ResCompany(models.Model):

    _inherit = 'res.company'

    company_code = fields.Char(string='Company Code', required=False, readonly=False, copy = False)


​_sql_constraints = [('company_code _uniq', 'unique(company_code)', 'Company Code must be unique')]


2/ Step 2: Override the name_get function of the account.account model

    def name_get(self):

        res = []

        tmp_d_name = False

        for record in self:

            tmp_d_name = '%s %s' % (record.code, record.name)

            if record.company_id :

​ tmp_d_name= '%s - %s' % (record.company_id.company_code,tmp_d_name)

            res.append((record.id, tmp_d_name))

        return res


3/ Step 3: Use the value displayed on the system of the account_id field to import through customizing the import function. You can refer to the following video:

https://www.youtube.com/watch?v=UOBxxnYDIsM&list=PLSKcWRTtEl5qzvRaI-VTGavfReiHS_EEb&index=1  (starting at 37:00 in this video)

Avatar
Buang
Jawaban Terbai

Hello,

In the product master, import the Income and Expense Account using the External ID or the Database ID of the COA. I think it will resolve your issue.

Avatar
Buang
Post Terkait Replies Tampilan Aktivitas
3
Jul 25
2182
1
Apr 25
1635
0
Okt 24
1299
4
Mei 24
12908
2
Mei 24
4168