跳至内容
菜单
此问题已终结
2 回复
2557 查看

Hello all,

In Odoo, one have the Upload Vendor Bills option that will automatically try to generate the vendor bill based on the uploaded file.

The same method is called (I believe) if we set an email alias under Vendor Bills journal.

I have the need to inherit the method in order to add additional fields to the generated vendor bill but I cannot find the method itself.

Can anyone help me locate this method? I am using Odoo 17

Thank you all in advance

形象
丢弃
最佳答案

You're on the right track. In Odoo, getting vendor bills in and processing them with an email alias isn't super straightforward. This kinda automation is mainly done in odoo's account module by a method that might be called something like `message_new` or maybe `message_post`. To really nail down which method it is for your version, you gotta check the Python models tied to the accounting features, probably in the `account.move` model.


What you want is making sure you're inheriting the right method. Try poking around for XML files or those Python classes in the account module directories where `account.invoice` or `accout.move` are set up. The trick is usually buried in methods with `@api.model`. But hey, be careful, okay? Editing core functions needs you to be precise or it might mess with your system.


If you haven't already, set up an odoo dev environment. Python debugging tools there will help you spot these method calls. And before anything major, run it through a dev setup with any custom fields to see if they show up right. Check out Odoo community spaces on GitHub or their docs; they're super useful for stuff like this. 

形象
丢弃
最佳答案

In Odoo 17, you can efficiently import customer invoices and vendor bills using the built-in data import feature. Here's a step-by-step guide to help you through the process:​

1. Prepare Your Import File:

  • Export a Template:
    • Navigate to the Accounting module.
    • For customer invoices:
      • Go to Customers > Invoices.
    • For vendor bills:
      • Go to Vendors > Bills.
    • Select an existing record, click on Action, and choose Export.
    • In the export dialog, select the necessary fields you wish to include.
    • Export the file in either .csv or .xlsx format. This file will serve as your template.
  • Populate the Template:
    • Open the exported file in a spreadsheet editor.
    • Add or modify records as needed, ensuring that all mandatory fields are filled correctly.
    • Save the updated file.

2. Import the Data into Odoo:

  • Return to the Accounting module.​
  • Navigate to the section corresponding to your import:​
    • Customers > Invoices for customer invoices.
    • Vendors > Bills for vendor bills.
  • Click on the Import Records option.
  • Upload your prepared .csv or .xlsx file.
  • Map the columns from your file to the corresponding Odoo fields.​
  • Click Test to validate the data.
  • If the validation is successful, click Import to finalize the process.​

3. Post-Import Actions:

  • After importing, the invoices or bills will be in the Draft stage.​
  • Review each record to ensure accuracy.​
  • Confirm the invoices or bills to post them.​

形象
丢弃
编写者

Thank you Dhrumi.

You have not understood my question. I am referring to the "UPLOAD" button in vendor bills to upload vendor bills, for instance a PDF file.

This is not about import/export process.

After Odoo upload/import the PDF file, it will generate a draft invoice to be validated.

Problem is, I need a specific field value to be set when those invoices are generated and this field is not visible for the user.

For instance:
- You upload a vendor bill and Odoo will read the PDF and will generate the draft bill.

If you notice, for the draft bills generated this way, every product lines will have only the product description and the NOT the product_id.

I need to find the method that is called, in order to inherit it and set a predefined product for each line during the bill generation process and also make some additional checks regardless taxes and any other information I may require to validate.

I cannot find this method in Odoo 17 enterprise but I believe it's the same for the coommunity version.

Thank you once again

相关帖文 回复 查看 活动
3
7月 25
2583
1
6月 25
3888
2
5月 25
2598
1
5月 25
1655
1
2月 25
39