Browse Source

dolibarr 4.0 compatibility (partially)

table llx_accountingaccount -> llx_accounting_account

The multicurrency is not supported
Philippe Le Brouster 8 years ago
parent
commit
949d3006da
1 changed files with 9 additions and 0 deletions
  1. 9 0
      himports/dolibarrAlchemy.py

+ 9 - 0
himports/dolibarrAlchemy.py

@@ -52,6 +52,9 @@ class DolibarrSQLAlchemy(object):
         class DolibarrBase(DeferredReflection, Base):
             __abstract__ = True
 
+            @classmethod
+            def is40(cls):
+                return cls.metadata.info['dolibarr_version'].startswith("4.0")
 
         class Bank(DolibarrBase):
             __tablename__ = "llx_bank"
@@ -304,6 +307,8 @@ class DolibarrSQLAlchemy(object):
                 lazy="subquery",
             )
 
+            if DolibarrBase.is40():
+                fk_code_ventilation = Column(Integer, ForeignKey('llx_accounting_account.rowid'))
 
         class FactureFournDet(DolibarrBase):
             __tablename__ = "llx_facture_fourn_det"
@@ -329,12 +334,16 @@ class DolibarrSQLAlchemy(object):
                 lazy="subquery",
             )
 
+            if DolibarrBase.is40():
+                fk_code_ventilation = Column(Integer, ForeignKey('llx_accounting_account.rowid'))
 
         class AccountingAccount(DolibarrBase):
 
             __tablename__ = "llx_accountingaccount"
             id = Column("rowid", Integer, primary_key=True)
 
+            if DolibarrBase.is40():
+                __tablename__ = "llx_accounting_account"
 
         self.Bank = Bank
         self.Facture = Facture