Search in sources :

Example 1 with MBPGroup

use of org.compiere.model.MBPGroup in project adempiere by adempiere.

the class MUserTest method testCreateMBPartner.

public void testCreateMBPartner() {
    try {
        m_partner = new MBPartner(getCtx(), 0, getTrxName());
        m_partner.setValue("");
        m_partner.setName("Test MBPartner with contact");
        m_partner.setName2(null);
        m_partner.setDUNS("");
        m_partner.setFirstSale(null);
        //
        m_partner.setSO_CreditLimit(Env.ZERO);
        m_partner.setSO_CreditUsed(Env.ZERO);
        m_partner.setTotalOpenBalance(Env.ZERO);
        //      s_m_partner.setRating(null);
        //
        m_partner.setActualLifeTimeValue(Env.ZERO);
        m_partner.setPotentialLifeTimeValue(Env.ZERO);
        m_partner.setAcqusitionCost(Env.ZERO);
        m_partner.setShareOfCustomer(0);
        m_partner.setSalesVolume(0);
        MBPGroup m_group = new MBPGroup(getCtx(), 0, getTrxName());
        // N
        m_group.setName("Test Group Name");
        // N
        m_group.setIsConfidentialInfo(false);
        m_group.setIsDefault(false);
        m_group.setPriorityBase(MBPGroup.PRIORITYBASE_Same);
        m_group.saveEx();
        m_partner.setBPGroup(m_group);
        // Reset Created, Updated to current system time ( teo_sarca )
        if (m_partner.save()) {
            m_contact = new MUser(getCtx(), 0, getTrxName());
            m_contact.setName("Test Contact Name");
            m_contact.setIsActive(true);
            m_contact.setC_BPartner_ID(m_partner.get_ID());
            m_contact.saveEx();
        }
        commit();
    } catch (Exception e) {
        fail(e.getLocalizedMessage());
    }
}
Also used : MBPGroup(org.compiere.model.MBPGroup) MBPartner(org.compiere.model.MBPartner) MUser(org.compiere.model.MUser) SQLException(java.sql.SQLException)

Example 2 with MBPGroup

use of org.compiere.model.MBPGroup in project adempiere by adempiere.

the class MBPGroupTest method testCreateMBPGroup.

public void testCreateMBPGroup() {
    try {
        m_group = new MBPGroup(getCtx(), 0, getTrxName());
        // N
        m_group.setName("Test Group Name");
        // N
        m_group.setIsConfidentialInfo(false);
        m_group.setIsDefault(false);
        m_group.setPriorityBase(MBPGroup.PRIORITYBASE_Same);
        m_group.saveEx();
        commit();
    } catch (Exception e) {
        fail(e.getLocalizedMessage());
    }
}
Also used : MBPGroup(org.compiere.model.MBPGroup) SQLException(java.sql.SQLException)

Example 3 with MBPGroup

use of org.compiere.model.MBPGroup in project adempiere by adempiere.

the class MBPartnerLocationTest method testCreatePartnerLocation.

public void testCreatePartnerLocation() {
    try {
        location = new MLocation(getCtx(), 0, getTrxName());
        location.setC_Country_ID(getC_Country_ID("United States"));
        location.setC_Region_ID(getC_Region_ID("CA"));
        location.setCity("Windsor");
        location.setAddress1("Happy Lane");
        location.setAddress2("Happy Lane 2");
        String zipcode = ("95492");
        location.setPostal(zipcode);
        location.setPostal_Add(zipcode);
        location.setAD_Org_ID(0);
        location.saveEx();
        m_group = new MBPGroup(getCtx(), 0, getTrxName());
        // N
        m_group.setName("Test Group Name");
        // N
        m_group.setIsConfidentialInfo(false);
        m_group.setIsDefault(false);
        m_group.setPriorityBase(MBPGroup.PRIORITYBASE_Same);
        m_group.saveEx();
        m_partner = new MBPartner(getCtx(), 0, getTrxName());
        m_partner.setValue("");
        m_partner.setName("Test Business Partner Location");
        m_partner.setName2(null);
        m_partner.setDUNS("");
        m_partner.setFirstSale(null);
        //
        m_partner.setSO_CreditLimit(Env.ZERO);
        m_partner.setSO_CreditUsed(Env.ZERO);
        m_partner.setTotalOpenBalance(Env.ZERO);
        //      s_m_partner.setRating(null);
        //
        m_partner.setActualLifeTimeValue(Env.ZERO);
        m_partner.setPotentialLifeTimeValue(Env.ZERO);
        m_partner.setAcqusitionCost(Env.ZERO);
        m_partner.setShareOfCustomer(0);
        m_partner.setSalesVolume(0);
        m_partner.setBPGroup(m_group);
        // Reset Created, Updated to current system time ( teo_sarca )
        if (m_partner.save()) {
            bpl = new MBPartnerLocation(getCtx(), 0, getTrxName());
            bpl.setIsActive(true);
            bpl.setName("Test Business Partner Location");
            bpl.setC_BPartner_ID(m_partner.get_ID());
            bpl.setC_Location_ID(location.get_ID());
            bpl.saveEx();
        }
        commit();
    } catch (Exception e) {
        fail(e.getLocalizedMessage());
    }
}
Also used : MBPGroup(org.compiere.model.MBPGroup) MBPartner(org.compiere.model.MBPartner) MLocation(org.compiere.model.MLocation) SQLException(java.sql.SQLException) MBPartnerLocation(org.compiere.model.MBPartnerLocation)

Aggregations

SQLException (java.sql.SQLException)3 MBPGroup (org.compiere.model.MBPGroup)3 MBPartner (org.compiere.model.MBPartner)2 MBPartnerLocation (org.compiere.model.MBPartnerLocation)1 MLocation (org.compiere.model.MLocation)1 MUser (org.compiere.model.MUser)1