← Back to team overview

credativ team mailing list archive

Re: [Bug 920267] Re: No Foreign key for company_id in account_period

 

Hi,

OK, I didn't look too deeply into it. I believe you are correct.

I am writing some table copy routines from one db to another and they 
mostly work until we get something like this.
BTW, the ir_properties were a bit of a challenge to copy from one to the 
other.
I was looking for foreign keys in the db but didn't understand why in 
some cases for instance company_id was not a foreign key.

Appreciate your help with this. Can you close the bug then?

Grahame Jordan


On 25/01/12 23:11, Amit Bhavsar (Open ERP) wrote:
> Hello jordg,
>
> I have checked your Issue at my end. Here we can use "fiscalyear_id" as
> a foreign key, so fiscalyear_id are set to the company when create the
> account period.
>
> Let's See In deeply,
> Company_id is related field in account.period object which has the relation with fiscalyear_id and our relation obejct is accoutn.fiscalyear.
> So according to our fiscal year company will be set in our period.
>
> Now comes to related field feature of OpenERP framework. By using this
> field we have fetch the record form the another tabel(object) giving one
> reference field and this reference field becomes our foreign key. So
> here fiscalyear_id is our foreign key and which is related to
> account.fiscalyear obejct as a reference.
>
> So I think all are working as expected, would you please check It and  notify us where you have faced the problem.
> Correct me If I am wrong!
>
>
> Thank you and waiting for your reply!
>
> ** Changed in: openobject-addons
>         Status: New =>  Incomplete

-- 
You received this bug notification because you are a member of OpenERP
Framework Experts, which is subscribed to OpenERP Addons.
https://bugs.launchpad.net/bugs/920267

Title:
  No Foreign key for company_id in account_period

Status in OpenERP Addons (modules):
  Incomplete

Bug description:
  In the table account_period the foreign key for company_id is not
  defined as a foreign key in the database however it acts like one via
  the API.

  psql db_name
  \d account_period

  NOTE: no FOREIGN KEY (company_id) 
  Foreign-key constraints:
      "account_period_create_uid_fkey" FOREIGN KEY (create_uid) REFERENCES res_users(id) ON DELETE SET NULL
      "account_period_fiscalyear_id_fkey" FOREIGN KEY (fiscalyear_id) REFERENCES account_fiscalyear(id) ON DELETE SET NULL
      "account_period_write_uid_fkey" FOREIGN KEY (write_uid) REFERENCES res_users(id) ON DELETE SET NULL

To manage notifications about this bug go to:
https://bugs.launchpad.net/openobject-addons/+bug/920267/+subscriptions


References